Recent searches


No recent searches

Zendesk iOS Mobile SDK Push notifications not working



Posted Jan 08, 2025

Hi there.

When we respond to tickets submitted via the mobile SDK, users receive our replies; however, they do not receive push notifications about these responses.

 

We use iOS Mobile SDK version 8.0.2 

There are no any errors

 

Also, here is the code of SDK initialisation:

    private func `default`(customFields: [CustomField], customTags: [String] = []) -> UIViewController {
        setupZendesk(with: store.state)

        let requestConfig = RequestUiConfiguration()

        requestConfig.tags = makeDefaultTags() + customTags

        let deviceId = store.state.device.device?.id.rawValue ?? -1
        requestConfig.customFields = [
            CustomField(fieldId: CustomFieldId.deviceId, value: deviceId),
        ] + customFields

        let helpCenterUiConfig = HelpCenterUiConfiguration()

        let vc = HelpCenterUi.buildHelpCenterOverviewUi(withConfigs: [helpCenterUiConfig, requestConfig])

        let navigation = UINavigationController(rootViewController: vc)
        navigation.modalPresentationStyle = .fullScreen
        return navigation
    }

    private func setupZendesk(with state: Core.AppState) {
        guard let email = state.auth.email ?? state.support.email else {
            return
        }
        let username = state.user.properties?.name ?? ""
        let ident = Identity.createAnonymous(name: username, email: email)
        Zendesk.instance?.setIdentity(ident)

        guard let token = state.pushNotifications.token, let zendeskInstance = Zendesk.instance else { return }
        // PushProvider register method should be called with valid identity
        ZDKPushProvider(zendesk: zendeskInstance).register(
            deviceIdentifier: token.string,
            locale: state.localization.languageCode.rawValue
        ) { _, error in
            guard let error else { return }
            LogEventDataLoggerLocator.shared.log(
                LogEventData(
                    name: "Zendesk setup error",
                    category: .zendesk,
                    level: .error(.low),
                    message: "Zendesk couldn't register device",
                    error: error as NSError,
                    userInfo: [
                        .eventErrorDescription: .string(error.localizedDescription),
                        .eventErrorCode: .integer((error as NSError).code),
                    ]
                )
            )
            logDebug("Zendesk: Couldn't register device. Error: \(error)", category: .zendesk)
        }
    }

After investigation, I didn’t find any issues with the backend service that sends push notifications. Sending a push directly using the device’s Push Token works properly, and notifications are delivered on both Android and iOS.

 

Moreover, in the case of iOS, it seems that Zendesk webhooks are not reaching the backend at all. This suggests a potential issue either on Zendesk’s side or in our integration with Zendesk.

 

Some webhooks for iOS devices do reach us, but they contain invalid request bodies, such as:

 

{
    "devices": [
        {
            "identifier": "identifier_example",
            "type": "ios"
        }
    ],
    "notification": {
        "body": null,
        "title": null,
        "ticket_id": null
    }
}

 


0

0

0 comments

Please sign in to leave a comment.

Didn't find what you're looking for?

New post