-
Notifications
You must be signed in to change notification settings - Fork 53
Working with Message Streams
Vlad-Cosmin Sandu edited this page Jun 8, 2020
·
1 revision
The PostmarkClient
allows you to easily manage your Message Streams.
use Postmark\PostmarkClient;
$client = new PostmarkClient("<server token>");
$messageStreamId = "my-stream-id";
$result = $client->getMessageStream($messageStreamId);
use Postmark\PostmarkClient;
$client = new PostmarkClient("<server token>");
$messageStreamType = "Transactional"; // Filter by stream type; Defaults to All.
$includeArchivedStreams = true; // Optional. Defaults to false.
$result = $client->listMessageStreams($messageStreamType, $includeArchivedStreams);
use Postmark\PostmarkClient;
$client = new PostmarkClient("<server token>");
$id = "new-stream-id";
$messageStreamType = "Broadcasts";
$name = "My Broadcasts Stream";
$description = "This is my new stream description."; // optional
$createdStream = $client->createMessageStream($id, $messageStreamType, $name, $description);
use Postmark\PostmarkClient;
$client = new PostmarkClient("<server token>");
$id = "my-stream-id";
$updatedName = "New Name"; // optional
$updatedDescription = "New Description"; // optional
$updatedStream = $client->editMessageStream($id, $updatedName, $updatedDescription);
use Postmark\PostmarkClient;
$client = new PostmarkClient("<server token>");
$id = "stream-to-archive";
$archivalConfirmation = $client->archiveMessageStream($id);
Archiving a message stream will disable sending/receiving messages via that stream.
The stream will also stop being shown in the Postmark UI.
Once a stream has been archived, it will be deleted (alongside associated data) at the ExpectedPurgeDate
in the response.
use Postmark\PostmarkClient;
$client = new PostmarkClient("<server token>");
$id = "archived-stream-id";
$unarchivedStream = $client->unarchiveMessageStream($id);
Unarchiving a message stream will resume sending/receiving messages via that stream.
The stream will also re-appear in the Postmark UI.
A stream can be unarchived only before the stream's ExpectedPurgeDate
.
The Postmark-PHP client can be installed from Packagist.
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.