If a user has a configuration set and has at least one phone number, they will automatically start receiving SMS notifications when they are offline.

Content of the SMS messages sent by TalkJS are customizable in our Dashboard.

You can set multiple phone numbers for your users. In case of multiple numbers for a user, TalkJS will notify all phone numbers on record. All numbers should be in the international format and start with a +. If you like to remove all phone numbers for a user, you can set their phone number field to null.

(Note: theming is only available on TalkJS Standard plans and up. If you are not using Standard plan or up, you can still set phone numbers for your users but they won't recieve any SMS notifications.)

Example phone field using the JS SDK

var me = new Talk.User({
  // ...

  // Setting a single number
  phone: "+12025550173", 

  // Setting multiple numbers at once
  phone: ["+12025550173", "+905209876543"],

  // Removing all numbers on record
  phone: null,

  // ...
});

The behaviour is same with the REST API as well.

Disabling SMS Notifications

To disable SMS notifications for a user, you can remove their 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 SMSes.

A note about SMS pricing & segmentation

SMS notifications are charged per segment. You can limit how many segments a single notification message could be in the Dashboard. Before setting the limit, it's important to understand what SMS segments are.

With the standard SMS encoding, you can only have 140 bytes in a message. A character takes 7 bits to encode and 140 bytes x 8 bits in a byte divided 7 bits means we are limited to 160 characters per segment. This limit means long messages need to be send in multiple parts, or segments, and automatically merged on the phone when they are recieved. This process happens all the time you send or recieve a long message on your phone.

To be able to merge these segments into one message, each message needs to start with a special header called User Data Header (UDH). This brings down the maximum character limit to 153 for each segment. So if you have a message that's exactly 160 characters, it'll be send as one segment that's 160 characters. If your message is 161 characters, then the message is split into 2 segments, first with 153 characters and second with 8 characters.

This all assumed your messages don't include any unicode characters which are found in languages such as Hindi, Turkish, Arabic, Chinese, Korean, Japanese, or Cyrillic alphabet languages. When your messages include a special character that can't be encoded with GSM, 16-bit UCS-2 encoding is used instead. With UCS-2 encoding, a segment is limited to 70 characters. Longer messages encoded with UCS-2 are also split into segments of 67 characters, with the difference used for the UDH. Since 70 characters may not be enough for most cases, TalkJS automaticlly doubles the maximum segments you picked for messages with special characters.

You can learn more about message sizes and segmentation on Wikipedia.

Opting Out of Receiving SMS Messages via Reply

In the US and Canada, we support replying via SMS to stop receiving SMS notifications per regulations.

Your users can opt out from SMS notifications by replying to the message with any of the following:

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

Once they reply, the number they replied with won't receive any SMS notifications from TalkJS. If the user has more than one phone number, other numbers won't be affected.

In TalkJS Dashboard, we provide a way to easily add a customizable help text to the end of your messages for users in US and Canada.

Linking back to your app

Like email notifications, SMS notifications allow you to link back to your app in a variety of ways. Read how to set this up.