Configure a Twilio Messenger

On this page
Available since 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#

Id
  • Optional

When you leave this field blank, FusionAuth generates a UUID.

Name
  • Required

The name of the messenger. You can have multiple Twilio messengers with different accounts. FusionAuth uses the name for display only.

Message types
  • Required
  • Available since 1.65.0

The set of message types this messenger can send. Supported values are SMS and Voice.

URL
  • Required

The fully qualified URL of the Twilio API endpoint that accepts requests from FusionAuth. Twilio provides the URL.

Account SID
  • Required

The Twilio Account SID that FusionAuth uses to connect to the Twilio API. Find the Account SID in your Twilio dashboard.

Auth token
  • Required

The Twilio Auth Token that FusionAuth uses to connect to the Twilio API. Find the Auth Token in your Twilio dashboard.

From phone number
  • Optional

The 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 Id
  • Optional

The 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 logging
  • Optional

When 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:

  1. In Twilio, create a Messaging Service.
  2. Add the senders each destination country requires to the Messaging Service's sender pool.
  3. 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.

Use a separate sender for MFA

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.