fmSMS Webhooks using Otto

Otto from Proof+Geist can be used to receive incoming messages from your SMS Gateway. You will need to make a few small modifications to your copy of fmSMS - we've added support for Otto webhooks in v4.3 of fmSMS. 

If you're using an earlier version of fmSMS the required changes are outlined on the Otto website here and include creating a new layout, 2 new fields and 1 new script. You can copy/paste the OttoReceiver script from the v4.3 file to your file. Your new OttoReceiver layout (based on the Replies table) should look like this:

In the following example we will show you how to create an Otto webhook to receive incoming SMS messages from the Twilio SMS Gateway (similar to the dedicatedNumberReply.php file). 

Once you've made the necessary changes you need to create a new Otto Data API key by following the instructions here. We recommend using the supplied OttoDeveloperAPI.fmp12 FileMaker file to create the key which only takes a few minutes. When creating the Data API Key you can use the same FileMaker account that the dedicatedNumberReply.php file uses here as it has the required access privileges for receiving incoming webhooks via the Data API:

Once you've generated the Data API Key for the fmSMS file you can make a note of the URL for the SMS Gateway webhook. We are using the query parameter option to handle the authentication. The webhook URL should look something like this:

https://otto-server-url:3030/receiver/fmSMS.fmp12/fmSMS?apiKey=<your-api-key>

You now need to enter the Otto webhook URL in your SMS Gateway account. The process for this will be different for each SMS Gateway - you can get more information for your SMS Gateway on the SMS Gateways page. For the Twilio SMS Gateway that we are using in this example you will need to login to your Twilio account and click on Phone Numbers in the side navigation then click on the Twilio Number you wish to enter the Otto webhook for. Under Messaging select the Configure with Webhooks/TwiML option then select A Message Comes in “Webhook” and enter the Otto webhook URL in the adjacent field and click Save. It should look similar to this screenshot:

You now need to test the webhook by sending a message from your phone to your Twilio number to simulate an incoming SMS message - it should create a new record on the OttoReceiver layout and populate the Payload field with the content of the incoming message and then populate the appropriate fields with the data from the payload. If you look at the same record on the Replies Form layout you should see the the new record with the appropriate data in the Sender, Destination, Reply Body fields etc.

As the OttoReceiver script in v4.3 of the fmSMS file is designed to process incoming messages from the Twilio SMS Gateway you will need to modify the following highlighted steps of the OttoReceiver script to process incoming messages from other supported SMS Gateways:

If you will be receiving incoming messages from more than one SMS Gateway we recommend creating Otto webhooks for each SMS Gateway and setting the Channel value in the webhook URL to the name of the SMS Gateway. You can then branch in the OttoReceiver script for each SMS Gateway by referencing the value in the Channel field.

Still need help? Contact Us Contact Us