Callbacks (WebHooks)

Callbacks are notifications that you 've asked Routee to send back to you (well, in your web service).

There are two type of callbacks:

Voice Messaging Callbacks

Voice callbacks are generated when the status of a Voice message is changing. They can be used either when sending only one Voice message or a campaign.

Your callback service will receive a POST HTTP request with the following request body for an individual message progress of the Voice campaign:

{
  "messageId": "string",
  "campaignTrackingId": "string",
  "to": "string",
  "groups": [
    "string"
  ],
  "campaignName": "string",
  "from": "string",
  "country": "string",
  "applicationName": "string", 
  "price": "number",
  "originatingService": "string",
  "status": {
    "name": "string",
    "updatedDate": "string"
  },
  "direction": "string",
  "audioMessage": {
    "text": "string",
    "language": "string",
    "gender": "string"
  },
  "fileURL": "string",
  "hangupDelay": "number",
  "respectQuietHours": "boolean",
  "duration": "number",
  "createdAt": "date",
  "chargeInterval": "number"
}
KEYDESCRIPTION
messageIdThe trackingId of the Voice message.
campaignTrackingIdThe trackingId of the campaign.
toThe recipient of the Voice message (in E.164 format).
fromThe senderId of the Voice message.
countryThe country of the recipient.
operatorThe operator of the recipient.
groupsAll contact groups (tags) that this contact belongs to.
campaignNameThe name of the Voice Campaign.
statusThe full status object of the Voice message.
status.nameThe status name of the Voice message.
status.updatedDateThe date of the last status change of the Voice.
applicationNameThe name of the application that was used to send this message.
priceThe cost of the Voice.
directionThe direction of the Voice.
originatingServiceThe service that sent this message.
audioMessage.textThe message that was sent.
audioMessage.genderThe gender of the voice message to be played. VALUES: "male", "female".
audioMessage.languageThe language of the voice message to be played. VALUES: "en-US", "de-DE", "fr-FR", "it-IT", "pt-BR", "es-ES", "es-LA", "en-GB", "el-GR", "bg-BG", "pl-PL", "hu-HU", "sv-SE".
fileURLThe Url that was sent.
hangUpDelayThe time to wait for the call to be answered
respectQuietHoursIndicates if the call should respect the quiet hours, default value: false.
createdAtThe time the message was created.
chargeIntervalThe time interval used for charging this voice message (in seconds).

Voice Campaign Callback

When used for a voice campaign, the callback will be called when the campaign has received a final status (OnCompletion) or every time a total of 10% of the campaign Voice messages, changes status (OnChange).
Your callback service will receive a POST HTTP request with the following request body:

{
  "trackingId": "string",
  "name": "string",
  "totalRecipients": "string",
  "campaignStatus": "string",
  "messageStatuses": {
    "Unknown": "string",
    "Queued": "string",
    "Initiated": "string" ,
    "Ringing": "string" ,
    "InProgress": "string" ,
    "Completed": "string",
    "Busy": "string",
    "NoAnswer": "string",
    "Failed": "string" 
  },
  "callbackInfo": {
    "url": "string",
    "strategy": "string"
  }
}
KEYDESCRIPTION
trackingIdThe trackingId of the campaign
nameThe name of the SMS campaign
totalRecipientsThe number of recipients that participate in the campaign
campaignStatusThe status of the bulk campaign (see above)
messageStatusesDefines the number of Voice per message status.
callbackInfoDefines the notification callback information for the progress of the bulk send out - campaign
callbackInfo.urlThe URL that will be called when an update occurs
callbackInfo.strategyStates when the URL will be called.
Choose one of the two options:
on every status change (OnChange)
or
when a final status arrives (OnCompletion)

Callback strategy

Choose when Routee POSTs to your URL:

StrategyWhen callbacks fire
OnChangeEvery time an individual Voice message changes status. For campaigns, also fires on each 10% progress milestone.
OnCompletionOnly when an Voice message or campaign reaches a final status.
High volume warningOnChange on large bulk campaigns generates one request per status change per recipient. Prefer OnCompletion unless you need per-message updates.

Callback retry policy

Your endpoint must respond with HTTP 200 OK within 2 seconds. Otherwise Routee closes the connection and retries (up to 12 attempts over 24 hours).

AttemptDelay after previous try
1st30 sec
2nd1 min
3rd2 min
4th5 min
5th10 min
6th15 min
7th30 min
8th1 hour
9th2 hours
10th4 hours
11th8 hours
12th24 hours

Design your handler to be idempotent — the same event may be delivered more than once.

Secure your endpoint — Serve callbacks over HTTPS and include a hard-to-guess secret in the callback URL path or query string. Validate it on every request.

What’s Next