AnsweredAssumed Answered

Can I run a script after a new record has been created via a twilio service?

Question asked by elmerwade on Aug 7, 2018
Latest reply on Aug 15, 2018 by mdenyse

I have a FM database (on Filemaker cloud 17)  integrated with a twilio to sent and receive sms messages. I can send texts no problem to twilio and I receive texts by manually running a script which uses the Insert from URL [Select;With dialog:off;$json_result;$_url;cURL options:$_curl_options] command.  Also, for testing purposes I am using the postman tool to POST and GET records and everything is working fine using DATA API.

 

After retrieving the sms messages, then another  script automatically processes each texts and classifies them according to our needs.

 

My problem is that I would like to go an extra step whereby when a new SMS text comes in to my twilio number, a new record will automatically be created in my FM database then followed up by automatically running a script that processes the line items and takes appropriate actions based on the text contents. This would greatly improve our workflow. I know I could just run my a server-side script on FMS that looks for new sms messages every few minutes but that really seems like overkill.

 

Does anyone know if it's possible to define a proper API call(or some other language)  from twilio and then trigger the script after the API call? Just to be clear this script is more complicated then the script commands allowed using Postman testing .

  1. i.e.

https://xxxxxxx.filemaker-cloud.com/fmi/data/v1/databases/xxxxxxxxxxxxx%206/layouts/xxxx%20from/records

  "fieldData": {

      "body": "Yessiry",

      "direction": "inbound",

      "to":"+1xxxxxxxx",

     "from":"+1xxxxxxxx",

     "date_sent":"Sun, 06 Aug 2018 02:57:14 +0000",

     "status":"received",

"sid":"SMf1f6d9ab608xxxx"

    },

    "script": "NewScript"

}

 

Screen Shot 2018-08-07 at 3.58.53 PM.png

  1. Thanks.

Outcomes