SMS notifications

When a user has been offline for a while, they can receive SMS notifications for messages that they missed. You can modify the SMS notification that TalkJS sends directly from the Notifications page on your dashboard, in the 'SMS settings' section.

Enable SMS notifications

To enable SMS notifications for a user, make sure that the user has at least one phone number on record. Any user with a phone number automatically starts receiving SMS notifications as soon as they have been offline for a while.

A user's phone number should be in full international format and start with a +. To remove all phone numbers for a user, set their phone number field to null. Users can have more than one phone number. TalkJS notifies all phone numbers on record.

In SMS notifications you can also link back to your app in several ways.

Some carriers automatically reject SMS messages that include links. If you include links in your SMS notifications, check that your messages are arriving successfully. If you have any delivery issues, try removing all links from your SMS notification message.

Example phone field using the JS SDK

1const me = new Talk.User({
2 ...
3 // Setting a single number
4 phone: "+12025550173",
5
6 // Setting multiple numbers at once
7 phone: ["+12025550173", "+905209876543"],
8
9 // Removing all numbers on record
10 phone: null
11});

The behavior is same with the REST API.

Turn off SMS notifications

To turn off SMS notifications for a user, you can remove the user's phone numbers. You can also mute notifications for a particular conversation via the REST API, in which case your user won't receive any notifications for that conversation, including SMS notifications.

SMS pricing and maximum segment length

SMS notifications are charged per segment, or message part. You can set the maximum number of segments in which a single notification message can be sent on the Notifications page of your TalkJS dashboard.

With standard SMS encoding, a message can have a maximum of 160 characters. Longer messages are split up in multiple parts, called 'segments', which are automatically merged on the phone upon receipt.

If a user's message includes Unicode characters, which is common for languages such as Arabic, Chinese, Hindi, Japanese, Korean, Turkish, or Cyrillic alphabet languages, then UCS-2 encoding is used instead. With UCS-2 encoding, a message can have a maximum of 70 characters. TalkJS automatically doubles the maximum segment length if a user sends a message with special characters that needs UCS-2 encoding.

Enable opting out of receiving SMS messages via reply

Users in the United States and Canada can opt out of receiving SMS notifications by replying to the message with any of the following:

  • ARRET (French)
  • CANCEL
  • END
  • OPT-OUT
  • OPTOUT
  • QUIT
  • REMOVE
  • STOP
  • TD

Once the user replies with one of the opt-out keywords, the phone number they replied from won't receive any SMS notifications from TalkJS. If the user has more than one phone number, the other phone numbers will continue to receive SMS notifications.

To enable opting out via reply for users in the US or Canada, select the 'Enable an opt-out via reply text for supported regions' on the Notifications page of your dashboard.

You can add customizable help text to the end of your SMS notifications, to alert users in the US and Canada to the possibility to opt out via a reply message.