Chat / JavaScript
Chat JavaScript v4
Chat JavaScript
This is the new Docs for Chat SDK v4 for JavaScript. To see the previous Docs, click here.

Push notification translation

Push notification translation allows your users to receive notification messages in their preferred languages. Users can set up to four preferred languages. If messages are sent in one of those languages, the notification messages won’t be translated. If messages are sent in a language other than the preferred languages, the notification messages will be translated into the user's first preferred language. In addition, the messages translated into other preferred languages will be provided in the sendbird property of a notification message payload.

Note: A specific user's preferred languages can be set with our Platform API's update a user action.

The current user's preferred languages can be set using the updateCurrentUserInfoWithPreferredLanguages() method as follows.

const sb = SendBird.getInstance();
const preferredLanguages = ['fr', 'de', 'es', 'ko'];        // French, German, Spanish, and Korean


try {
    let isUpdatedSuccessfully = true;
    for (let language of sb.currentUser.preferredLanguages) {   // The sb.currentUser.preferredLanguages returns a list of the current user's preferred languages.
        if (!preferredLanguages.includes(language)) {
            isUpdatedSuccessfully = false;

    if (isUpdatedSuccessfully) {
        // The current user's preferred languages have been updated successfully.
} catch (error) {
    // Handle error.

If successful, the following notification message payload will be delivered to the current user's device.

    "message": {
        "token": "ad3nNwPe3H0:ZI3k_HHwgRpoDKCIZvvRMExUdFQ3P1...",
        "notification": {
            "title": "Greeting!",
            "body": "Bonjour comment allez vous"    // A notification message is translated into the first language listed in the preferred languages.
    "sendbird": {
        "category": "messaging:offline_notification",
        "type": "User",
        "message": "Hello, how are you?",
        // ...

        "translations": {   // The translated messages in other preferred languages.
            "fr": "Bonjour comment allez vous",
            "de": "Hallo wie geht es dir",
            "es": "Hola como estas",
            "kr": "안녕하십니까?"