Twilio sms workflow

I am trying to set up a workflow to automatically send out a reminder sms the day before a date.
Because I am in Denmark, I needed my own Twilio account, which I have set up, and tried to correctly connect to the AppSheet app with my SID and Token.
The workflow fails every time, and no sms is ever sent.

I have not bought a phone number with Twilio, since according to them, I can send from an alphanumerical sender ID for free (which is not only cheaper, but also better in my opinion).

I have also not done anything in Twilio to tell it that I want to integrate with Appsheet, since I thought that the auth was all done at Appsheets end.

Any ideas to why this isn’t working?

@LeventK would know the answer, I bet.

Have you checked the Audit history details what that reason could be?

1 Like

I have checked the log, but there dosent seem to be any relevant information on there, it just says “Error”.

Se this screenshot:

Click the red binoculars icon for details.

1 Like

Ah, thanks!

I get this error:

“Errors”: “Error: Workflow rule ‘Påmindelse SMS’ field ‘SMSFrom’ contains invalid phone number ‘FiberLAN’. Error: No SMS was created because ‘From’ is missing or invalid.”

Does Appsheet not support the Twilio Alphanumerical sender ID?

Good question… never have thought about that. Let me check this from our expert.

That would be great, thank you

Having your own Twilio account means you need to have your own Twilio phone number as well supporting alphanumeric sender ID support.

And the expert is answered😋

1 Like

From what I can read at Twilios website, it just seems to me that you can (in some countries) send sms messages without needing to buy a phone number, by simply calling the API with a string of text instead of your Twilio phone number - have I misunderstood that, or is it just not supported by Appsheet?

They even have this suggestion for how you can work around making a universal API that reacts to weather or not the country supports alphanumeric sender ID:

We do not currently support sending an SMS message via Twilio using an Alphanumeric Sender ID.
We would consider implementing this feature if enough customers would use it.

In the interim, you could probably achieve this by implementing a webhook.

What you are misunderstanding or misevaluating is this:
The alphanumeric sender ID, is a friendly name given to any valid Twilio number. Twilio assigns or provides phone numbers to you as per your registering country. Not every registrar country are allowed to assign a friendly name to their twilio phone numbers. I have Twilio account too, however I’m not allowed to use a friendly name with my Twilio phone number. I believe you are totally mis-interpreting what you have read.

Besides; sending and receiving SMS messages from alphanumeric sender IDs totally relies on if the recipient number’s carrier allows it or not.

Provided you examine the first phyton (ruby) code that you have provided and the high-lighted code fragment; the assigned variable name is: twilio_phone_number where the alphanumeric sender ID “Phil” is assigned to valid Twilio phone number. When the code is executed, the Twilio API matches the sender ID with the Twilio number assigned and sends the SMS message. The second phyton code is for debugging/error trapping reasons only eliminating the error code and continue executing the code provided the recipient carrier does not accept SMS messages from alphanumeric sender IDs and send it thru subscriber’s real Twilio number.

Provided you wish to send SMS messages with an alphanumeric sender ID which will appear as Frederik instead of +1-XXX-XXX-XX-XX:

1.) You can create a standalone Google Apps Script project with doPost(e)
2.) Construct the proper Google Apps Script code to make a HTTP POST call to Twilio API
3.) Deploy the project as a web-app executable
4.) Create a Webhook Workflow within AppSheet and use the aforementioned webapp’s URL as a webhook endpoint and construct a valid JSON body for your process

When the AppSheet workflow rule is triggered by your set criteria, it will call this webhook endpoint, execute the code enclosed within the doPost(e) event, call the Twilio API, process your code and send the SMS message.

If you had set your Twilio number to receive replies and provided you want to read/receive/log the SMS replies back to your app, that’s totally another scenario where you need to set a second webapp, but with a doGet(e) event this time and create a TwiML to call this webapp everytime a reply is received to its bin, run the code and record the message body and other required param values to your gSheet. Here is the one that I use with one of my apps to log SMS replies back to the AppSheet app.

Hope I’m clear now. If not, I may recommend reading the Twilio API documenation very clearly.

Thank you very much for taking the time to explain it to me that thoroughly, it really helps :slight_smile:

You’re welcome @Frederik, but please remember that you need to purchase a Twilio number to use any feature needed.

Hello @LeventK
Please can you help me with this, i’m not familiar with Google Apps Script
Thank you