> For the complete documentation index, see [llms.txt](https://docs-sms.online-live-support.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-sms.online-live-support.com/api-documentation/post-add-template-through-api.md).

# POST Add Template through API

Post details are as below:

```
https://app-sms.online-live-support.com/api/api/smsAddTemplate.php
```

Variable should be passed in with format below:&#x20;

Sample Data In

```
{"apiKey ":"abc88888888acbde","email":"xxxx@gmail.com","templateTitle":" AddTemplate02Jun2020","messageContent":"Hi, add template through api on 02 June 2020.","referenceId":"567890"}
```

* | Param          | Data Type | Description                                                                                                   | Sample                                        |
  | -------------- | --------- | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
  | apiKey         | Varchar   | API Key. (Find your API key at <https://app-sms.online-live-support.com/dashboard.php> My Account > Settings) | abc88888888acbde                              |
  | email          | Varchar   | Email. (Find your API key at <https://app-sms.online-live-support.com/dashboard.php> My Account > Settings)   | <xxxx@gmail.com>                              |
  | templateTitle  | Varchar   | Template title to be add                                                                                      | AddTemplate02Jun2020                          |
  | messageContent | Text      | Message content wanted to submit for whitelist                                                                | Hi, add template through api on 02 June 2020. |
  | referenceId    | Varchar   | Reference ID to be return for you when status callback                                                        | <p>567890<br></p>                             |
* To be more secure, only POST method is accepted, GET method will not be accepted.\
  \
  \*\* apiKey, email, templateTitle and messageContent is necessary to pass in, but referenceId is not compulsary. If referenceId is passed from your site, we will return the same referenceId when callback for template status.\
  \*\* Add template through API will be consider as submitted.

## Return submitted template status to client site

* Perform steps below to allow callback status after we approved or rejected your template:<br>

  1. **Pass your return URL to u**\
     For example: <https://app-sms.online-live-support.com/callback/receiveCallbackStatus.php\\>
     &#x20;<https://app-sms.online-live-support.com> => \[website URL]\
     &#x20;callback/receiveCallbackStatus.php => \[file path]
  2. **Tick the checkbox** name as "Enable SMS Add Template Status Callback" at settings -> SMS Template Status Through API Callback section

* Details below will be returned:\
  &#x20;**Sample Data Return**

```
 {"action":"templateStatusCallback","actionCode":"E00101","status":"Approved"," messageContent":"Hi, add template through api on 02 June 2020.","referenceId":"567890"}
```

* | Param          | Data Type | Description                                        | Sample                                        |
  | -------------- | --------- | -------------------------------------------------- | --------------------------------------------- |
  | action         | String    | Return command                                     | templateStatusCallback                        |
  | actionCode     | String    | Return Code                                        | E00101                                        |
  | status         | String    | Template status                                    | Approved                                      |
  | messageContent | String    | Whitelisted message content                        | Hi, add template through api on 02 June 2020. |
  | referenceId    | String    | Reference ID you passed to us when submit template | 567890                                        |

  \
  \*Response array encoded with **JSON**

#### **Status Code List**

| Status Code | Description |
| ----------- | ----------- |
| E00101      | Approved    |
| E00102      | Rejected    |
| E00103      | Others      |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-sms.online-live-support.com/api-documentation/post-add-template-through-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
