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"
}
}
| Field | Required | Description |
|---|---|---|
projectId | Yes | UUID of the project this template belongs to |
name | Yes | Internal name for the template |
title | Yes | Notification title (supports {{variable}} syntax) |
body | Yes | Notification body (supports {{variable}} syntax) |
data | No | Static 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.