logo
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.

zim::ZIMPushConfig pushConfig;
pushConfig.title = "Offline push title";
pushConfig.content = "Offline push content";
pushConfig.payload = "Custom payload, optional";
pushConfig.resourcesID = "Resource ID, optional";

zim::ZIMMessageSendConfig sendConfig;
sendConfig.pushConfig = pushConfig;

zim::ZIMMessage* message = nullptr;
zim::ZIMTextMessage text_message;
text_message.message = "message";
message = &text_message;

zim::ZIMConversationType type = zim::ZIMConversationType::ZIM_CONVERSATION_TYPE_PEER;
auto notification = std::make_shared<zim::ZIMMessageSendNotification>(
            [=](const std::shared_ptr<zim::ZIMMessage> &message) { int i = 0; });
// For single chat, toConversationID is the target user's userID; for group chat, it's the groupID.
zim_->sendMessage(message, "toConversationID", type, sendConfig, notification,
                    [=](const std::shared_ptr<zim::ZIMMessage> &message,
                              const zim::ZIMError &errorInfo) { int i = 0; });

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 onCallInvitationReceived.

zim::ZIMPushConfig pushConfig;
pushConfig.title = "Offline push title";
pushConfig.content = "Offline push content";
pushConfig.payload = "Custom payload, optional";
pushConfig.resourcesID = "Resource ID, optional";

zim::ZIMCallInviteConfig callInviteConfig;
callInviteConfig.pushConfig = pushConfig;

zim_->callInvite(invitees, callInviteConfig, [=](std::string callID, zim::ZIMCallInvitationSentInfo info, zim::ZIMError errorInfo) {}); 

Scenario 3: iOS Notification Grouping

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

zim::ZIMPushConfig pushConfig;
pushConfig.title = "Offline push title";
pushConfig.content = "Offline push content";
pushConfig.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, [=](zim::ZIMError errorInfo) {}); 
2026-04-02

Previous

Set custom push rules

Next

ZIM