-
Notifications
You must be signed in to change notification settings - Fork 33
Handling Web Hooks
Igor Balos edited this page Jul 31, 2023
·
6 revisions
If you have setup one or more web hook URLs you will probably retrieve the web hooks with http client of your preference. If you use Typescript, you can use types from Postmark NodeJS library on web hooks you retrieve to manage JSON web hooks easier.
You can find examples below how to do that. In example we are using axios as http client.
const httpClient = require('axios');
httpClient.get("https://www.example.com/inbound-hook").then((response:any) => {
let inboundWebhook:postmark.Models.InboundWebhook = response.data;
console.log(inboundWebhook.From)
}).catch((error:Error) => {
console.log("Error: ", error.message);
});
const httpClient = require('axios');
httpClient.get("https://www.example.com/delivery-hook").then((response:any) => {
let deliveryWebhook:postmark.Models.DeliveryWebhook = response.data;
console.log(deliveryWebhook.MessageId);
}).catch((error:Error) => {
console.log("Error: ", error.message);
});
const httpClient = require('axios');
httpClient.get("https://www.example.com/bounce-hook").then((response:any) => {
let bounceWebhook:postmark.Models.BounceWebhook = response.data;
console.log(bounceWebhook.MessageID)
console.log(bounceWebhook.ServerID)
}).catch((error:Error) => {
console.log("Error: ", error.message);
});
Webhook types are available in Postmark library since version 3.0.19.
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