[Solved] Use twillio API to send SMS messages

Hi,

we’ve been asked on how to connect to twillio platform, in particular to send SMS from IntuiFace Experiences.

We made some test with twillio API, and good news ! It works well with IntuiFace :tada:.

First thing to look at is their documentation. It’s pretty clear and straight forward.

You can copy the curl command they provide in API Explorer :

curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID/Messages.json' \ --data-urlencode 'To=+TO_NUMBER' \ --data-urlencode 'From=+FROM_NUMBER' \ --data-urlencode 'Body=YOUR_MESSAGE' \  -u YOUR_ACCOUNT_SID: YOUR AUTH TOKEN

You’ll need to replace following parameters with you own information :

Once everything is set-up you’ll just have to send the request and check you phone :calling:

Alban

6 Likes

You must be a mind reader Alban because this is what i was testing :D.

Louie

Note for our french users, we also successfully sent SMS using SMSenvoi.

You can check their documentation here and paste the following request in API Explorer

http://www.smsenvoi.com/getapi/sendsms/?email=EMAIL_ACCOUNT&apikey=API_KEY&message[type]=sms&message[subtype]=PREMIUM&message[senderlabel]=Expediteur&message[recipients]=PHONE_NUMBER&message[content]=MESSAGE

As for Twillio, you’ll need to replace all uppercase fields with your own information.

Seb

1 Like

I actually have this as a custom asset in my experiences. Can I sell this in the marketplace?

Richard

Hi @richardkollen,

You can publish an experience on the Marketplace that would illustrate the custom asset you created, for sure!

This is pretty amazing… I am trying to add this to an experience that I have debuting this weekend. Would anyone of you guys be able to help me get this running? I’ve been playing around with it, and I have not been able to get the authentication to work.

Any help would be appreciated!

Thanks

Shawn

Hi Shaun,

I think there was a typo in the first message of this thread. The correct curl command would be

curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID/Messages.json' \ --data-urlencode 'To=+TO_NUMBER' \ --data-urlencode 'From=+FROM_NUMBER' \ --data-urlencode 'Body=YOUR_MESSAGE' \ -u YOUR_ACCOUNT_SID:YOUR_AUTH_TOKEN

It seems that another option is to use api keys as documented here: API Key Resource | Twilio

Hope this helps

Seb

Thanks for the reply Seb. I’ve been playing around with it and figured out that syntax… I still can’t get it to stop giving me a 401 error.

This is the command that I am pasting into the Request URL field of the API Explorer (I don’t mind that you see my tokens… it’s just a test twilio at this point)

[EDIT: PRIVATE INFO]

those are the correct live creds. Any idea what might be up?

Let’s avoid sharing your private credentials in a public comment :slight_smile: I edited your message.
I’ll try to do some tests on that topic and come back to you before the end of the day.

I sent the “answer” to Shawn in pm since it contains his credentials, but for others, here is the info:

I just started from the curl I provided in the thread then replaced the parameters with yours.
I used Basic Authentication Header Generator to generate the bearer token for the basic auth field.

Does anyone know if this works with sending images via SMS? Considering setting it up for a selfie station program to send users their photos.

Hi @scott,

I recommend you to check:

The combination of these 2 articles should give you the info to test it on your side.

Seb

Something that drove me a little batty for about 30 minutes is trying to figure out why my Basic Auth token didn’t work. Make sure you use the ACCOUNT SID as the username and the AUTH TOKEN from your Twilio Dashboard as the password when generating your Authorization token. There was also either a typo or a link change in Seb’s posting for the Basic authentication header generator. It should be https://www.blitter.se/utils/basic-authentication-header-generator/

2 Likes

Thanks for the note, typo fixed :wink:

2 Likes