Push Notification

Description

This API is used to send PushNotification to the users who have given their email ID. The App which uses the SalesIQ SDK can route their app-specific Notifications through SalesIQ server. That is, the info about the users of the App will be present in SalesIQ and hence the application developer can send a notification to the App users using this REST API.

Note: A valid OAuth token is mandatory. 

Authorization URL

Construct the authorization URL with the following parameters-

Note:  The first 4 parameters are mandatory while the other three parameters are recommended.

Parameter Type Description
Client IDUnique IdentifierThe ID that was assigned to your app when you registered it.
response_typestring”code”
redirect_urlURLYour callback URL with an authorization code and response token. This should be the same link which you used during registration.
ScopesstringSpecifies the scope allowed for your app. Has to be separated by commas.
Syntax:
Servicename.Scopename.Operation
access_typestringOffline/Online (By default it is taken as Online).
The “Online” access_type gives your application only the access_token which is valid for one hour.
The “Offline” access_type will give the application an access-token as well as a refresh_token.
promptstringPrompt= "Consent".
Prompts for user consent each time your app tries to access the user credentials.
statestringA random value(can be a number, a character or a string of characters) that you can assign to correlate the callback with its associated authorization request.

Request Type

POST

Scope Name and Operations to the APIs

SalesIQ.PushNotifications.UPDATE

Query Parameters

You can call this API for two reasons:

  1. To Send Push Notifications :
    • email - Email ID corresponding to the visitor to whom PushNotification is to be sent (This email ID should be notified when user is connected to SDK in the app, using setEmail API)
    • title - Title for the PushNotification
    • message - Message to be shown in Push Notification
    • badgecount - The badgecount that has to be set for the App ( This will be added with the existing message count of SDK)
    • bundleids - Bundeids of the app for which notification needs to be sent (comma separated list)
    • addinfo - This JSON can contain any information in the form of key value pairs. if a image has to be shown in the pushnotification , the URL of the image can be given in the key "imgpath"

    Note:

    All the above params except "addinfo" are mandatory for sending a Push Notification.

  2. To clear the badgecount:
    • email - Email ID corresponding to the visitor
    • badgecount - This param should be set as 0 for resetting badgecount
    • bundleids - Bundeids of the app for which badgecount has to be cleared (comma separated list)

Pre-requisite

  • A mobile Library should be created in SalesIQ portal for the app's bundleid (separately for iOS and Android)
  • The library should be used in the Mobile App
  • The credentials for sending PushNotificaitons must be uploaded in the corresponding Mobile Library Configuration
  • Push Notification status must be enabled in the Mobile Library Configuration

 

URL

Copiedhttps://salesiq.zoho.com/api/v1/<screenname>/pushnotification

Example

Copiedhttps://salesiq.zoho.com/api/v1/zylker/pushnotification?email=patricia@zylker.com&message=hello&title=Zylker&badgecount=10&bundleids=com.zylker.test&addinfo={"imgpath":"https://upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Chat_bubbles.svg/2000px-Chat_bubbles.svg.png"}

Success Response:

Copied{
           "data" : "patricia@zylker.com"
 }

Error Codes:

1. General Error

This error is displayed when the push notification is not sent.

Code : 2111

Error Message : "Unable to send push notification"

2. Visitor not found for the email

This error is sent if there are no visitors found for the given Email ID.

Code : 2112

Error Message : "No Visitor found for the given emailid"

3. Visitor not found for the bundleid:

This error is sent if there are no visitors found for the given bundle ID.

Code : 2113

Error Message : " No Visitor found for the given bundleid"

4. Device not Registered

This error is sent if there are no visitors found for the given Email ID.

Code : 2114

Error Message : "No Device Registered for the Visitor"

5. Push Notifications disabled in Configuration :

This error is sent when the Push Notification Settings for the app in SalesIQ is disabled .

Code : 2311

Error Message : "Push Notification Settings for the app in SalesIQ is disabled "

Error Response - Example:

Copied{
 "error" :
  {
          "message": "No Visitor found for the given emailid",
          "code": 2112
  }
}