1. Create a Notification Webhook
Make an HTTP POST request to the following endpoint:
Query parameters to include:
url (string): Your webhook handler URL (for example, https://yourdomain.com/webhook)
notification_type (string): The type of notification you want to receive (e.g., message_new, new_reservation)
auth (optional, string): An optional token or secret to help validate incoming requests. This value will be included in the payload of incoming webhook requests.
Example request body:
{
“url”: “https://yourdomain.com/webhook”,
“notification_type”: “message_new”,
“auth”: “your-secret-token”
}
2. SNS Sends Subscription Confirmation
Once the webhook is created, Amazon SNS sends a subscription confirmation request to your webhook URL.
Example payload:
{
“Type”: “SubscriptionConfirmation”,
“MessageId”: “abc123”,
“Token”: “XYZTOKEN”,
“TopicArn”: “arn:aws:sns:eu-central-1:xxxxxxxx:HostifyWebhooks”,
“Message”: “You have chosen to subscribe to the topic…”,
“Timestamp”: “2022-11-10T07:00:36.034Z”
}
3. Confirm the Subscription
To start receiving actual notifications, you must confirm the subscription. This is done by sending a GET request to the SubscribeURL provided in the payload above.
Example (using curl):
Important: If you do not confirm the subscription, you will not receive any notifications.
4. Start Receiving Notifications
Once the subscription is confirmed, you will start receiving actual notifications to your webhook URL.
Example notification payload:
{
“Type”: “Notification”,
“MessageId”: “msg-abc”,
“TopicArn”: “arn:aws:sns:…”,
“Message”: “{ "type": "message_new", "reservation_id": 12345, "message": "Guest: Hello!" }”,
“Timestamp”: “2025-07-07T14:00:00.000Z”
}
Note: The “Message” field is a JSON string. You will need to parse it to extract the actual notification data.
Final Notes
Make sure the webhook URL you provide is publicly accessible and can handle POST requests.
If you included an auth token when registering the webhook, use it to verify incoming requests.
Always confirm the subscription when receiving a SubscriptionConfirmation message.
Consider logging or retrying failed webhook deliveries for reliability.