Overview

Integration

User guide

API reference

Webhooks

Subscription change webhook

What is a subscription change? #

A subscription change recorded when an address is added or removed from a Stream Suppression list. An email address is added to a suppression list after a Hard Bounce, Spam Complaint, or Manual Suppression. A manual suppression is created in Postmark's UI or using the API. An email address is removed from the suppression list manually by choosing an address to reactivate in Postmark's UI or using the API.

You can also get the suppression list using the API.

Note: The datetime for the ChangedAt field is in ISO 8601 format.

Set the subscription change webhook URL #

Using the Postmark website

When logged into Postmark, select the Server, then Stream and go to Webhooks. Choose Add webhook and input your webhook URL in Webhook URL and then select the Subscription Change checkbox.

Using the API

You can modify the SubscriptionChange field using the Webhooks API to edit an existing Webhook. You can also use the Webhooks API to create webhooks and set the SubscriptionChange field at the same time.

Subscription change webhook data #

An example of the full JSON document that would be POSTed to your webhook URL is to the right.

  • The SuppressSending field will inform whether that was a deactivation or reactivation.
  • The Origin field shows where that originated from. e.g.: Recipient, Customer, Admin

Example JSON webhook data

{  
  "RecordType":"SubscriptionChange",
  "ServerID":123456,
  "MessageStream": "outbound",
  "ChangedAt": "2020-02-01T10:53:34.416071Z",
  "Recipient": "bounced-address@wildbit.com",
  "Origin": "Recipient",
  "SuppressSending": true,
  "Tag": "my-tag",
  "Metadata": {
    "example": "value",
    "example_2": "value"
  }
}

Testing the subscription change webhook with curl #

If you’re developing on your local machine or don’t have a public URL for your API, the curl request to the right has an example webhook POST request. Replace with the API route that you want to use for your webhook URL. The curl request will allow you to verify that your webhook URL is able to accept requests with the same JSON format that the Postmark servers will use.

Example curl call

curl <your-url> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"RecordType":"SubscriptionChange","ServerID":4509041,"MessageStream":"outbound","ChangedAt":"2020-02-01T10:53:34.416071Z","Recipient":"hard-bounce@wildbit.com","Origin":"Customer","SuppressSending":true,"Tag":"my-tag","Metadata":{"example": "value","example_2": "value"}}

How you can use the subscription change data #

There are many possible uses for the data provided by using the subscription change webhook:

  • Use the webhook in place of the bounce and spam complaints webhook to receive notifications on inactive addresses.
  • Maintain a suppression list of your own
  • Notify a user in your app their address is currently active/inactive.