# API Documentation - Whatsapp API
## Base URL
https://wa-api.veevotech.com/wa/
All API requests should be directed to this base URL.
## Authorization
provided hash in headers
## Endpoint: /accounts/add (ADMIN)
Used to create account
### Method
**POST**
### Parameters
| Field | Description | Required/Optional | Example Value |
|-------------------|-----------------------------------------------------------------------------------------------|-------------------|-------------------------|
| org_id | | Required | 123456 |
| one_id | | Required | 123456 |
| billing_id | | Required | 123 |
| account_name | | Required | veevo tech |
| wa_id | whatsapp number stating with country code. | Required | 9203340654984 |
| chatBotEnabled | Enable chatbot service on number | Required | true/false |
|ups_partner | up stream partner id dialog260=9, WHATSAPP CLOUD API=10, WhatsApp Web=11 | Required | 11 |
```json
{
"one_id": "123456",
"org_id": "123456",
"billing_id":"123456",
"account_name": "body.account_name",
"wa_id": "923340933850",
"chatBotEnabled": true,
"ups_partner": 11
}
```
## Endpoint: /accounts/qr
Return QR for whatsapp web.
### Method
**POST**
## Endpoint: /chatbot/rule
Used to create account
### Method
**POST**
```json
{
"rules" : [
{ "message": "Enter your e-mail", "name": "email" },
{ "message": "Enter your name", "name": "name"},
{ "message": "Enter your phone number", "name": "phoneNumber" }
],
"trigger_text" : "hi"
}
```
## Endpoint: /demo-account (ADMIN)
Used to register demo account for the users.
### Method
**POST**
### Parameters
| Field | Description | Required/Optional | Example Value |
|-------------------|-----------------------------------------------------------------------------------------------|-------------------|-------------------------|
| org_id | | Required | 123456 |
| one_id | | Required | 123456 |
| billing_id | | Required | 123 |
| account_name | | Required | veevo tech |
| wa_id | whatsapp number stating with country code. | Required | 9203340654984 |
```json
{
"org_id" : 9677375,
"one_id" : 9326933 ,
"billing_id" : 9326933,
"account_name" : "faraz demo",
"wa_id" : "923340933850"
}
```
## Endpoint: /demo-account/verify (ADMIN)
Used to verify OTP for account registration
### Method
**POST**
### Parameters
| Field | Description | Required/Optional | Example Value |
|-------------------|-----------------------------------------------------------------------------------------------|-------------------|-------------------------|
| org_id | | Required | 123456 |
| one_id | | Required | 123456 |
| otp | | Required | 123 |
| wa_id | whatsapp number stating with country code. | Required | 9203340654984 |
```json
{
"org_id" : 9677375,
"one_id" : 9326933 ,
"otp" : 9326933,
"wa_id" : "923340933850"
}
```
>
> **This provides the hash key for account that will be used with below APIs**
>
## Endpoint: /wa/template/sync
Pulls templates from whatsapp
### Method
**GET**
## Endpoint: v1/send_message
### Method
**POST**
### Parameters
| Field | Description | Required/Optional | Example Value |
|-------------------|-----------------------------------------------------------------------------------------------|-------------------|-------------------------|
| to | Sender's phone number with country code | Required | "923340933850" |
| type | Type of message (template, text, image, audio) | Required | "template" |
| message_ref | Additional information for hooks | Optional | "" |
| template_id | Template ID (required if type is template) | Required (for template)| 42 |
| mediaUrl | Array of media URLs (required if type is template) | Required (for template)| [] |
| templateVariables | Array of template variables (required if type is template) | Required (for template)| [] |
| priority | Priority of the message (optional) | Optional | 1 |
| image/audio/video/text | Media or text body ID (required based on the message type) | Required (based on type)| {"id/body": ""} |
## Request Body Example
### For **"template"** type:
```json
{
"to": "reciever_number",
"type": "template",
"message_ref": "",
"template_id": 00,
"mediaUrl": ["https://example.com/media/image.jpg"],
"templateVariables": ["variable1", "variable2"],
"priority": 1
}
```
### For **"text"** type:
```json
{
"to": "reciever_number",
"type": "text",
"text": {
"body": "Hello, this is a text message."
}
}
```
### For **"image"** type:
```json
{
"to": "reciever_number",
"type": "image",
"image": {
"id": "media_id",
"link": "link",
"caption" : "example caption"
}
}
```
### For **"audio"** type:
```json
{
"to": "reciever_number",
"type": "audio",
"audio": {
"id": "media_id",
"link": "link",
"caption" : "example caption"
}
}
```
### For **"video"** type:
```json
{
"to": "reciever_number",
"type": "video",
"video": {
"id": "media_id",
"link": "link",
"caption" : "example caption"
}
}
```
### For **"document"** type:
```json
{
"to": "reciever_number",
"type": "document",
"document": {
"id": "media_id",
"caption" : "example caption",
"filename" : "example.extension"
}
}
```
> **NOTE: use /wa/media api to get media id**
## Endpoint: /media
### Method
**POST**
### Parameters
| Field | Description | Required/Optional | Example Value |
|-------------------|-----------------------------------------------------------------------------------------------|-------------------|-------------------------|
| url | public url of media | Required | https://elephant.veevotech.com/files/4f4451334e673d3d/10_f2b0d8c9e287c21.jpg" |
| mimeType |mimeType | Required | "image/jpeg" |
## Request Body Example
```json
{
"url" : "https://elephant.veevotech.com/files/4f4451334e673d3d/10_f2b0d8c9e287c21.jpg",
"mimeType" : "image/jpeg"
}
```