Setting Up and Using Twilio in PowerBase

This page documents how to setup PowerBase to use the Twilio SMS service. See our SMS page for more information on SMS in general.

Sign up for a Twilio Account

Go to the Twilio website and sign up for an account. You can create a trial account and test, but you will need to upgrade your account in order to send SMS messages properly.

Purchase a number.

Get your "Account SID" and "Auth Token"

In Twilio, go to the "Console Dashboard", then click the Settings link on the left. Then look for the "Live credentials" section.

Configure SMS Provider Settings in CiviCRM.

  • To reach the SMS provider settings page, navigate through the menus as follows: Administer » System Settings » SMS Providers
  • Click on "Add New Provider" button.
  • In the Manage SMS Provider Page, the providers that are enabled are available. If you don't see your provider, you may need to enable the twilio extension.
  • Choose Twilio.
  • Type some name for your SMS provider in the Title textbox. It can be anything.
  • The Username is the AccountSid (see above for how to find your AccountSId and Auth Token)
  • The Password is your AUTH token.
  • Select "http" for the API Type. The API Url is https://api.twilio.com/
  • Under API Parameters, you need to put in the phone number Twilio provides for your account, like this: From=12345678901 You need to include the prefix 1 in the "From" phone number. Also, it is case sensitive, so please put in "From", not “FROM”.

Twilio Configuration Screen on PowerBase

Configure Twilio to send responses back to your database

  • Log into your Twilio account
  • Click on the menu item called "Phone Numbers" (it is represented with the symbol: #)
  • Click on your phone number and you will have access to a bunch of settings.
    • The Messaging setting allows you to put in a URL which will get called whenever someone replies to an SMS that you have sent out.
    • Change "A message comes in" to display the option: Webhook
    • Enter: ​https://SITE.ourpowerbase.net/civicrm/sms/callback?provider=org.civicrm.sms.twilio replacing SITE with your site

Configure phone numbers in Powerbase to Phone Type of "Mobile"

In order to send SMS to a phone number, the contact's phone number's Phone Type must be set to "Mobile".
Twilio will try to send sms messages to land-lines, and will indicate those as "Undelivered". See the section below "Handling non-mobile phone numbers" for more information.

If you have a huge number of contacts you want to update to use the Phone Type of "Mobile" - for example this is the first time you are using Twilio and you want to send to everyone to determine which are mobile phones - reach out to support@progressivetech.org and we can help make the updates.

Handling non-mobile phone numbers

Twilio will accept a message for any number you give it, even landlines, and report that it recieved your request without an error.

Then, it tries to send the message. If you gave Twilio a landline or a dis-connected phone number that message will, obviously, not be delivered and, Twilio will still charge you for the delivery attempt. Furthermore, until you delete these bad numbers (or change them to landlines), Powerbase will continue trying to send messages to them.

Therefore, it's important that you log in to Twilio periodically to review the SMS outbound log and search for undelivered messages and upate Powerbase accordingly.

To search you SMS logs, go to the SMS logs section of your Twilio Dashboard (or click the "..." menu, then "Programmable Messaging," then "logs").

Then, from the "All statuses" drop down, select "Undelivered" (Note: You are not charged for "Failed" messages, only undelivered ones) and then click "Filter."

We suggest that for those phones which received the status of "Undelivered" that you update those phone numbers in Powerbase to use the Phone Type of "PHONE", so you don't send a future SMS by accident. For phones that received the status of "Failed", it's best to delete the phone number in Powerbase.

Depending on how many results you have, you may be able to eye-ball a handful of phone numbers and update them by hand. If your list is huge, contact support and we'll help you properly code them to stop receiving text messages.

Category: 
PowerBase - General