Loading...

Send Android Push Notifications

Description

This API is used to send text push notifications to the user devices from your Android app for testing, after you register your app with Firebase Cloud Messaging, enroll for Catalyst push notifications, and register your device. You must implement the four steps explained in the Push Notifications- Android help section before you can send push notifications.

Catalyst enables you to send push notifications either to registered test devices or to production devices by passing the appID value from the configuration file of the respective environment. The request URL for sending push notifications to test devices and to production devices varies. These are presented in the Request Details section.

You can pass the push notification message and the recipient to send the push notifications to, along with other details in your API request as shown in the sample request.

Request Details

Request URL to send Test Notifications

POST

{api-domain}/baas/v1/project/{project_id}/push-notification/{app_id}/test

copy

Request URL to send Production Notifications

POST

{api-domain}/baas/v1/project/{project_id}/push-notification/{app_id}/project-user/notify

copy

api-domain
URL
The DC-specific domain to access Catalyst API

project_id
Numerical
The unique ID of the project

app_id
Numerical
The appID generated by Catalyst for your app in Push Notifications. You can find this in the Android section of Push Notifications in your Catalyst console.

Query Parameters

isAndroid: true

Request Headers

Content-Type: application/json

Optional Headers

CATALYST-ORG: {org_id}

Environment: Development

Scope

ZohoCatalyst.notifications.mobile.CUSTOM

Request JSON Properties

recipient string
mandatory
The email address of the user that the push notification must be sent to. You can only send it to one user per API call.
push_details json
mandatory

The JSON that contains the details of the push notification content and metadata

message string
mandatory
The text content of the push notification
Max Size: 100 characters

additional_info json
optional
Any additional information that you need to send in the form of “sample_key” : “sample_value”
Max Size: 100 characters

badge_count integer
optional
The count to be displayed over the app’s icon

reference_id string
optional
The ID for reference

expiry_time integer
optional
The time of expiry of the notification in hours

Response Details

The response returns the status of the sent notification as success or failed, and the data that was passed including message and expiry_time.

Sample Request: Production Device
copy

curl -X POST
https://api.catalyst.zoho.com/baas/v1/project/204000000024010/push-notification/204000000036005/project-user/notify?isAndroid=true
-H “Content-Type: application/json”
-d ‘{ “recipients”:“amanda.boyle@zylker.com”, “push_details”:{ “message”:“Welcome to Zylker App!”, “badge_count”:10, “expiry_time”:12, “additional_info”:{ “sample_key” : “sample_value” } } }’

Sample Response
copy
{
"status": "success",
"data": {
    "recipients": "amanda.boyle@zylker.com",
    "push_details": {
        "message": "Welcome to Zylker App!",
        "additional_info": {
            "sample_key": "sample_value"
        },
        "badge_count": 10,
        "reference_id": null,
        "expiry_time": 12
    }
}
}