Configure a Twilio Messenger
On this page
1.26.0
This page explains how to connect your FusionAuth instance to Twilio messenger to send text and voice messages.
To create a new Twilio messenger, navigate to Settings -> Messengers . Click Add Twilio Messenger from the dropdown in the upper right.
Add Twilio Messenger#
IdWhen you leave this field blank, FusionAuth generates a UUID.
NameThe name of the messenger. You can have multiple Twilio messengers with different accounts. FusionAuth uses the name for display only.
Message typesThe set of message types this messenger can send. Supported values are SMS and Voice.
URLThe fully qualified URL of the Twilio API endpoint that accepts requests from FusionAuth. Twilio provides the URL.
Account SIDThe Twilio Account SID that FusionAuth uses to connect to the Twilio API. Find the Account SID in your Twilio dashboard.
Auth tokenThe Twilio Auth Token that FusionAuth uses to connect to the Twilio API. Find the Auth Token in your Twilio dashboard.
From phone numberThe Twilio phone number that FusionAuth sends messages from. FusionAuth requires this field when Message types includes Voice. For SMS, set this field or Messaging service Id.
Messaging service IdThe Id of a Twilio Messaging Service. Find the Messaging Service SID in your Twilio dashboard. When you set this field, FusionAuth sends SMS messages through the Messaging Service instead of from From phone number. Voice messages always use From phone number.
Enable debug loggingWhen you enable this option, FusionAuth creates a Debug Event Log for each message this messenger sends. To view the logs, use the Event Log API or navigate to System -> Event Log in the Admin UI.
Send SMS in Countries With Sender Requirements#
Some countries require SMS messages to come from a registered sender, such as a short code or an alphanumeric sender Id. A single From phone number can't meet the rules of every country. Use a Twilio Messaging Service instead. Twilio picks a sender from the Messaging Service's sender pool based on the country code of the recipient's phone number.
To send SMS through a Messaging Service:
- In Twilio, create a Messaging Service.
- Add the senders each destination country requires to the Messaging Service's sender pool.
- In FusionAuth, set Messaging service Id to the Messaging Service SID.
For more information about sender pools and sender selection, see Messaging Services in the Twilio docs.
Voice messages don't use the Messaging Service. FusionAuth places every voice call from From phone number. When you send voice messages to several countries, make sure From phone number meets the rules of each country.
When a user opts out of messages from a sender, such as by replying STOP to an SMS message, the messaging provider can block every later message from that sender, including MFA codes. Send MFA codes from a different sender than other messages, such as marketing messages. Depending on the provider, a separate sender is a separate phone number, messaging service, or account.
Testing Your Configuration#
You also can test your Twilio messenger configuration. Click Send test message to fire a test text message (or voice message, if text messaging is not enabled) to your Messenger.
Related
API documentation for the FusionAuth Complete Multi-Factor Authentication API.
Learn about the APIs for creating, retrieving, and updating Twilio Messengers.
API documentation for the FusionAuth Disable Multi-Factor API.
API documentation for the FusionAuth Enable Multi-Factor API.