-
Notifications
You must be signed in to change notification settings - Fork 33
Message Streams
Igor Balos edited this page Mar 8, 2021
·
4 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.
let postmark = require("postmark")
const serverToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx"
let client = new postmark.ServerClient(serverToken);
client.getMessageStreams({includeArchivedStreams: true, messageStreamType: 'inbound'}).then(result => {
const stream = result.MessageStreams[0];
console.log(result.TotalCount);
console.log(stream.Name);
console.log(stream.Description);
});
client.getMessageStream('outbound').then(result => {
console.log(result.Name);
console.log(result.Description);
});
client.editMessageStream('outbound',
{ Name: 'Default Outbound Stream',
Description: 'Description',
SubscriptionManagementConfiguration: { UnsubscribeHandlingType: UnsubscribeHandlingTypes.Postmark}
}).then(result => {
console.log(result)
})
client.createMessageStream({
Name: 'Test', ID: 'teststream', MessageStreamType: 'Transactional',
SubscriptionManagementConfiguration: {UnsubscribeHandlingType: UnsubscribeHandlingTypes.None},
}).then( result => {
console.log(result);
}).catch( error => {
console.log(error);
});
client.archiveMessageStream('streamid').then(result => {
console.log(result.ExpectedPurgeDate)
});
client.unarchiveMessageStream('streamid').then( result => {
console.log(result.Name);
console.log(result.ExpectedPurgeDate);
console.log(result.SubscriptionManagementConfiguration);
console.log(result);
})
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.
- Overview
- Migration from older version
- Getting started
- Email sending
- Bounces
- Templates
- Templates Push
- Server
- Servers
- Message Streams
- Webhooks
- Messages
- Domains
- Sender Signatures
- Stats
- Trigger Inbound Rules
- Suppressions
- Data Removal
- Embedding images in emails
- Error Handling
- Handling Web Hooks
- Mocking requests
- Troubleshooting
- Known issues and how to resolve them