# How to send WhatsApp message using REST API?

After your account on QuickReply.ai is active, you can send template message to users.

Below are the details of REST API

```
URL: 
https://app.quickreply.ai/api/whatsapp/send-template?templateId
={template_id}

Method: POST

Headers: client-id: {client_id} secret-key: {secret_key} Content-Type: application/json

Body:
{
"to": "{{recipient_phone in international format}}",
"name": "{{recipient_name}}",
"email": "{{recipient_email}}",
"link": "{{media_url}}",
"params": [ {{params}} ],
"button_params": [ {{button_params}} ],
"hook_with_playbook":"{{playbook_id}}"
}'
```

Below is the explanation of each parameter (Please remove { } while making API calls)

| Parameter                                                                 | Explaination                                                                                                                                                                                                                                   |
| ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| template\_id                                                              | id of template message. you can get it from Templates tab                                                                                                                                                                                      |
| client-id                                                                 | client id of your account. You can get it from settings -> API credentials                                                                                                                                                                     |
| client-secret                                                             | client secret key of your account. You can get it from settings -> API credentials                                                                                                                                                             |
| to                                                                        | receivers phone number in international format (eg +919876543210 )                                                                                                                                                                             |
| name (optional)                                                           | name of receiver. If supplied, it will be displayed on your account next to phone number                                                                                                                                                       |
| email (optional)                                                          | email of receiver. If supplied, it will be displayed on your account next to phone number                                                                                                                                                      |
| link (required for media template only)                                   | link to media, if you supplied media template. Link should be a direct link, not google drive or any website's link. Media type should match with the template. For example if template requires video, the link should point to a valid video |
| params (required only if template has variables)                          | Array of parameters for the template body. It should match with the number of parameters required in the template. For example if template body contains 2 parameters: {{1}} and {{2}} then you need to supply array of 2 strings.             |
| button\_params (required only if template has dynamic link as cta button) | If link in the template was dynamic, you need to supply dynamic part of the URL as a button\_params                                                                                                                                            |
| playbook\_id (required only if template has quick reply buttons)          | id of playbook(chatbot), if template has quickreply buttons to start chatbot. playbook\_id can be found from AI builder.                                                                                                                       |

Sample curl request for template with dynamic URL as a cta button

```
curl --location --request POST '
https://app.intelliticks.com/api/whatsapp/send-template?templateId=31fa9753-f4f9-48b9-a5b6-ef62cbdd8eeb'
 \
--header 'client-id: <client id> \
--header 'secret-key: <secret key> \
--header 'Content-Type: application/json' \
--data-raw '{
   "to": "+911231231231",
   "name": "Iticks",
   "params": [
       "param1",
       "param2"
   ],
   "button_params": [
       "param1"
   ],
   "link": "
https://www.buildquickbots.com/whatsapp/media/sample/jpg/sample01.jpg"

}'
```


---

# Agent Instructions: 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:

```
GET https://docs.quickreply.ai/help-and-referrence/faqs/how-to-send-whatsapp-message-using-rest-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
