SMS Notification

Learn how to send SMS notification for unread messages.

About the extension

The SMS Notification extension helps you send SMS to your users when they have unread text messages.

After you've configured the extension, your users will receive SMS for unread messages in one-on-one conversations.

❗️

Required: Read Receipts

Be sure to implement read receipts so that your users receive SMS notifications for only unread messages.

Create a new App on Twilio

We have partnered with Twilio for sending SMS Notifications. You need to set up an account on Twilio before you start using the extension.

  1. Once you log in to Twilio, create a new app.
  2. Note down the Account SID, Auth Token.
  3. Click on "Get a Trial number" to get the Sender number.
  4. Note down the above details as these will be required in the next steps.

Extension settings

  1. Login to the CometChat Dashboard.
  2. Select your app and navigate to the Extensions section.
  3. Add the SMS Notification extension.
  4. Go to the Installed tab and open the Settings for this extension.
  5. You need to save the following Settings. These have been acquired in the previous step.

Configure your backend to store phone number

You can use our Update user API to set private metadata for a user. We recommend adding this code where you call our Create user API.

Alternatively, just for the sake of testing purposes, you can add this from the CometChat Pro Dashboard as well.

  1. Login to the CometChat Dashboard.
  2. Select your app and go to the "Users" section.
  3. Select any user of your choice and select the "Profile" tab.
  4. Paste the below JSON in the Metadata input box and hit Save.

The Metadata is a JSON that should have the @private key present and should have the value contactNumber specified for the user. The format for the private metadata must be as follows:

{
  "@private":
  {
    "contactNumber":"12345678910"
  }
}

Receive SMS Notification

Send a message to an offline user and watch them receive an SMS!


Did this page help you?