ByteBrew offers an API to give push notification functions for sending custom notifications or triggering current notifications. The Push API can be accessed by utilizing your Studios API key. Find your Studio API Key through your ByteBrew Dashboard.
API Authentication
free_breakfast Before you start: Make sure to use an email account on ByteBrew that is an Admin in your studio and find the studio api key.
1: Set your Headers for each request.
- email
- apikey
Every request for api data needs to have the following Headers:
By using this endpoint, you can trigger a notification you've already created on the dashboard to be sent to your users. If your triggered notification has an attached segment, then it will send the notification to that segment.
1: Notification Trigger Endpoint.
POST Endpoint: https://push-api.bytebrew.io/api/{push-app-id}/notification/trigger
Body Parameters
Body parameters are required to trigger a notification. The request has the following body parameters:
- (Required) notification_name: This can be found in the Notification page.
- test_send: Boolean indicating to send to only test users specified on the Push Notification Dashboard.
Example Request 1:
POST Endpoint: https://push-api.bytebrew.io/api/{push-app-id}/notification/trigger
Body:
{
"notification_name": "24HR Re-Engagement Push",
"test_send": true //Sends to test push notification users only
}
Example Request 2:
POST Endpoint: https://push-api.bytebrew.io/api/{push-app-id}/notification/trigger
Body:
{
"notification_name": "Live Event Started Push"
}
Create A Custom Notification
By using this endpoint, you can create a custom push notification and send it to users part of a specific segment.
1: Custom Notification Endpoint.
POST Endpoint: https://push-api.bytebrew.io/api/{push-app-id}/notification/custom
Body Parameters
Body Parameters are required to send a custom notification. The request has the following body parameters:
- (Required) segment_name: This can be found in the Segments page.
- (Required) title: The title you want to show on the notification.
- (Required) body: The body text you want to show on the notification.
- subtitle: Optional subtitle you can put on a notification for only iOS devices.
- test_send: Boolean indicating to send to only test users specified on the Push Notification Dashboard.
- extras: Array of extra notification language settings you want to send in other languages.
locale: two letter language code
title: The title you want to show on the notification.
body: The body text you want to show on the notification.
(optional)subtitle: Optional subtitle you can put on a notification for iOS devices only.
Example Request 1:
POST Endpoint: https://push-api.bytebrew.io/api/{push-app-id}/notification/custom
Body:
{
"segment_name": "24HR Lapsed Users",
"title": "Hey What's Up",
"body": "Come back and start a new game"
}
Example Request 2 (additional languages):
POST Endpoint: https://push-api.bytebrew.io/api/{push-app-id}/notification/custom
Body:
{
"segment_name": "24HR Lapsed Users",
"title": "Hey What's Up",
"body": "Come back and start a new game",
"subtitle": "Do you know what time it is",
"extras": [
{
"locale": "fr",
"title": "Hey, qu'est-ce qu'il y a",
"body": "Reviens et commence une nouvelle partie",
"subtitle": "Savez-vous quelle heure il est"
},
{
"locale": "es",
"title": "Hola! Qué tal",
"body": "Vuelve y comienza un nuevo juego.",
"subtitle": "Sabes que hora es"
}
]
}
Send A Single Custom Notification
By using this endpoint, you can send a single notification to individually specified users.
1: Single Send Notification Endpoint.
POST Endpoint: https://push-api.bytebrew.io/api/{push-app-id}/notification/send
Body Parameters
Body Parameters are required to send a single custom notification to a user. The request has the following body parameters:
- (Required) users: Array of user IDs that you want the notification sent to.
- (Required) title: The title you want to show on the notification.
- (Required) body: The body text you want to show on the notification.
- subtitle: Optional subtitle you can put on a notification for iOS devices only.
- extras: Array of extra notification language settings you want to send in other languages.
locale: two letter language code
title: The title you want to show on the notification.
body: The body text you want to show on the notification.
(optional)subtitle: Optional subtitle you can put on a notification for iOS devices only.
Example Request 1:
POST Endpoint: https://push-api.bytebrew.io/api/{push-app-id}/notification/send
Body:
{
"users": [
"USER_1",
"USER_2"
],
"title": "Hey What's Up",
"body": "Come back and start a new game"
}
Example Request 2 (additional languages):
POST Endpoint: https://push-api.bytebrew.io/api/{push-app-id}/notification/send
Body:
{
"users": [
"USER_1",
"USER_2"
],
"title": "Hey What's Up",
"body": "Come back and start a new game",
"subtitle": "Do you know what time it is",
"extras": [
{
"locale": "fr",
"title": "Hey, qu'est-ce qu'il y a",
"body": "Reviens et commence une nouvelle partie",
"subtitle": "Savez-vous quelle heure il est"
},
{
"locale": "es",
"title": "Hola! Qué tal",
"body": "Vuelve y comienza un nuevo juego.",
"subtitle": "Sabes que hora es"
}
]
}