Credit notification Webhooks
Credit notification webhooks requests are sent to your endpoints when you have created a credit notification, and specified a webhook url as part of the setup.
A Credit notification webhook request will be made to your specified endpoint within a minute of your account falling below the threshold you configured in the notification.
Request
In this example, the URL supplied in the callback parameter is:
https://my-website.com/credit-notificationEndpoint
A POST request will be made to your endpoint
https://my-website.com/credit-notificationBody
{
"notification_uuid": "3dd57172-eb3b-4158-865b-1e65688933c8",
"account_uuid": "ecc6808e-d3a6-4668-8f8f-cc8913b5cac7",
"threshold_type": "paid_fixed_number",
"threshold_value": 20,
"paid_credit_balance": 19,
"packaged_credit_balance": 0
}{
"notification_uuid": "3dd57172-eb3b-4158-865b-1e65688933c8",
"account_uuid": "ecc6808e-d3a6-4668-8f8f-cc8913b5cac7",
"threshold_type": "paid_negative_percentage",
"threshold_value": 0.2,
"paid_credit_balance": -801,
"packaged_credit_balance": 0
// In this example, the negative limit is -1000
}{
"notification_uuid": "3dd57172-eb3b-4158-865b-1e65688933c8",
"account_uuid": "ecc6808e-d3a6-4668-8f8f-cc8913b5cac7",
"threshold_type": "packaged_fixed_number",
"threshold_value": 5,
"paid_credit_balance": 250,
"packaged_credit_balance": 4
}| Key | Expected value | Description |
|---|---|---|
notification_uuid | string | The UUID of the triggered notification |
account_uuid | string | The UUID of the account to attach the notification to |
threshold_type | ThresholdType (string) | The ThresholdType for this notification |
threshold_value | numeric | The threshold value for this notification |
paid_credit_balance | numeric | Remaining paid credits as of this notification being triggered |
packaged_credit_balance | numeric | Remaining packaged credits as of this notification being triggered |
ThresholdType string
We support 5 different threshold_types, each of which can be either a fixed_number or percentage threshold.
| Value | Type | Description |
|---|---|---|
paid_negative_fixed_number | fixed_number | Trigger when remaining negative credits fall below a fixed number |
paid_negative_percentage | percentage | Trigger when remaining negative credits fall below a percentage of the negative limit |
paid_fixed_number | fixed_number | Trigger when paid credits fall below a fixed number |
packaged_fixed_number | fixed_number | Trigger when packaged credits fall below a fixed number |
packaged_percentage | percentage | Trigger when packaged credits fall below a percentage of the packaged credit refill value |
Threshold types with a fixed_number threshold must have the threshold_value supplied as exactly the value you want credits to fall below. Eg. 120 represents a credit threshold of 120 credits.
Threshold types with a percentage threshold must have the threshold_value supplied as a 0..1 floating point number. Eg. 0.25 represents a threshold of 25%.
Response
Messaging Plus expects a 200 response to the webhook. If a non-200 response is supplied, we will retry up to 5 times.