MessageBird allows you configure webhooks in the Notifications Center for any available product. These will then receive webhooks for notifications subscribed to under that product.
The following is an example of the expected webhook body all notifications will adhere to.
{"id": "af7f6295-50ff-4c0e-99f1-8976b9d27c5c","title": "title example","message": "something significant happened for {{you}} on whatsapp","category": "WhatsApp","subscription_type": "whatsapp-account-update","severity": "info","calls_to_action": [{"type": "GOTO","url": "https://relevant-link.com/link1","display_text": "Go To"}],"variables": {"you": {"type": "LINK","url": "https://relevant-link.com/link2","display_text": "YOU"}},metadata: {"extra': "information","not': "required"},"created_at": "2022-08-12T12:00:00Z"}
Name | Type | Description | Optional |
---|---|---|---|
id | string | The unique identifier of the notification. | No |
title | string | The optional title message of the notification. | Yes |
message | string | The notification body message. | No |
category | string | The event/notification product it falls under. See Categories & Subscription Types below. | No |
subscription_type | string | The event/notification type the notification is related to. See Categories & Subscription Types below. | No |
severity | string | The severity of the event. success, info, warning, error | No |
calls_to_action | array[CallToAction] | The additional calls to action that are sent with the notification. | Yes |
variables | map[string]Variable | A mapping of each variable name found in the notification message to its data object. | Yes |
metadata | json | Any additional data that is supplied for the specific notification. Documentation TBD | Yes |
created_at | datetime | The time of creation. | No |
For each notification, there will be a category with the subscription_type it falls under. Here is a list of all possible categories and their respective subscription_types.
Category | Subscription Types |
---|---|
whatsapp-channel-update, whatsapp-account-update, whatsapp-phone-number-update, whatsapp-template-update |
Calls to action can be included on a notification to provide ways forward based on the notification.
Name | Type | Description | Optional |
---|---|---|---|
type | string | Types: GOTO | No |
url | string | URL for a GOTO type call to action. | No |
display_text | string | The display text for the call to action. | No |
A variable will exist on the notification if the notification message contains the same named variable as shown:
{"message": "This is a message with a {{var1}}.","variables": {"var1": {"type": "LINK","url": "https://valid.com/link","display_text": "link"}}}
Name | Type | Description | Optional |
---|---|---|---|
type | string | Types: LINK | No |
url | string | URL for a LINK type variable. | No |
display_text | string | The display text that would replace the variable. (Used in rendering an html a tag) | No |