Create Message Templates
This API is to create Message Templates using the Cellcast API.
Create SMS Templates
Parameters for creating SMS Templates
Headers Parameters
Parameters | Description |
---|---|
Authorization | Please add provided Bearer token - linked to your Cellcast account. Check here |
Request Body Parameters
Name | Example | Description |
---|---|---|
type | SMS | Required field. Type of message the template is used for |
name | SMS Template Name | Required field. Input the name of your template |
message | SMS Text goes here | To add a new line to the message, use "\r\n" in the message string with only double quotes. |
Code Samples
Post https://api.cellcast.com/api/v1/template
curl --location 'https://api.cellcast.com/api/v1/template' \
--header 'accept: application/json, text/plain, */*' \
--header 'authorization: Bearer {{API_KEY}}' \
--form 'type="SMS"' \
--form 'name="SMS Template Name"' \
--form 'message="This is the SMS template Message from API"'
Replace with the actual API key that you own.
Responses
200 Success
{
"app_type": "web",
"app_version": "1.0",
"maintainence": 0,
"new_version": 0,
"force_update": 0,
"invalid_token": 0,
"refresh_token": "",
"show_message": 0,
"is_enc": false,
"status": true,
"message": "Template created successfully!",
"message_type": "toast",
"data": {
"allowShortenUrl": false,
"optout": false,
"landingPage": false,
"replyStopToOptOut": false,
"_id": "66dfbeddf6a1e50000000000",
"type": "SMS",
"name": "SMS Template Name",
"message": "This is the SMS template Message from API",
"user": "660514979aa8c30000000000",
"createdBy": "660514979aa8c3000000000",
"media": "",
"longUrl": [],
"createdAt": "2024-09-10T03:37:01.740Z",
"updatedAt": "2024-09-10T03:37:01.740Z",
"__v": 0
},
"error": {}
}
203 Non-Authoritative Information
{
"app_type": "web",
"app_version": "1.0",
"maintainence": 0,
"new_version": 0,
"force_update": 0,
"invalid_token": 0,
"refresh_token": "",
"show_message": 0,
"is_enc": false,
"status": false,
"message_type": "toast",
"message": "Something went wrong",
"data": {},
"error": {
"serverError": "template validation failed: name: Path `name` is required."
}
}
401 Unauthorized
{
"code": 401,
"message": "Token expired",
"stack": "APIError: Token expired ...."
}
Create MMS Templates
Parameters for creating MMS Templates
Headers Parameters
Parameters | Description |
---|---|
Authorization | Please add provided Bearer token - linked to your Cellcast account. Check here |
Request Body Parameters
Name | Example | Description |
---|---|---|
type | MMS | Required field. Type of message the template is used for |
name | MMS Template Name | Required field. Input the name of your template |
subjectTitle | Test Subject MMS | Input the subject title of your MMS |
message | MMS Text goes here | To add a new line to the message, use "\r\n" in the message string with only double quotes. |
media | Upload your media here | Upload your media to be used on your MMS |
gif | GIF Link goes here | Input your gif link here to be used on your MMS |
mediaType | image/png | The type of your media used |
Code Samples
Post https://api.cellcast.com/api/v1/template
curl --location 'https://api.cellcast.com/api/v1/template' \
--header 'accept: application/json, text/plain, */*' \
--header 'authorization: Bearer {{API_KEY}}' \
--form 'type="MMS"' \
--form 'name="Test MMS Template with Media"' \
--form 'subjectTitle="Test Subject MMS with Media"' \
--form 'message="This is the MMS template from API with Media"' \
--form 'media=@"/C:/Users/asus/Downloads/Shobuya.png"' \
--form 'gif=""' \
--form 'mediaType="image/png"'
curl --location 'https://api.cellcast.com/api/v1/template' \
--header 'accept: application/json, text/plain, */*' \
--header 'authorization: Bearer {{API_KEY}}' \
--form 'type="MMS"' \
--form 'name="Test MMS Template with GIF"' \
--form 'subjectTitle="Test Subject MMS with GIF"' \
--form 'message="This is the MMS template from API with GIF"' \
--form 'media=""' \
--form 'gif="https://media4.giphy.com/media/Ic1M5Mc5DmOWc/200w_d.gif?cid=6dfca5dby530s2bfvv47t7hxfeyw4t4syyma0gsmr2frg4sv&ep=v1_gifs_trending&rid=200w_d.gif&ct=g"' \
--form 'mediaType=""'
Replace with the actual API key that you own.
Responses
200 Success
{
"app_type": "web",
"app_version": "1.0",
"maintainence": 0,
"new_version": 0,
"force_update": 0,
"invalid_token": 0,
"refresh_token": "",
"show_message": 0,
"is_enc": false,
"status": true,
"message": "Template created successfully!",
"message_type": "toast",
"data": {
"allowShortenUrl": false,
"optout": false,
"landingPage": false,
"replyStopToOptOut": false,
"_id": "66dfce78f6a1e50000000000",
"type": "MMS",
"name": "Test MMS Template",
"subjectTitle": "Test Subject MMS",
"createdAt": "2024-09-10T04:43:36.565Z",
"message": "This is the MMS template from API",
"qr_code": "",
"gif": "",
"mediaType": "image/png",
"user": "660514979aa8c30000000000",
"createdBy": "660514979aa8c30000000000",
"media": "https://cellcast-mms-dev.s3.ap-southeast-2.amazonaws.com/Shobuya.png",
"longUrl": [],
"updatedAt": "2024-09-10T04:43:36.565Z",
"__v": 0
},
"error": {}
}
203 Non-Authoritative Information
{
"app_type": "web",
"app_version": "1.0",
"maintainence": 0,
"new_version": 0,
"force_update": 0,
"invalid_token": 0,
"refresh_token": "",
"show_message": 0,
"is_enc": false,
"status": false,
"message_type": "toast",
"message": "Something went wrong",
"data": {},
"error": {
"serverError": "template validation failed: name: Path `name` is required."
}
}
401 Unauthorized
{
"code": 401,
"message": "Token expired",
"stack": "APIError: Token expired ...."
}
Message With Custom Fields
To create a message with custom fields, you can include placeholders in your message using the format
{{[CUSTOM FIELD NAME]}}
These placeholders will be replaced with the corresponding values when the message is sent.
For example, if you have a custom field called FirstName, you can write your message like this:
Hello {{[First Name]}}, how are you ?
To see the list of available custom fields you can use, please visit the following page: Available Custom Fields.
Important Notes:
- All fields in the response can be used as custom field values, except for the "Number" field.
- Make sure the custom field names match exactly as listed on the available fields page to avoid errors.