logo
In-app Chat
SDK Error Codes
On this page

Implementing Offline Push Notifications with the ZIM SDK

2026-04-02

ZIM supports using offline push notifications when sending one-on-one messages, group messages, or initiating call invitations.

Note

Before implementing offline push, please ensure that:

Implementation Process

Scenario 1: Using offline push when sending "one-on-one" or "group" messages

  1. First, use the ZIMPushConfig object to configure offline push title, content, and other custom attributes.

  2. Then, set the pushConfig parameter of ZIMMessageSendConfig to include your offline push configuration.

  3. The sender calls sendMessage, passing in "sentConfig", to send a one-on-one or group message.

  4. If the recipient or any group member is offline, they will receive the offline message once they come online.

const pushConfig: ZIMPushConfig = {
    title: "Offline push title",
    content: "Offline push content",
    payload: "Custom payload, optional", 
    resourcesID: "Resource ID, optional",
}

const sendConfig: ZIMMessageSendConfig = {
    priority: 2,
    pushConfig: pushConfig
};

const toUserID = '';
const messageTextObj: ZIMMessage = { type: 1, message: 'Message content' };
zim.sendMessage(messageTextObj, toUserID, 0, sendConfig)
    .then((res: ZIMMessageSentResult) => {
        // Success
    })
    .catch((err: ZIMError) => {
        // Failed
    });

Scenario 2: Using offline push when sending call invitations

  1. Use the ZIMPushConfig object to configure offline push title, content, and other custom attributes.

  2. Add the push config to the pushConfig property of the ZIMCallInviteConfig object.

  3. The sender calls callInvite, passing in "callInviteConfig", to send an invitation.

  4. Invited users who are offline will receive the corresponding offline push notification. When coming back online, if the call invitation has not ended yet, they will receive the callback of callInvitationReceived.

const pushConfig: ZIMPushConfig = {
    title: "Offline push title",
    content: "Offline push content",
    payload: "Custom payload, optional",
    resourcesID: "Resource ID, optional",
}

const callInviteConfig: ZIMCallInviteConfig = {
    mode: 0,
    timeout: 90,
    extendedData: '',
    pushConfig: pushConfig
}

const invitees = ['xxxx'];  // List of invited user IDs
zim.callInvite(invitees, callInviteConfig)
    .then((res: ZIMCallInvitationSentResult) => {
        const callID = res.callID;
        // Success
        // The callID is a unique ID assigned by the SDK for the call invitation. This callID will be used in subsequent events.
    })
    .catch((err: ZIMError) => {
        // Failed
    })

Scenario 3: iOS Notification Grouping

To achieve notification grouping for iOS offline push, set the threadID property of ZIMPushConfig on the sending side.

const pushConfig: ZIMPushConfig = {
    title: "Offline push title",
    content: "Offline push content",
    threadID: "Group identifier",
}

Scenario 4: iOS Badge Count

You can update the notification badge count by calling updateUserBadge.

A common scenario: When logged in on multiple devices, if one device clears the unread count for a conversation, the badge on the iOS app should also be decreased accordingly. For example, if the badge count was 10, and you cleared 8 unread messages in one conversation, call this interface to set the badge count to 2.

zim.updateUserBadge(2)
    .then(() => {
        // Success
    })
    .catch((err: ZIMError) => {
        // Failed
    });
2026-04-02

Previous

Customize notification sound

Next

Customize notification click redirection