How to use IFTTT and Plivo to automatically send sms?

358 views Asked by At

I want to make a recipe on IFTTT that sends an SMS via Plivo when there is a missed call on my Android phone.

So I chose my Android phone as a trigger and tried using a webhook to POST it to Plivo. But it's not working.

Here is what I put in the recipe:

URL: https://api.plivo.com/v1/Account/MYPLIVOAUTHID/Message/

Method: POST

Content-Type: application/json

Body: {'src': 'SourceNumber', 'dst': '{{FromNumber}}', 'text': 'Sorry I missed your call'}

FromNumber is derived from the Android phone (the number from which the call was missed)

Error: Applet failed: there was a problem with webhooks service. Action skipped.

The Plivo API uses Basic Auth, and I don't know how to put the accesstoken/pw in IFTTT webhook.

I can't use IFTTT's sms as I dont live in the US/Canada and will go way above its limits. Also can't use Android's sms as there is 100/day limit in my country(India).

Thanks in advance.

1

There are 1 answers

0
Sreyantha Chary On

You can add an Authorization header to include your Basic Auth credentials. You can read more about it here: https://en.wikipedia.org/wiki/Basic_access_authentication#Client_side

To generate the header, just open up the JS console and use this:

username = 'username'
password = 'password'

'Authorization: Basic ' + btoa(username + ':' + password);

Which gives you the header: Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Alternatively you can try accessing the URL as auth_id:auth_token@https://api.plivo.com/v1/Account/auth_id/Message/