Create template
Create reusable message templates for push, email, and SMS channels. Templates can be accessed through both the dashboard and API using a template_id
.
POST
Create template
Overview
Use this endpoint to create a new message template in your OneSignal app. Once created, the template becomes available for use when sending messages via both the Dashboard and the REST API by referencing the template_id
.
Templates streamline and standardize message content across push, email, and SMS channels.
See Templates for more information.
How to use this API
Before using this endpoint, ensure that the target channel (push, email, or SMS) is properly configured in your OneSignal app. See Channel Setup for guidance.
Push Templates
Requirements:
- Set the
contents
property with the English (en
) language key. - All Push Channel Properties are valid for use in push templates.
- By default, all push platforms are enabled. You can target specific platforms by explicitly setting them (e.g.,
isAndroid: true
disables others).
Email Templates
Requirements:
- Set
isEmail: true
. - Include both
email_subject
andemail_body
. - All Email Channel Properties are valid for use in email templates.
SMS Templates
Requirements:
- Set
isSMS: true
. - Provide SMS-specific parameters like
contents
. - All SMS Channel Properties are valid for use in SMS templates.
Body
application/json
Response
200
application/json
200
The response is of type object
.
Create template