Skip to main content

Push Notification Templates

Push templates, managed via the dashboard define the title and body of your notifications. They include support for variable injection so you can personalise messages at send time.

Create a Template

POST /push-templates
Content-Type: application/json
Authorization: Bearer your-jwt-token
{
"projectId": "project-uuid",
"name": "Order Shipped",
"title": "Your order is on the way, {{name}}!",
"body": "Order #{{orderId}} has been shipped and will arrive by {{deliveryDate}}.",
"data": {
"screen": "order-tracking"
}
}
FieldRequiredDescription
projectIdYesUUID of the project this template belongs to
nameYesInternal name for the template
titleYesNotification title (supports {{variable}} syntax)
bodyYesNotification body (supports {{variable}} syntax)
dataNoStatic key-value data payload sent to the app

Get All Templates

GET /push-templates?projectId={projectId}&page=1&limit=20
Authorization: Bearer your-jwt-token

All query parameters are optional. Default limit is 50, maximum is 100.

Get Templates for a Specific Project

GET /push-templates/project/{projectId}?page=1&limit=20
Authorization: Bearer your-jwt-token

Get a Specific Template

GET /push-templates/{id}
Authorization: Bearer your-jwt-token

Update a Template

Accepts either API key or Bearer token authentication.

PUT /push-templates/{id}?projectId={projectId}
Content-Type: application/json
x-api-key: your-api-key
{
"title": "Your order is on its way, {{name}}!",
"body": "Order #{{orderId}} will arrive by {{deliveryDate}}."
}

All fields are optional. You only include what you want to change. projectId cannot be updated and when using JWT authentication, it is required as a query parameter.

Delete a Template

DELETE /push-templates/{id}
Authorization: Bearer your-jwt-token

Get Template Variables

Returns all variables detected in a template's title and body:

GET /push-templates/{id}/variables
Authorization: Bearer your-jwt-token

Response:

{
"variables": ["name", "orderId", "deliveryDate"]
}

Preview a Template

Test how a template renders with specific variable values. It accepts either API key or Bearer token authentication.

POST /push-templates/preview
Content-Type: application/json
x-api-key: your-api-key
{
"templateId": "template-uuid",
"variables": {
"name": "testuser",
"orderId": "ORD-456",
"deliveryDate": "Jan 20"
}
}

When using JWT authentication, projectId is required in the request body.

Export Templates

Export all push templates from a project as a JSON file:

GET /push-templates/export/{projectId}
Authorization: Bearer your-jwt-token

Response:

{
"templates": [...],
"exportedAt": "2024-01-01T10:00:00Z",
"projectId": "project-uuid",
"projectName": "My App",
"totalTemplates": 5
}

Import Templates

Import templates from a JSON file exported from another project. Upload the file as multipart/form-data:

POST /push-templates/import/{projectId}
Content-Type: multipart/form-data
Authorization: Bearer your-jwt-token

file: <exported-templates.json>

The file must be a valid JSON file exported from MessagePipe. The file's MIME type must be application/json.