Forum Academy Marketplace Showcase Pricing Features

Twilio and API Connector

So true, Twilio doc is terrible

2 Likes

Hi,

I am trying to use the Plivo API, but I have a problem with my credentials.

I think it is coming from the Authorization header and I wonder: am I using the right structure (Basic “ID”:“token”)? It seems to be the usual way to fill a HTTP Authorization header.

Yes, but what I think you will need to do is convert authid:authtoken into base64 and pass that in the form … Basic xxxxxxxxx

Google base64 converter

See example above.

1 Like

So…

Go here …

enter … authid:authtoken (so a : between them)…and encode …

In Bubble …

APi = https://api.plivo.com/v1/Account/MAZDJHMDUWYJCYYZNIND/Message/ (or whatever you api id is)

Header …

Authorization and the long string you got above…
Content-Type application/json

{

“src”: “+447973253456”,
“dst”: “+447973256543”,
“text”: “Friday yay”
}

You can then insert dynamic data into the body in an action …

2 Likes

Thanks a lot! The problem is now resolved.

2 Likes

Can the Plivo api also trigger a bubble workflow in realtime when an incoming message is received in Plivo number ?
I was thinking of using zapier with Twilio but it only checks for messages every 5 minutes.

I think unless Plivo (or Twillio) allow you specify webhooks, then you might need to look at another API-API connector other than Zapier.

Did anyone ever get Twilio working? I have the same From issue as @cho did. If not I will look into Plivo.

Trying to get away from Zapier/Blockspring.

Never made it work. Seriously Twilio is a waste of time.
You’ll be able to setup Plivo in about 4 minutes, very simple.

1 Like

Ok. I’ll give it a go. Thank you.

1 Like

I got twilio working send (via blockspring) & receive… sorry havent got a chance to share the widget yet. Will do it this weekend !

Thats cool, but I’m trying to get away from Blockspring.

Privo is already working though. Lol

1 Like

Yes, I got Twilio to work eventually, but it isn’t pretty. Sadly Plivo can’t seem to get their Zapier integration to work (or they just lie about it on Twitter) and I use Zapier/Twilio for things outside Bubble.

So…

Grab your Account SID and Auth Token and head to …

http://www.motobit.com/util/base64-decoder-encoder.asp

Copy and paste the AccountSID:AuthToken -so basically glue the two together with a “:” …something like …

AC8275544a326ce444869ef49e938031fa:2669262f868b2342c944bec049d0e370

Encode it, and copy the resulting string… something like …

QUM4Mjc1NTFiYTMyNmREZTY0ODY5ZWY0OWU5MzgwwzFmYToyNjY5M44yZjg2OGIyMzQyYzkwYmJl
YzA0OWQwZTM3MA==

In the API Connector …

https://api.twilio.com/2010-04-01/Accounts/AC8275544a326ce444869ef49e938031fa/Messages.json (where that string is your Account SID)

Sent up two Headers…

Content-Type = application/x-www-form-urlencoded
Authorization = Basic QUM4Mjc1NTFiYTMyNmREZTY0ODY5ZWY0OWU5MzgwwzFmYToyNjY5M44yZjg2OGIyMzQyYzkwYmJl
YzA0OWQwZTM3MA==

Ignore Parameters, I couldn’t get them to work, no idea if Twillio or Bubble issue.

In Body …

&From=441644344044&To=447974459344&Body=Hi there etc etc

44 in this case is the UK international code.

5 Likes

You’re a lifesaver. I already had a Twilio account with money in it and didn’t want to use another account.

For anyone wanting to using programmable voice calls use @NigelG 's post, but change the following:

API Connector: https://api.twilio.com/2010-04-01/Accounts/Account#/Calls.json
Body: &From=+441644344044&To=+441644344044&Url=http://demo.twilio.com/docs/voice.xml

I might use Zapier for now for voice since I don’t feel like setting up a Twilio app to pass data and generate XML. Didn’t see anything about passing a variable directly into the API POST. Not bad considering the Twilio Call Zap is instant.

1 Like

Easy to use! thx!

@nomadkelley Hey I need to set up a conference call between 2 phones and have my bubble app call each number at a scheduled time and put them into the conference call. Do you know if this is possible with Plivo?

You might need to have a standard web server + bubble for it to work.

Got it. Thanks. You don’t think I can use bubble as the server?

Not that I know of.

Searching “Twilio API” in the forum like me? Updating this old thread to save frustration and searching time… couldn’t find many current or solved questions on the Twilio API so this thread seemed most relevant to append.

Can now send “dynamic” text messages from Bubble using Twilio without a plugin or Zapier, Blockspring, etc.

@NigelG’s authentication solution still applies. (Base64 encoded AccountSid:AuthToken string in header)

Picking up from:

“Parameters” now work, with a couple key details:

  1. This works with my US account sending to US numbers, don’t know about other countries.

  2. Set “Body type” as “Form-data”

  3. Must include a Parameter ‘To’ (Key) with corresponding (Value) that is the phone number that you are sending the text to. (no quotes, see screenshot)

  4. Must include a Parameter ‘From’ (Key) with corresponding (Value) that is your verified Twilio phone number that you are sending the text from.

  5. NEW INFORMATION: Phone number format (Value) now appears almost irrelevant as long as it contains 10 digits (re-emphasize point #1…). I sent texts using almost any format of the 10-digit phone number (Value), including +1xxxxxxxxxx, xxx-xxx-xxxx, (xxx) xxx-xxxx, or just xxxxxxxxxx! Inserting your phone number data as dynamic values in your workflow is now much simpler.

  6. NEW INFORMATION, THE TRICKY PART: To pass “other data” to Twilio (ie, a confirmation code, a custom/dynamic text body, data field or multiple fields), add a third Parameter ‘Parameters’ (Key) with corresponding (Value) in the format ‘{“key”:“value”, “key”:“value”, … }’ Curly braces { and full quotes " " are required like standard JSON (see screenshot)

So the Twilio API accepts only 3 parameters in a body type of Form-data: the first two parameters are the required ‘To’ and ‘From’ phone numbers for the text/message and the third (optional) parameter, confusingly named ‘Parameters’, carries all the “other data” you need to send to Twilio for the text/message in one or a series of {“key”:“value”} pairs.

This post is meant to clear up unanswered questions on structuring the Twilio API in Bubble. Setting up the flow in Twilio is another topic but Twilio has adopted @emmanuel’s vision and now has a no-code backend too, making this very powerful and easy! Twilio Studio (Beta) It really can’t get much easier than this:

For example, to send a text “confirmation code” using Twilio, you need a basic input form in Bubble with two input fields where a user enters their name and cell number, and a “send” button. One single-step workflow calls the Twilio API, inserts dynamic data for the ‘To’ Parameter’s phone number Value and the “name” and “code” fields in the ‘Parameters’ Parameter. (“code” is just a 5-digit random string generated in Bubble). On the Twilio Studio side, all you have to do is insert your two data fields in the text message with pretty basic syntax {{flow.data.name}} for “name” and {{flow.data.code}} for the “code” you sent from Bubble. Of course, you could also create the exact text you want to send in Bubble and send it to Twilio as {“body”:“Hi Steve, your confirmation code is 12345”} and on the Twilio side simply {{flow.data.body}}. Very powerful and easy!

6 Likes