Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 31
Webhooks
Igor Balos edited this page Nov 6, 2019
·
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.
ApiClientclient = Postmark.getApiClient(<servertoken>);Get list of available webhooks
Webhookswebhooks = client.getWebhooks();
// get URL of the first webhook in the listwebhooks.getWebhooks().get(0).getUrl();To retrieve webhooks per stream:
Webhookswebhooks = client.getWebhooks(Parameters.init().build("messageStream", "outbound"));Get webhook by ID
Webhookswebhooks = client.getWebhooks();
IntegerwebhookId = webhooks.getWebhooks().get(0).getId();
// get webhook by IDWebhookwebhook = client.getWebhook(webhookId);Create a new webhook
WebhookTriggerstriggers = newWebhookTriggers();
triggers.setBounce(newBounceWebhookTrigger(true));
triggers.setClick(newWebhookTrigger(true));
// create a new webhookWebhookwebhookToCreate = client.createWebhook(newWebhook("http://example.com", triggers));Update webhok by ID
WebhookwebhookUpdated = client.setWebhook(12345, newWebhook("http://example-changed.com"));Delete webhook by ID
Stringresponse = client.deleteWebhook(webhookId);For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.