Webhooks
For more information on how to use these endpoints see Setting up Webhooks and Webhooks.
Register Webhook POST /webhooks
List Webhooks GET /webhooks
Update Webhook PATCH /webhooks/{webhookId}
Delete Webhook DELETE /webhooks/{webhookId}
You will need the {webhookId} of the webhook you want to update/delete. The ids for all your registered webhooks can be found by calling the List Webhooks endpoint.
Register Webhook
POST /webhooks
Headers
Content-Type
application/json
Bearer <APIKey>
Request Fields
event(required)
string
The event type to be registered: message-reply, delivery-status,message-send , or number-opt-in.
url(required)
string
This is your hosted URL endpoint that Mobile Text Alerts will make a POST request to when events trigger.
The only requirement for this endpoint is that the response has a 200 HTTP status code.
secret(required)
string
This is shared secret between your organization and Mobile Text Alerts, used to authenticate webhook requests. Your webhook listener validates the value in the request with the shared secret.
alertEmail
string
The email address to be contacted for failure email alerts.
If an alertEmail is not configured but sendAlertEmail is set to true, the account's main email will be used.
sendAlertEmail
boolean
Default value is false .
If true, Mobile Text Alerts will send a failure alert email to the configured alertEmail on the webhook. Iffalse (or not supplied when registering the webhook) no failure email alerts will be sent.
skipErrors
boolean
If set to true, all error responses(non-200) for requests to your configured URL will be ignored. If failure email alerts are configured, they will not be triggered.
skipErrorCodes
string[]
This field can be used to indicate specific error codes to be ignored, failure email alerts will not be sent for these codes.
retryOnError
boolean
If set to true, a retry request will be made to your configured URL if the previous request resulted in an error response. Which responses are errors is determined by if skipErrors is enabled (all non-200 status codes ignored as errors) or skipErrorCodes (all specified error codes ignored as errors).
Mobile Text Alerts uses exponential backoff for retry calls, with up to 2 retry attempts.
maxThroughputPerMinute
number
Indicate the maximum number of requests that can be sent to the configured URL in a 60 second window.
Example Request
Requirements: Node.js 18+ (native fetch) and an MTA_API_KEY environment variable.
Requirements: pip install requests and an MTA_API_KEY environment variable.
Response
List Webhooks
GET /webhooks
You can view all the webhooks that have been configured for your account by calling the List Webhooks endpoint.
Headers
Content-Type
application/json
Bearer <APIKey>
Example Request
Response
Update Webhook
PATCH /webhooks/{webhookId}
You can edit an existing webhook you have created on your account by calling this endpoint. The path includes the {webhookId} of the webhook to be updated.
Headers
Content-Type
application/json
Bearer <APIKey>
Request Fields
event: string- Event type. One of:message-reply,delivery-status,message-send,number-opt-in.url: string- Your hosted endpoint URL that receives webhookPOSTrequests.secret: string- Shared secret used to sign webhook requests.alertEmail: string- Email address to receive failure alerts.sendAlertEmail: boolean- Iftrue, send failure alert emails.skipErrors: boolean- Iftrue, ignore all non-200responses from your endpoint.skipErrorCodes: string[]- Error codes to ignore.retryOnError: boolean- Iftrue, retry failed webhook requests (exponential backoff, up to 2 attempts).maxThroughputPerMinute: number- Max requests per 60-second window.
Example Request
Requirements: Node.js 18+ (native fetch) and an MTA_API_KEY environment variable.
Requirements: pip install requests and an MTA_API_KEY environment variable.
Response
Delete Webhook
DELETE /webhooks/{webhookId}
Webhooks can be deleted without needing to supply a request body. Simply include the {webhookId} of the webhook to be deleted as a path parameter.
Headers
Content-Type
application/json
Bearer <APIKey>
Example Request
Response
Last updated
Was this helpful?