Skip to main content
Integration with Twilio API

How to set up and use Twilio API in playbooks

Updated yesterday

Important: The following instructions assume you some technical knowledge, and already have a verified Twilio account you can use for sending messages. For more information see: https://www.twilio.com/docs/messaging/onboarding

  1. Log in to you Twilio account, and go to the API Keys page.

  2. Copy aside your Account SID.

  3. Create a new API Key. If you use restricted keys, make sure you give it the permissions needed for the API you will use.

  4. Copy aside the Key SID and the Secret, and keep them safe.

  5. Click "Done".

  6. In Coho, create a new HTTP Action.

  7. Choose the right HTTP method and URL, depending on the type of action you want to do. For example, to send messages, choose POST as the method and this URL: https://api.twilio.com/2010-04-01/Accounts/<Account SID>/Messages.json

  8. In the payload, enter the appropriate URL Encoded properties, as described in the Twilio API reference. For example, for SMS messages, it should look like:

    Body=Hello&From=%2B14155552345&To=%2B14155552345
  9. To craft the Basic Authentication header, run the following command in your terminal:
    โ€‹echo -n '<Key SID>:<Secret>' | base64

  10. The output should be a Base64 encoded string, similar to bXlzaWQ6bXlzZWNyZXQ=. Add the following header to the action configuration:

    {
    "Authorization": "Basic bXlzaWQ6bXlzZWNyZXQ=",
    "Content-Type": "x-www-form-urlencoded"
    }
  11. You can now test the action and save it.

Did this answer your question?