Appearance
The installation and configuration of the Twilio service and channel is quite typical.
This page provides a quick start guide to setting up Twilio with SMS Framework and Notifier. The steps described here are largely applicable to most services.
Installation
From a project with a pre-installed version of Notifier and SMS, bring in the Twilio notifier dependency:
sh
composer require symfony/twilio-notifierConfiguration
In the site directory, usually sites/default/, create a services.yml file.
Add to settings.php:
php
$settings['container_yamls'][] = __DIR__ . '/services.yml';Add to services.yml:
yaml
parameters:
sms.transports:
mytransport: 'twilio://SID:TOKEN@default?from=FROM'Modify the DSN by replacing the SID and TOKEN and FROM parts with your Twilio ID, token, and from number respectively.
Then clear Drupal caches:
sh
drush crContinue at the Sending documentation to use the newly configured channel. Noting that the recipient you send to must be a valid SmsRecipientInterface.
Resources
For more information about the Twilio integration, go to the Twilio transport in the Symfony monorepo.
This documentation is not provided or endorsed by Twilio.