Push Notification

The Qiscus Chat SDK receives pushes through both the Qiscus Chat SDK protocol and Apple Push Notification Service (APNS), depending on usage and other conditions. Default notification sent by Qiscus Chat SDK protocol.To enable your application to receive apple push notifications, some setup must be performed in both application and the Qiscus Dashboard.

Do the following steps to setup push notifications:

  1. Create a Certificate Signing Request(CSR).
  2. Create a Push Notification SSL certificate in Apple Developer site.
  3. Export a p12 file and upload it to Qiscus Dashboard.
  4. Register a device token in Qiscus SDK and parse Qiscus APNS messages.

Step 1: Create a Certificate Signing Request (CSR)

Open Keychain Access on your Mac (Applications -> Utilities -> Keychain Access). SelectRequest a Certificate From a Certificate Authority.

In the Certificate Information window, do the following:

  • In the User Email Address field, enter your email address.
  • In the Common Name field, create a name for your private key (for example, John Doe Dev Key).
  • The CA Email Address field must be left empty.
  • In the Request is group, select the Saved to disk option.

Step 2: Create a Push Notification SSL Certificate in Apple Developer Site

Log in to the Apple Developer Member Center and find the Certificates, Identifiers & Profiles menu. Select App IDs, find your target application, and click the Edit button.

Turn on Push Notifications and create a development or production certificate to fit your purpose.

Upload the CSR file that you created in section (1) to complete this process. After doing so, download a SSL certificate. Double-click the file and register it to your login keychain.

Step 3: Export a p12 File and Upload it to Qiscus Dashboard

Under the Keychain Access, click the Certificates category from the left menu. Find the Push SSL certificate you just registered and right-click it without expanding the certificate. Then select Export to save the file to your disk.

Then, log in to the dashboard and upload your .p12 file to the Push Notification section, under Settings.

Click +Add and then fill the upload certificates form

Step 4: Register a Device Token in Qiscus Chat SDK and Parse Qiscus APNS Message

In your app's AppDelegate, store your device token as a variable.

Swift
Copy
Swift
Copy

Don't forget set Remote notifications and Background fetch in menu Capabilities

Step 5: Stop Receiving Push Notification

You need to stop receiving Push Notification (PN) when you don't need to receive Push Notification, for example when logout from Qiscus system. To stop receiving the PN , you can see below code:

Swift
Copy

you need to remove the device token, by passing isDevelopment params to make sure your device token is completely removed. IsDevelopment set true when the apps running on development mode, otherwise you can set false for production mode

Notification Payload

Here complete payload of Qiscus Push Notifications. You can define Push Notification from Qiscus Chat SDK which has qiscus_sdk key within APNS response.

JSON
Copy

###

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard