Push Notifications API
Overview of push notifications API methods
Send Push Notification
POST
https://api.codemash.io/:version/notifications/push
Send a mobile notification message.
Path Parameters
version
string
The version of the API endpoint. Current latest v1.
Headers
Authorization
string
Your project's secret key.
x-cm-projectid
string
Your project's ID. Can be passed as a query parameter.
Request Body
templateId
string
The ID of push notification template to use.
roles
array
Roles of users to set as recipients.
users
array
An array of user IDs to be set as recipients.
devices
array
An array of device IDs to be set as recipients.
isNonPushable
boolean
If set as true, creates a silent notification without popping up at the recipient's device.
tokens
object
Key-value pair (string: string) object of custom tokens.
postpone
integer
Amount of milliseconds to postpone sending the notification.
respectTimeZone
boolean
If creating a postponed notification and the recipient's devices have timezone set, then postpones according to the device's timezone.
Get Notification
GET
https://api.codemash.io/:version/notifications/push/:id
Gets a push notification.
Path Parameters
version
string
The version of the API endpoint. Current latest v1.
id
string
The ID of a notification to get.
Headers
Authorization
string
Your project's secret key.
x-cm-projectid
string
Your project's ID. Can be passed as a query parameter.
Get Notifications
GET
https://api.codemash.io/:version/notifications/push
Gets many push notifications.
Path Parameters
version
string
The version of the API endpoint. Current latest v1.
Query Parameters
userId
string
The ID of a user whose notifications to get.
deviceId
string
The ID of a device whose notifications to get.
Headers
Authorization
string
Your project's secret key.
x-cm-projectid
string
Your project's ID. Can be passed as a query parameter.
If you do not specify user ID or device ID, the method will return notifications directed to the calling user. To get any user's or device's notifications, the calling user need's to have the appropriate permission for that.
Get Notifications Count
GET
https://api.codemash.io/:version/notifications/push/count
Gets total and total unread notifications.
Path Parameters
version
string
The version of the API endpoint. Current latest v1.
Query Parameters
userId
string
The ID of a user whose notifications to get.
deviceId
string
The ID of a device whose notifications to get.
Headers
Authorization
string
Your project's secret key.
x-cm-projectid
string
Your project's ID. Can be passed as a query parameter.
If you do not specify user ID or device ID, the method will return notifications directed to the calling user. To get any user's or device's notifications, the calling user need's to have the appropriate permission for that.
Read Notification
PATCH
https://api.codemash.io/:version/notifications/push/:notificationId/read
Marks a particular push notification as read.
Path Parameters
version
string
The version of the API endpoint. Current latest v1.
id
string
The ID of a notification to delete.
Headers
Authorization
string
Your project's secret key.
x-cm-projectid
string
Your project's ID. Can be passed as a query parameter.
Request Body
notificationId
string
The ID of notification to mark as read.
userId
string
The ID of the user at which this notification was directed.
deviceId
string
The ID of device at which this notification was directed.
If you do not specify user ID or device ID, the method will assume that notification was directed to a calling user. If you want to set other user's notification as read, you need to have the appropriate permission for that.
Delete Notification
DELETE
https://api.codemash.io/:version/notifications/push/:id
Deletes a particular push notification.
Path Parameters
version
string
The version of the API endpoint. Current latest v1.
id
string
The ID of a notification to delete.
Headers
Authorization
string
Your project's secret key.
x-cm-projectid
string
Your project's ID. Can be passed as a query parameter.
Last updated
Was this helpful?