Send a push notification
Send push notifications to device tokens of your mobile apps.
Your mobile app registers for push notifications and sends its device token to your backend. Your backend then sends push messages to those tokens.
Request
curl -X POST 'https://api.gbnotification.dokploy.geobilgi.net/api/v1/companies/COMPANY_ID/projects/PROJECT_ID/messages' \ -H 'X-Api-Key: YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "channel": "push", "recipients": [ { "type": "DeviceToken", "value": "fcm-or-apns-device-token-1" }, { "type": "DeviceToken", "value": "fcm-or-apns-device-token-2" } ], "subject": "Order shipped", "content": "Your order 1042 is on its way.", "data": { "orderId": "1042", "screen": "order-details" }}'| Field | Notes |
|---|---|
recipients | Only DeviceToken recipients are accepted on push (422 message.push_requires_device_tokens). |
subject | The notification title (provider-dependent). |
content | The notification text. |
data | Optional JSON object passed to the push provider, for example to open a screen in your app. Up to 16 KB. Its exact use depends on the provider configured in your project. |
Personalizing
With a template, data string values and the content can contain placeholders that are filled per recipient:
{
"channel": "push",
"templateId": "0197a5f0-2b1c-7e44-8a55-1c2d3e4f5a6b",
"recipients": [
{ "type": "DeviceToken", "value": "token-1", "variables": { "orderId": "1042" } },
{ "type": "DeviceToken", "value": "token-2", "variables": { "orderId": "1043" } }
]
}Failed tokens
Tokens of uninstalled apps fail at the provider. Check dispatches for Failed entries and
their lastError, and remove stale tokens from your own database.