Callbacks

Callback overview

Callbacks allow custom applications to register URLs with Whispir that are used for notifications when certain events occur. For example, a response to a message is received, or a message was undeliverable.

 

 

Whispir’s callback service forwards the content of each message response, along with some associated metadata to a URL that you’ve pre-registered to receive this information.

Some other points to note:

  • Always use a domain name for the callback. Do not use an IP.
  • Ensure that your callback server is reachable on the internet. It should not be localhost or an intranet-only application that can't be reached from the World Wide Web.
  • Limit the port to 80 or 443. Do not use any other ports.
  • Depending on the type chosen (‘json’ or ‘xml’) for the Content-Type, Whispir would make a similar GET (and subsequently POST) call. Ensure that your web server is configured to handle such MIME types.
  • Most importantly, if your application infrastructure is behind a firewall, make sure that the firewall allows an incoming POST request.
  • JSON
  • XML

Callback overview

Whispir can notify your application when your SMS, email or voice messages receive a reply.

The example below shows a callback that your application or service would receive:

 

{{codeStart}}

HTTP 1.1 POST http://yourserver/callback.php

Content-Type: application/json

{

"messageid":"ABC4857BCCF484575FCA",

"messagelocation" : "https://api.<region>.whispir.com/messages/ABC4857BCCF484575FCA",

"from":{

"name":"Fred Waters",

"mri":"Fred_Waters.528798.Sandbox@Contact.whispir.com",

"mobile":"+1000000000",

"email":"me@example.com",

"voice":"+1000000000"

},

"responseMessage":{

"channel":"SMS",

"acknowledged":"09/01/16 13:22",

"content":"Yes, I accept. Will I need to bring steel cap boots?"

}

}

{{codeEnd}}