Skip to content

Message Streams

Igor Balos edited this page Dec 8, 2020 · 5 revisions

For these API requests you will need to use a server API token. Once you obtain it, you will need to use server API client.

ApiClient client = Postmark.getApiClient(<server token>);

List message streams

//Message Streams list
MessageStreams streams = client.getMessageStreams(Parameters.init().build("MessageStreamType","broadcasts"));
System.out.println(streams.getMessageStreams()[0].getName());

Retrieve single message stream

// Get stream with filter
String streamId="bulk";
MessageStream stream = client.getMessageStream(streamId);
System.out.println(stream.getName());

Update message stream

MessageStream stream = new MessageStream();
stream.setDescription("Igor bulker is now really");
stream.setSubscriptionManagementConfiguration(new SubscriptionManagementConfiguration("Custom"));
MessageStream response = client.setMessageStream("bulk", stream);

Create message stream

MessageStream streamToCreate = new MessageStream("bulker11","bulk name", "description", "Broadcasts", new SubscriptionManagementConfiguration());

MessageStream streamResponse = client.createMessageStream(streamToCreate);
System.out.println(streamResponse.getName());

Archive message stream

MessageStreamArchiveResponse response = client.archiveMessageStream("bulk");

Unarchive message stream

MessageStreamUnarchiveResponse response = client.unarchiveMessageStream("bulk");