EspoCRM has the built-in functionality for sending SMS, but it's not shipped with any provider implementation. The official SMS Providers extension includes implementations for the following SMS providers:
It's possible to send SMS from formula-script or from PHP code out-of-the-box. The VoIP Integration provides the ability to send SMS through the UI (only for the Twilio provider).
In this article:
Download the extension package from the GitHub repository (under the Assets section). Then upload and install the package in Espo at Administration > Extensions.
After the SMS Providers extension is installed, go to Administration > SMS and select the SMS Provider you want to use from the drop-down list. Also, in the SMS From Number field, enter the number with the country code (e.g. +11111111111) from which you will be sending SMS messages.
Next, go to Administration > Integrations, select your provider, and set up needed credentials and parameters.
Sending with formula¶
It's possible to send SMS from a formula-script with the ext\sms\send function.
Requires Advanced Pack.
With the Workflow tool it's possible to set up Espo to SMS notification on a specific condition.
Create a Workflow rule with the needed trigger type and conditions. Add the Execute Formula Script action and paste the following formula-script:
$body = 'Hi! This is an SMS notification from EspoCRM.'; // Phone number is obtained from the entity. $phoneNumber = phoneNumber; $smsId = record\create( 'Sms', 'to', $phoneNumber, 'body', $body ); ext\sms\send($smsId);
SMS 2FA is supported out-of-the-box, but you need to have an implementation for your SMS provider (SMS Providers extension).
Note that the Phone field of the user, for whom you want to set up the Two-Factor Authentication, must be filled in with at least one number.
- At Administration > Authentication, check the box Enable 2-Factor Authentication. Add the SMS value in the field Available 2FA methods. Save changes.
- At Administration > Users, select the user for which the 2FA will be configured.
- On the detail view of the user, click on the Access button and check the box Enable 2-Factor Authentication. Also, choose SMS 2FA Method in the drop down list. Click the Apply button.
- Enter the Administrator password, select a phone number that will be used for 2FA in the Phone dropdown list, and click the Send Code button.
- Enter the code that will be sent to the selected phone number and click the Apply button.
VoIP integration for Twilio¶
The VoIP integration integration allows to send and receive SMS/MMS through UI.
To use Twilio Integration for receiving and making calls, SMS and MMS, first configure it according to these instructions.
At Administration > VoIP Routers > the phone number required for sending and receiving SMS, check the SMS and MMS boxes for those team users whom you need in the Team Users panel.
Also, you need to enable Twilio messaging geographic permissions:
- Login to your Twilio account.
- Navigate to Programmable SMS > Settings > Geo Permissions.
- Enable needed countries.
Do not forget to set Grant access to Messages for the required users.
Keep in mind that for the Twilio Trial account you will need to add a Verified Phone Numbers or Caller ID.
After that, you can proceed to the installation and configuration of the SMS Providers extension.