SMS forwarding to a Webhook

Configure SMS to Web URL:

You can setup a web-hook to receive SMS to your web application. If configured to web-hook, all the messages will be forwarded to your web URL.

Select the phone number to configure SMS

In the POP Window, Check URL and type in the URL to handle SMS.

Click on Confirm to save the settings.

Here you can see, SMS if configured to web-hook. Now you can create your application to process all the incoming messages.

What information we send to your web-hook for all incoming messages.

We send the data in JSON format. For all incoming messages you will receive "From" "To" "Text" and "ReferenceID" and "deliveryReceipt", Here is sample data.

{"text":"Test","from":"1949XXX1234","to":["1949XXX4400"],"referenceid":"5f343f8-2e56-4458-b01a-e123551107e8","deliveryReceipt":false}

SampleCode to handle SMS in the configured in the about example. In this example, web application simple receive an SMS and forward to an email address.

//https://www.didforsale.com/apidemo/handlesms.php
      <?php
       $response = json_decode(file_get_contents('php://input'), r);
       $subject="You Received a SMS";
       $Message="Here is your message\n";
       $Message.="From =". $response['from']."\n";
       $Message.="To =". $response['to'][0]."\n";
       $Message.="Message =". $response['text']."\n";
       echo $Message ;
       // Type in valid email address ex: username@example.com
       mail("hidemail@domainname","$subject",$Message)
?>

Troubleshooting incoming SMS.

We get the SMS and forward to your web url. While doing the we store the response code we get from your application. To view that. Click on Reporting -> SMS.

You can view all incoming and outgoing messages here.

SMS CDR

Enter a caption for this image (optional)

Click on "received" to view the details.

SMS CDR Details

Enter a caption for this image (optional)

Here you can see all the details of the communication between your system and our system.

  • Destination: Where the messages was forwarded to.

  • Data: What information we sent to the web url.

  • Server Response: Response we received from your server.

    • PS: All we need is 200 OK. All the other information is stored and discarded, we don't do anything with the response data.

We would love to see what you build and will be happy to help you troubleshoot any issue. Contact us for any support issue.

Last updated