EZITXT WhatsApp Business Messaging API v1.3.1
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Developer Documentation for using the EZITXT WhatsApp Business Messaging API
Base URLs:
Terms of service Email: API Support Web: API Support License: Modica API - Terms Of Use
Authentication
- API Key (BasicAuth)
- Parameter Name: Authorization, in: header. Basic Authentication eg Basic base64encode(username:password)
messages
WhatsApp Messaging endpoints.
PostMessages
Code samples
# You can also use wget
curl -X POST https://new.eziapi.com/rest/wab/v1/messages \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: API_KEY'
POST https://new.eziapi.com/rest/wab/v1/messages HTTP/1.1
Host: new.eziapi.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"to": "+64123456789",
"type": "text",
"source": "1234567890",
"text": {
"body": "Hello"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
"to": "+64123456789",
"type": "text",
"source": "1234567890",
"text": {
"body": "Hello"
}
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY'
}
result = RestClient.post 'https://new.eziapi.com/rest/wab/v1/messages',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'API_KEY'
}
r = requests.post('https://new.eziapi.com/rest/wab/v1/messages', headers = headers)
print(r.json())
URL obj = new URL("https://new.eziapi.com/rest/wab/v1/messages");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://new.eziapi.com/rest/wab/v1/messages", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://new.eziapi.com/rest/wab/v1/messages', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
POST /messages
Send a message to a customer.
Body parameter
{
"to": "+64123456789",
"type": "text",
"source": "1234567890",
"text": {
"body": "Hello"
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | any | false | none |
Example responses
202 Response
{
"message_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "accepted"
}
401 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 401,
"error": "unauthorized error message"
}
429 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 429,
"error": "too many requests error message"
}
500 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 500,
"error": "internal server error message"
}
API Error Response.
{
"message": "Whatsapp Cloud API error",
"statusCode": 400,
"error": "bad request error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 403,
"error": "forbidden error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 404,
"error": "not found error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 422,
"error": "unprocessable entity error message"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 202 | Accepted | Post Message response structure. | Inline |
| 401 | Unauthorized | Unauthorized access error. | APIErrorResponse |
| 429 | Too Many Requests | Too many requests error. | APIErrorResponse |
| 500 | Internal Server Error | Internal Server Error. | APIErrorResponse |
| 4XX | Unknown | API Error Response. | APIErrorResponse |
Response Schema
Status Code 202
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » message_id | Uuid | false | none | A string with UUID format. |
| » status | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| status | accepted |
Response Headers
| Status | Header | Type | Format | Description |
|---|---|---|---|---|
| 202 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 202 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 202 | Cache-Control | string | To control caching in browsers and shared caches | |
| 202 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 202 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 401 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 401 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 401 | Cache-Control | string | To control caching in browsers and shared caches | |
| 401 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 401 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 429 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 429 | Cache-Control | string | To control caching in browsers and shared caches | |
| 429 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 429 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Retry-After | integer | int32 | The number of seconds to wait before allowing a follow-up request. |
| 500 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 500 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 500 | Cache-Control | string | To control caching in browsers and shared caches | |
| 500 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 500 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 4XX | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 4XX | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 4XX | Cache-Control | string | To control caching in browsers and shared caches | |
| 4XX | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 4XX | X-Content-Type-Options | string | To prevent MIME type sniffing |
Callbacks
messageCallback
{$statusCallbackUrl}
PostMessages
Code samples
# You can also use wget
curl -X POST https://new.eziapi.com/rest/wab/v1/messages \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: API_KEY'
POST https://new.eziapi.com/rest/wab/v1/messages HTTP/1.1
Host: new.eziapi.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"id": "2af85f64-3645-1078-b3fc-2c963f66afa6",
"reference": "ref-abc123",
"status": "received"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
"id": "2af85f64-3645-1078-b3fc-2c963f66afa6",
"reference": "ref-abc123",
"status": "received"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY'
}
result = RestClient.post 'https://new.eziapi.com/rest/wab/v1/messages',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'API_KEY'
}
r = requests.post('https://new.eziapi.com/rest/wab/v1/messages', headers = headers)
print(r.json())
URL obj = new URL("https://new.eziapi.com/rest/wab/v1/messages");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://new.eziapi.com/rest/wab/v1/messages", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://new.eziapi.com/rest/wab/v1/messages', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
POST /messages
Status/DLR callback. Sent when the status of a MT message is updated
Body parameter
{
"id": "2af85f64-3645-1078-b3fc-2c963f66afa6",
"reference": "ref-abc123",
"status": "received"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | StatusCallback | false | Status callback payload |
Example responses
401 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 401,
"error": "unauthorized error message"
}
429 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 429,
"error": "too many requests error message"
}
500 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 500,
"error": "internal server error message"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | callback successfully processed | None |
| 401 | Unauthorized | Unauthorized access error. | APIErrorResponse |
| 429 | Too Many Requests | Too many requests error. | APIErrorResponse |
| 500 | Internal Server Error | Internal Server Error. | APIErrorResponse |
Response Headers
| Status | Header | Type | Format | Description |
|---|---|---|---|---|
| 200 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 200 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 200 | Cache-Control | string | To control caching in browsers and shared caches | |
| 200 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 200 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 401 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 401 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 401 | Cache-Control | string | To control caching in browsers and shared caches | |
| 401 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 401 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 429 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 429 | Cache-Control | string | To control caching in browsers and shared caches | |
| 429 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 429 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Retry-After | integer | int32 | The number of seconds to wait before allowing a follow-up request. |
| 500 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 500 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 500 | Cache-Control | string | To control caching in browsers and shared caches | |
| 500 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 500 | X-Content-Type-Options | string | To prevent MIME type sniffing |
{$replyCallbackUrl}
PostMessages
Code samples
# You can also use wget
curl -X POST https://new.eziapi.com/rest/wab/v1/messages \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: API_KEY'
POST https://new.eziapi.com/rest/wab/v1/messages HTTP/1.1
Host: new.eziapi.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa7",
"source": "64123456789",
"destination": "102046588645210",
"content": {
"audio": {
"id": "abc123456",
"mime_type": "audio/mp3"
},
"type": "audio"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa7",
"source": "64123456789",
"destination": "102046588645210",
"content": {
"audio": {
"id": "abc123456",
"mime_type": "audio/mp3"
},
"type": "audio"
}
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY'
}
result = RestClient.post 'https://new.eziapi.com/rest/wab/v1/messages',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'API_KEY'
}
r = requests.post('https://new.eziapi.com/rest/wab/v1/messages', headers = headers)
print(r.json())
URL obj = new URL("https://new.eziapi.com/rest/wab/v1/messages");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://new.eziapi.com/rest/wab/v1/messages", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://new.eziapi.com/rest/wab/v1/messages', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
POST /messages
Reply/MO callback. Sent when a MO message is received
Body parameter
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa7",
"source": "64123456789",
"destination": "102046588645210",
"content": {
"audio": {
"id": "abc123456",
"mime_type": "audio/mp3"
},
"type": "audio"
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | ReplyCallback | false | Reply callback payload |
Example responses
401 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 401,
"error": "unauthorized error message"
}
429 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 429,
"error": "too many requests error message"
}
500 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 500,
"error": "internal server error message"
}
API Error Response.
{
"message": "Whatsapp Cloud API error",
"statusCode": 400,
"error": "bad request error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 403,
"error": "forbidden error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 404,
"error": "not found error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 422,
"error": "unprocessable entity error message"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | callback successfully processed | None |
| 401 | Unauthorized | Unauthorized access error. | APIErrorResponse |
| 429 | Too Many Requests | Too many requests error. | APIErrorResponse |
| 500 | Internal Server Error | Internal Server Error. | APIErrorResponse |
| 4XX | Unknown | API Error Response. | APIErrorResponse |
Response Headers
| Status | Header | Type | Format | Description |
|---|---|---|---|---|
| 200 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 200 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 200 | Cache-Control | string | To control caching in browsers and shared caches | |
| 200 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 200 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 401 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 401 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 401 | Cache-Control | string | To control caching in browsers and shared caches | |
| 401 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 401 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 429 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 429 | Cache-Control | string | To control caching in browsers and shared caches | |
| 429 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 429 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Retry-After | integer | int32 | The number of seconds to wait before allowing a follow-up request. |
| 500 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 500 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 500 | Cache-Control | string | To control caching in browsers and shared caches | |
| 500 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 500 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 4XX | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 4XX | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 4XX | Cache-Control | string | To control caching in browsers and shared caches | |
| 4XX | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 4XX | X-Content-Type-Options | string | To prevent MIME type sniffing |
PatchMessages
Code samples
# You can also use wget
curl -X PATCH https://new.eziapi.com/rest/wab/v1/messages \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: API_KEY'
PATCH https://new.eziapi.com/rest/wab/v1/messages HTTP/1.1
Host: new.eziapi.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"message_id": [
"string"
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages',
{
method: 'PATCH',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
"message_id": [
"string"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages',
{
method: 'PATCH',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY'
}
result = RestClient.patch 'https://new.eziapi.com/rest/wab/v1/messages',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'API_KEY'
}
r = requests.patch('https://new.eziapi.com/rest/wab/v1/messages', headers = headers)
print(r.json())
URL obj = new URL("https://new.eziapi.com/rest/wab/v1/messages");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PATCH", "https://new.eziapi.com/rest/wab/v1/messages", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PATCH','https://new.eziapi.com/rest/wab/v1/messages', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
PATCH /messages
Update an existing message status e.g. mark as read.
Body parameter
{
"message_id": [
"string"
]
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | object | false | none |
| » message_id | body | [Uuid] | true | [A string with UUID format.] |
Example responses
401 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 401,
"error": "unauthorized error message"
}
429 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 429,
"error": "too many requests error message"
}
500 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 500,
"error": "internal server error message"
}
API Error Response.
{
"message": "Whatsapp Cloud API error",
"statusCode": 400,
"error": "bad request error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 403,
"error": "forbidden error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 404,
"error": "not found error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 422,
"error": "unprocessable entity error message"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | None |
| 401 | Unauthorized | Unauthorized access error. | APIErrorResponse |
| 429 | Too Many Requests | Too many requests error. | APIErrorResponse |
| 500 | Internal Server Error | Internal Server Error. | APIErrorResponse |
| 4XX | Unknown | API Error Response. | APIErrorResponse |
Response Headers
| Status | Header | Type | Format | Description |
|---|---|---|---|---|
| 200 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 200 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 200 | Cache-Control | string | To control caching in browsers and shared caches | |
| 200 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 200 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 401 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 401 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 401 | Cache-Control | string | To control caching in browsers and shared caches | |
| 401 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 401 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 429 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 429 | Cache-Control | string | To control caching in browsers and shared caches | |
| 429 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 429 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Retry-After | integer | int32 | The number of seconds to wait before allowing a follow-up request. |
| 500 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 500 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 500 | Cache-Control | string | To control caching in browsers and shared caches | |
| 500 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 500 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 4XX | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 4XX | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 4XX | Cache-Control | string | To control caching in browsers and shared caches | |
| 4XX | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 4XX | X-Content-Type-Options | string | To prevent MIME type sniffing |
GetMessages
Code samples
# You can also use wget
curl -X GET https://new.eziapi.com/rest/wab/v1/messages?id=string \
-H 'Accept: application/json' \
-H 'Authorization: API_KEY'
GET https://new.eziapi.com/rest/wab/v1/messages?id=string HTTP/1.1
Host: new.eziapi.com
Accept: application/json
const headers = {
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages?id=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages?id=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'API_KEY'
}
result = RestClient.get 'https://new.eziapi.com/rest/wab/v1/messages',
params: {
'id' => '[Uuid](#schemauuid)'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'Authorization': 'API_KEY'
}
r = requests.get('https://new.eziapi.com/rest/wab/v1/messages', params={
'id': 'string'
}, headers = headers)
print(r.json())
URL obj = new URL("https://new.eziapi.com/rest/wab/v1/messages?id=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://new.eziapi.com/rest/wab/v1/messages", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
'application/json',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://new.eziapi.com/rest/wab/v1/messages', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
GET /messages
Get a message by the message ID
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | query | Uuid | true | The message ID |
Example responses
Get Message response structure.
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "received",
"timestamp": 123456789,
"direction": "MT",
"type": "text",
"attributes": {
"body": "The body of the message"
}
}
API Error Response.
{
"message": "Whatsapp Cloud API error",
"statusCode": 400,
"error": "bad request error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 403,
"error": "forbidden error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 404,
"error": "not found error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 422,
"error": "unprocessable entity error message"
}
401 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 401,
"error": "unauthorized error message"
}
API Error Response.
{
"message": "Whatsapp Cloud API error",
"statusCode": 400,
"error": "bad request error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 403,
"error": "forbidden error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 404,
"error": "not found error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 422,
"error": "unprocessable entity error message"
}
429 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 429,
"error": "too many requests error message"
}
500 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 500,
"error": "internal server error message"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Get Message response structure. | MessageDetails |
| 400 | Bad Request | API Error Response. | APIErrorResponse |
| 401 | Unauthorized | Unauthorized access error. | APIErrorResponse |
| 404 | Not Found | API Error Response. | APIErrorResponse |
| 429 | Too Many Requests | Too many requests error. | APIErrorResponse |
| 500 | Internal Server Error | Internal Server Error. | APIErrorResponse |
Response Headers
| Status | Header | Type | Format | Description |
|---|---|---|---|---|
| 200 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 200 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 200 | Cache-Control | string | To control caching in browsers and shared caches | |
| 200 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 200 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 400 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 400 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 400 | Cache-Control | string | To control caching in browsers and shared caches | |
| 400 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 400 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 401 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 401 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 401 | Cache-Control | string | To control caching in browsers and shared caches | |
| 401 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 401 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 404 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 404 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 404 | Cache-Control | string | To control caching in browsers and shared caches | |
| 404 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 404 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 429 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 429 | Cache-Control | string | To control caching in browsers and shared caches | |
| 429 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 429 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Retry-After | integer | int32 | The number of seconds to wait before allowing a follow-up request. |
| 500 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 500 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 500 | Cache-Control | string | To control caching in browsers and shared caches | |
| 500 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 500 | X-Content-Type-Options | string | To prevent MIME type sniffing |
messages_broadcast_post
Code samples
# You can also use wget
curl -X POST https://new.eziapi.com/rest/wab/v1/messages/broadcast \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: API_KEY'
POST https://new.eziapi.com/rest/wab/v1/messages/broadcast HTTP/1.1
Host: new.eziapi.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"destination": [
"+64123456789",
"+64223456788"
],
"source": "1234567890",
"type": "text",
"text": {
"body": "Hello"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages/broadcast',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
"destination": [
"+64123456789",
"+64223456788"
],
"source": "1234567890",
"type": "text",
"text": {
"body": "Hello"
}
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages/broadcast',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY'
}
result = RestClient.post 'https://new.eziapi.com/rest/wab/v1/messages/broadcast',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'API_KEY'
}
r = requests.post('https://new.eziapi.com/rest/wab/v1/messages/broadcast', headers = headers)
print(r.json())
URL obj = new URL("https://new.eziapi.com/rest/wab/v1/messages/broadcast");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://new.eziapi.com/rest/wab/v1/messages/broadcast", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://new.eziapi.com/rest/wab/v1/messages/broadcast', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
POST /messages/broadcast
Send a broadcast message to customers.
Body parameter
{
"destination": [
"+64123456789",
"+64223456788"
],
"source": "1234567890",
"type": "text",
"text": {
"body": "Hello"
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | any | false | none |
Example responses
Broadcast Message response structure.
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "accepted"
},
{
"id": "6fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "accepted"
}
]
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "failed",
"message": "error_message"
},
{
"id": "6fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "failed",
"message": "error_message"
}
]
API Error Response.
{
"message": "Whatsapp Cloud API error",
"statusCode": 400,
"error": "bad request error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 403,
"error": "forbidden error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 404,
"error": "not found error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 422,
"error": "unprocessable entity error message"
}
401 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 401,
"error": "unauthorized error message"
}
API Error Response.
{
"message": "Whatsapp Cloud API error",
"statusCode": 400,
"error": "bad request error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 403,
"error": "forbidden error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 404,
"error": "not found error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 422,
"error": "unprocessable entity error message"
}
429 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 429,
"error": "too many requests error message"
}
500 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 500,
"error": "internal server error message"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 202 | Accepted | Broadcast Message response structure. | Inline |
| 400 | Bad Request | API Error Response. | APIErrorResponse |
| 401 | Unauthorized | Unauthorized access error. | APIErrorResponse |
| 422 | Unprocessable Entity | API Error Response. | APIErrorResponse |
| 429 | Too Many Requests | Too many requests error. | APIErrorResponse |
| 500 | Internal Server Error | Internal Server Error. | APIErrorResponse |
Response Schema
Status Code 202
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » destination | E164 | false | none | The destination number in E.164 format. |
| » id | Uuid | false | none | A string with UUID format. |
| » status | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| status | accepted |
| status | failed |
Response Headers
| Status | Header | Type | Format | Description |
|---|---|---|---|---|
| 202 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 202 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 202 | Cache-Control | string | To control caching in browsers and shared caches | |
| 202 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 202 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 400 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 400 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 400 | Cache-Control | string | To control caching in browsers and shared caches | |
| 400 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 400 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 401 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 401 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 401 | Cache-Control | string | To control caching in browsers and shared caches | |
| 401 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 401 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 422 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 422 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 422 | Cache-Control | string | To control caching in browsers and shared caches | |
| 422 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 422 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 429 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 429 | Cache-Control | string | To control caching in browsers and shared caches | |
| 429 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 429 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Retry-After | integer | int32 | The number of seconds to wait before allowing a follow-up request. |
| 500 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 500 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 500 | Cache-Control | string | To control caching in browsers and shared caches | |
| 500 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 500 | X-Content-Type-Options | string | To prevent MIME type sniffing |
Callbacks
messageCallback
{$statusCallbackUrl}
messages_broadcast_post
Code samples
# You can also use wget
curl -X POST https://new.eziapi.com/rest/wab/v1/messages/broadcast \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: API_KEY'
POST https://new.eziapi.com/rest/wab/v1/messages/broadcast HTTP/1.1
Host: new.eziapi.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"id": "2af85f64-3645-1078-b3fc-2c963f66afa6",
"reference": "ref-abc123",
"status": "received"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages/broadcast',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
"id": "2af85f64-3645-1078-b3fc-2c963f66afa6",
"reference": "ref-abc123",
"status": "received"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages/broadcast',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY'
}
result = RestClient.post 'https://new.eziapi.com/rest/wab/v1/messages/broadcast',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'API_KEY'
}
r = requests.post('https://new.eziapi.com/rest/wab/v1/messages/broadcast', headers = headers)
print(r.json())
URL obj = new URL("https://new.eziapi.com/rest/wab/v1/messages/broadcast");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://new.eziapi.com/rest/wab/v1/messages/broadcast", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://new.eziapi.com/rest/wab/v1/messages/broadcast', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
POST /messages/broadcast
Status/DLR callback. Sent when the status of a MT message is updated
Body parameter
{
"id": "2af85f64-3645-1078-b3fc-2c963f66afa6",
"reference": "ref-abc123",
"status": "received"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | StatusCallback | false | Status callback payload |
Example responses
401 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 401,
"error": "unauthorized error message"
}
429 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 429,
"error": "too many requests error message"
}
500 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 500,
"error": "internal server error message"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | callback successfully processed | None |
| 401 | Unauthorized | Unauthorized access error. | APIErrorResponse |
| 429 | Too Many Requests | Too many requests error. | APIErrorResponse |
| 500 | Internal Server Error | Internal Server Error. | APIErrorResponse |
Response Headers
| Status | Header | Type | Format | Description |
|---|---|---|---|---|
| 200 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 200 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 200 | Cache-Control | string | To control caching in browsers and shared caches | |
| 200 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 200 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 401 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 401 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 401 | Cache-Control | string | To control caching in browsers and shared caches | |
| 401 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 401 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 429 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 429 | Cache-Control | string | To control caching in browsers and shared caches | |
| 429 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 429 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Retry-After | integer | int32 | The number of seconds to wait before allowing a follow-up request. |
| 500 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 500 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 500 | Cache-Control | string | To control caching in browsers and shared caches | |
| 500 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 500 | X-Content-Type-Options | string | To prevent MIME type sniffing |
{$replyCallbackUrl}
messages_broadcast_post
Code samples
# You can also use wget
curl -X POST https://new.eziapi.com/rest/wab/v1/messages/broadcast \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: API_KEY'
POST https://new.eziapi.com/rest/wab/v1/messages/broadcast HTTP/1.1
Host: new.eziapi.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa7",
"source": "64123456789",
"destination": "102046588645210",
"content": {
"audio": {
"id": "abc123456",
"mime_type": "audio/mp3"
},
"type": "audio"
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages/broadcast',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa7",
"source": "64123456789",
"destination": "102046588645210",
"content": {
"audio": {
"id": "abc123456",
"mime_type": "audio/mp3"
},
"type": "audio"
}
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/messages/broadcast',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY'
}
result = RestClient.post 'https://new.eziapi.com/rest/wab/v1/messages/broadcast',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'API_KEY'
}
r = requests.post('https://new.eziapi.com/rest/wab/v1/messages/broadcast', headers = headers)
print(r.json())
URL obj = new URL("https://new.eziapi.com/rest/wab/v1/messages/broadcast");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://new.eziapi.com/rest/wab/v1/messages/broadcast", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://new.eziapi.com/rest/wab/v1/messages/broadcast', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
POST /messages/broadcast
Reply/MO callback. Sent when a MO message is received
Body parameter
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa7",
"source": "64123456789",
"destination": "102046588645210",
"content": {
"audio": {
"id": "abc123456",
"mime_type": "audio/mp3"
},
"type": "audio"
}
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | ReplyCallback | false | Reply callback payload |
Example responses
401 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 401,
"error": "unauthorized error message"
}
429 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 429,
"error": "too many requests error message"
}
500 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 500,
"error": "internal server error message"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | callback successfully processed | None |
| 401 | Unauthorized | Unauthorized access error. | APIErrorResponse |
| 429 | Too Many Requests | Too many requests error. | APIErrorResponse |
| 500 | Internal Server Error | Internal Server Error. | APIErrorResponse |
Response Headers
| Status | Header | Type | Format | Description |
|---|---|---|---|---|
| 200 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 200 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 200 | Cache-Control | string | To control caching in browsers and shared caches | |
| 200 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 200 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 401 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 401 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 401 | Cache-Control | string | To control caching in browsers and shared caches | |
| 401 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 401 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 429 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 429 | Cache-Control | string | To control caching in browsers and shared caches | |
| 429 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 429 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Retry-After | integer | int32 | The number of seconds to wait before allowing a follow-up request. |
| 500 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 500 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 500 | Cache-Control | string | To control caching in browsers and shared caches | |
| 500 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 500 | X-Content-Type-Options | string | To prevent MIME type sniffing |
media
WhatsApp Media endpoints.
PostMedia
Code samples
# You can also use wget
curl -X POST https://new.eziapi.com/rest/wab/v1/media?source=string \
-H 'Content-Type: multipart/form-data' \
-H 'Accept: application/json' \
-H 'Authorization: API_KEY'
POST https://new.eziapi.com/rest/wab/v1/media?source=string HTTP/1.1
Host: new.eziapi.com
Content-Type: multipart/form-data
Accept: application/json
const inputBody = '{
"file": "string"
}';
const headers = {
'Content-Type':'multipart/form-data',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/media?source=string',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
"file": "string"
};
const headers = {
'Content-Type':'multipart/form-data',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/media?source=string',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'multipart/form-data',
'Accept' => 'application/json',
'Authorization' => 'API_KEY'
}
result = RestClient.post 'https://new.eziapi.com/rest/wab/v1/media',
params: {
'source' => 'string(^[1-9]{1}[0-9]*$)'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'multipart/form-data',
'Accept': 'application/json',
'Authorization': 'API_KEY'
}
r = requests.post('https://new.eziapi.com/rest/wab/v1/media', params={
'source': 'string'
}, headers = headers)
print(r.json())
URL obj = new URL("https://new.eziapi.com/rest/wab/v1/media?source=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"multipart/form-data"},
"Accept": []string{"application/json"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://new.eziapi.com/rest/wab/v1/media", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
'multipart/form-data',
'Accept' => 'application/json',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://new.eziapi.com/rest/wab/v1/media', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
POST /media
Uploading media
Body parameter
file: string
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| source | query | string(^[1-9]{1}[0-9]*$) | true | Source for the media upload |
| body | body | object | false | none |
| » file | body | string(base64) | false | none |
Example responses
200 Response
{
"id": "abcd1234xyz"
}
401 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 401,
"error": "unauthorized error message"
}
429 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 429,
"error": "too many requests error message"
}
500 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 500,
"error": "internal server error message"
}
API Error Response.
{
"message": "Whatsapp Cloud API error",
"statusCode": 400,
"error": "bad request error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 403,
"error": "forbidden error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 404,
"error": "not found error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 422,
"error": "unprocessable entity error message"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Upload Media response structure. | Inline |
| 401 | Unauthorized | Unauthorized access error. | APIErrorResponse |
| 429 | Too Many Requests | Too many requests error. | APIErrorResponse |
| 500 | Internal Server Error | Internal Server Error. | APIErrorResponse |
| 4XX | Unknown | API Error Response. | APIErrorResponse |
Response Schema
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » id | string(string) | false | none | none |
Response Headers
| Status | Header | Type | Format | Description |
|---|---|---|---|---|
| 200 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 200 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 200 | Cache-Control | string | To control caching in browsers and shared caches | |
| 200 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 200 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 401 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 401 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 401 | Cache-Control | string | To control caching in browsers and shared caches | |
| 401 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 401 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 429 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 429 | Cache-Control | string | To control caching in browsers and shared caches | |
| 429 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 429 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Retry-After | integer | int32 | The number of seconds to wait before allowing a follow-up request. |
| 500 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 500 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 500 | Cache-Control | string | To control caching in browsers and shared caches | |
| 500 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 500 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 4XX | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 4XX | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 4XX | Cache-Control | string | To control caching in browsers and shared caches | |
| 4XX | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 4XX | X-Content-Type-Options | string | To prevent MIME type sniffing |
GetMedia
Code samples
# You can also use wget
curl -X GET https://new.eziapi.com/rest/wab/v1/media?media_id=string&source=string \
-H 'Accept: application/octet-stream' \
-H 'Authorization: API_KEY'
GET https://new.eziapi.com/rest/wab/v1/media?media_id=string&source=string HTTP/1.1
Host: new.eziapi.com
Accept: application/octet-stream
const headers = {
'Accept':'application/octet-stream',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/media?media_id=string&source=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
const fetch = require('node-fetch');
const headers = {
'Accept':'application/octet-stream',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/media?media_id=string&source=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/octet-stream',
'Authorization' => 'API_KEY'
}
result = RestClient.get 'https://new.eziapi.com/rest/wab/v1/media',
params: {
'media_id' => 'string',
'source' => 'string'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/octet-stream',
'Authorization': 'API_KEY'
}
r = requests.get('https://new.eziapi.com/rest/wab/v1/media', params={
'media_id': 'string', 'source': 'string'
}, headers = headers)
print(r.json())
URL obj = new URL("https://new.eziapi.com/rest/wab/v1/media?media_id=string&source=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/octet-stream"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://new.eziapi.com/rest/wab/v1/media", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
'application/octet-stream',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://new.eziapi.com/rest/wab/v1/media', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
GET /media
Download message media.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| media_id | query | string | true | The ID for the media item. |
| source | query | string | true | The source - business phone number id. |
Example responses
200 Response
401 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 401,
"error": "unauthorized error message"
}
429 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 429,
"error": "too many requests error message"
}
500 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 500,
"error": "internal server error message"
}
API Error Response.
{
"message": "Whatsapp Cloud API error",
"statusCode": 400,
"error": "bad request error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 403,
"error": "forbidden error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 404,
"error": "not found error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 422,
"error": "unprocessable entity error message"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Get Media response structure. | string |
| 401 | Unauthorized | Unauthorized access error. | APIErrorResponse |
| 429 | Too Many Requests | Too many requests error. | APIErrorResponse |
| 500 | Internal Server Error | Internal Server Error. | APIErrorResponse |
| 4XX | Unknown | API Error Response. | APIErrorResponse |
Response Headers
| Status | Header | Type | Format | Description |
|---|---|---|---|---|
| 200 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 200 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 200 | Cache-Control | string | To control caching in browsers and shared caches | |
| 200 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 200 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 401 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 401 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 401 | Cache-Control | string | To control caching in browsers and shared caches | |
| 401 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 401 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 429 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 429 | Cache-Control | string | To control caching in browsers and shared caches | |
| 429 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 429 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Retry-After | integer | int32 | The number of seconds to wait before allowing a follow-up request. |
| 500 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 500 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 500 | Cache-Control | string | To control caching in browsers and shared caches | |
| 500 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 500 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 4XX | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 4XX | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 4XX | Cache-Control | string | To control caching in browsers and shared caches | |
| 4XX | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 4XX | X-Content-Type-Options | string | To prevent MIME type sniffing |
source
WhatsApp Source registration endpoints.
PostSource
Code samples
# You can also use wget
curl -X POST https://new.eziapi.com/rest/wab/v1/source \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: API_KEY'
POST https://new.eziapi.com/rest/wab/v1/source HTTP/1.1
Host: new.eziapi.com
Content-Type: application/json
Accept: application/json
const inputBody = '{
"source": "string",
"waba_id": "string",
"pin": "string"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/source',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
const fetch = require('node-fetch');
const inputBody = {
"source": "string",
"waba_id": "string",
"pin": "string"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'Authorization':'API_KEY'
};
fetch('https://new.eziapi.com/rest/wab/v1/source',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY'
}
result = RestClient.post 'https://new.eziapi.com/rest/wab/v1/source',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'API_KEY'
}
r = requests.post('https://new.eziapi.com/rest/wab/v1/source', headers = headers)
print(r.json())
URL obj = new URL("https://new.eziapi.com/rest/wab/v1/source");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://new.eziapi.com/rest/wab/v1/source", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
'application/json',
'Accept' => 'application/json',
'Authorization' => 'API_KEY',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://new.eziapi.com/rest/wab/v1/source', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
POST /source
Adding a source
Body parameter
{
"source": "string",
"waba_id": "string",
"pin": "string"
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | object | false | Source registration request payload |
| » source | body | string | true | WhatsApp Business phone number ID |
| » waba_id | body | string | true | WhatsApp Business Account ID |
| » pin | body | string | false | Optional 6-digit PIN for 2FA |
Example responses
401 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 401,
"error": "unauthorized error message"
}
429 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 429,
"error": "too many requests error message"
}
500 Response
{
"message": "Whatsapp Cloud API error",
"statusCode": 500,
"error": "internal server error message"
}
API Error Response.
{
"message": "Whatsapp Cloud API error",
"statusCode": 400,
"error": "bad request error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 403,
"error": "forbidden error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 404,
"error": "not found error message"
}
{
"message": "Whatsapp Cloud API error",
"statusCode": 422,
"error": "unprocessable entity error message"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | Post source response structure. | None |
| 401 | Unauthorized | Unauthorized access error. | APIErrorResponse |
| 429 | Too Many Requests | Too many requests error. | APIErrorResponse |
| 500 | Internal Server Error | Internal Server Error. | APIErrorResponse |
| 4XX | Unknown | API Error Response. | APIErrorResponse |
Response Headers
| Status | Header | Type | Format | Description |
|---|---|---|---|---|
| 200 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 200 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 200 | Cache-Control | string | To control caching in browsers and shared caches | |
| 200 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 200 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 401 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 401 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 401 | Cache-Control | string | To control caching in browsers and shared caches | |
| 401 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 401 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 429 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 429 | Cache-Control | string | To control caching in browsers and shared caches | |
| 429 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 429 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 429 | Retry-After | integer | int32 | The number of seconds to wait before allowing a follow-up request. |
| 500 | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 500 | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 500 | Cache-Control | string | To control caching in browsers and shared caches | |
| 500 | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 500 | X-Content-Type-Options | string | To prevent MIME type sniffing | |
| 4XX | Content-Security-Policy | string | Content Security Policy to prevent certain types of attacks. | |
| 4XX | Strict-Transport-Security | string | HSTS header to enforce HTTPS | |
| 4XX | Cache-Control | string | To control caching in browsers and shared caches | |
| 4XX | X-Frame-Options | string | To indicate whether a browser should be allowed to render a page in a frame, iframe, embed or object | |
| 4XX | X-Content-Type-Options | string | To prevent MIME type sniffing |
Schemas
APIErrorResponse
{
"errors": [
{
"field": "string",
"code": "string",
"description": "string"
}
]
}
Top-level structure wrapping error objects.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| errors | [APIError] | false | none | [An API error structure.] |
APIError
{
"field": "string",
"code": "string",
"description": "string"
}
An API error structure.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| field | string | true | none | none |
| code | string | true | none | none |
| description | string | true | none | none |
MediaMimeType
"image/png"
Supported media mime types.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | string | false | none | Supported media mime types. |
Enumerated Values
| Property | Value |
|---|---|
| anonymous | image/png |
| anonymous | image/jpeg |
| anonymous | text/plain |
| anonymous | application/pdf |
| anonymous | audio/mp3 |
| anonymous | video/mp4 |
E164
"string"
The destination number in E.164 format.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | string | false | none | The destination number in E.164 format. |
Uuid
"string"
A string with UUID format.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | string | false | none | A string with UUID format. |
MessageDestination
{
"to": "string",
"destination": "string"
}
Message destination fields.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| to | string | false | none | The destination number in E.164 format. |
| destination | E164 | false | none | The destination number in E.164 format. |
BroadcastMessageDestination
{
"destination": [
"string"
]
}
Broadcast message destination fields.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| destination | [E164] | true | none | Array of destination numbers in E.164 format. |
MessageCommon
{
"source": "string",
"scheduled": "2019-08-24T14:15:22Z",
"type": "text",
"reference": "string"
}
Common message fields.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| source | string | true | none | The whatsapp business number id. |
| scheduled | string(date-time) | false | none | Allows scheduling of messages with an upper limit of 60 days. |
| type | string | true | none | none |
| reference | string(none) | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| type | text |
| type | template |
| type | media |
| type | raw |
MessageText
{
"to": "string",
"destination": "string",
"source": "string",
"scheduled": "2019-08-24T14:15:22Z",
"type": "text",
"reference": "string",
"text": {
"body": "string"
}
}
Message of Text type.
Properties
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | MessageDestination | false | none | Message destination fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | MessageCommon | false | none | Common message fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | object | false | none | none |
| » text | object | true | none | none |
| »» body | string(none) | true | none | none |
MessageMedia
{
"to": "string",
"destination": "string",
"source": "string",
"scheduled": "2019-08-24T14:15:22Z",
"type": "text",
"reference": "string",
"media": {
"type": "audio",
"url": "string"
}
}
Message of Media type.
Properties
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | MessageDestination | false | none | Message destination fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | MessageCommon | false | none | Common message fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | object | false | none | none |
| » media | object | true | none | none |
| »» type | string | true | none | none |
| »» url | string(url) | true | none | none |
Enumerated Values
| Property | Value |
|---|---|
| type | audio |
| type | document |
| type | image |
| type | video |
MessageRaw
{
"to": "string",
"destination": "string",
"source": "string",
"scheduled": "2019-08-24T14:15:22Z",
"type": "text",
"reference": "string",
"raw": {
"version": "string",
"payload": "string"
}
}
Message of Raw type.
Properties
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | MessageDestination | false | none | Message destination fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | MessageCommon | false | none | Common message fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | object | false | none | none |
| » raw | object | true | none | none |
| »» version | string(none) | false | none | none |
| »» payload | string(none) | true | none | none |
MessageTemplate
{
"to": "string",
"destination": "string",
"source": "string",
"scheduled": "2019-08-24T14:15:22Z",
"type": "text",
"reference": "string",
"template": {
"name": "string",
"language": "en_US",
"header_params": [
"string"
],
"body_params": [
"string"
],
"media": {
"type": "string",
"url": "string"
},
"buttons": [
{
"index": 0,
"type": "string",
"payload": "string"
}
]
}
}
Message of Template type.
Properties
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | MessageDestination | false | none | Message destination fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | MessageCommon | false | none | Common message fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | object | false | none | none |
| » template | object | true | none | none |
| »» name | string(none) | true | none | none |
| »» language | string(none) | true | none | none |
| »» header_params | [string] | false | none | none |
| »» body_params | [string] | false | none | none |
| »» media | object | false | none | none |
| »»» type | string(none) | false | none | none |
| »»» url | string(url) | false | none | none |
| »» buttons | [object] | false | none | none |
| »»» index | number(int32) | false | none | none |
| »»» type | string(none) | false | none | none |
| »»» payload | string(none) | false | none | none |
BroadcastMessageText
{
"destination": [
"string"
],
"source": "string",
"scheduled": "2019-08-24T14:15:22Z",
"type": "text",
"reference": "string",
"text": {
"body": "string"
}
}
Message of Text type.
Properties
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | BroadcastMessageDestination | false | none | Broadcast message destination fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | MessageCommon | false | none | Common message fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | object | false | none | none |
| » text | object | true | none | none |
| »» body | string(none) | true | none | none |
BroadcastMessageMedia
{
"destination": [
"string"
],
"source": "string",
"scheduled": "2019-08-24T14:15:22Z",
"type": "text",
"reference": "string",
"media": {
"type": "audio",
"url": "string"
}
}
Message of Media type.
Properties
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | BroadcastMessageDestination | false | none | Broadcast message destination fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | MessageCommon | false | none | Common message fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | object | false | none | none |
| » media | object | true | none | none |
| »» type | string | true | none | none |
| »» url | string(url) | true | none | none |
Enumerated Values
| Property | Value |
|---|---|
| type | audio |
| type | document |
| type | image |
| type | video |
BroadcastMessageTemplate
{
"destination": [
"string"
],
"source": "string",
"scheduled": "2019-08-24T14:15:22Z",
"type": "text",
"reference": "string",
"template": {
"name": "string",
"language": "en_US",
"header_params": [
"string"
],
"body_params": [
"string"
],
"media": {
"type": "string",
"url": "string"
},
"buttons": [
{
"index": 0,
"type": "string",
"payload": "string"
}
]
}
}
Message of Template type.
Properties
allOf
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | BroadcastMessageDestination | false | none | Broadcast message destination fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | MessageCommon | false | none | Common message fields. |
and
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | object | false | none | none |
| » template | object | true | none | none |
| »» name | string(none) | true | none | none |
| »» language | string(none) | true | none | none |
| »» header_params | [string] | false | none | none |
| »» body_params | [string] | false | none | none |
| »» media | object | false | none | none |
| »»» type | string(none) | false | none | none |
| »»» url | string(url) | false | none | none |
| »» buttons | [object] | false | none | none |
| »»» index | number(int32) | false | none | none |
| »»» type | string(none) | false | none | none |
| »»» payload | string(none) | false | none | none |
StatusCallback
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"reference": "string",
"status": "accepted"
}
Status callback structure.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string(uuid) | false | none | none |
| reference | string(none) | false | none | none |
| status | string | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| status | accepted |
| status | submitted |
| status | sent |
| status | received |
| status | read |
| status | frozen |
| status | rejected |
| status | failed |
| status | dead |
| status | expired |
ReplyCallback
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"source": "string",
"destination": "string",
"content": {
"type": "audio",
"audio": {
"id": "string",
"mime_type": "image/png"
},
"button": {
"payload": "string",
"text": "string"
},
"document": {
"caption": "string",
"filename": "string",
"sha256": "string",
"id": "string",
"mime_type": "image/png"
},
"image": {
"caption": "string",
"sha256": "string",
"id": "string",
"mime_type": "image/png"
},
"sticker": {
"sha256": "string",
"id": "string",
"mime_type": "image/png"
},
"text": {
"body": "string",
"preview_url": "string"
},
"video": {
"caption": "string",
"filename": "string",
"sha256": "string",
"id": "string",
"mime_type": "image/png"
}
}
}
Reply callback structure.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string(uuid) | false | none | none |
| source | string(none) | false | none | The customer number |
| destination | string(none) | false | none | The business number |
| content | ReplyCallbackContent | false | none | Reply callback content encoded as a JSON string. |
ReplyCallbackContent
{
"type": "audio",
"audio": {
"id": "string",
"mime_type": "image/png"
},
"button": {
"payload": "string",
"text": "string"
},
"document": {
"caption": "string",
"filename": "string",
"sha256": "string",
"id": "string",
"mime_type": "image/png"
},
"image": {
"caption": "string",
"sha256": "string",
"id": "string",
"mime_type": "image/png"
},
"sticker": {
"sha256": "string",
"id": "string",
"mime_type": "image/png"
},
"text": {
"body": "string",
"preview_url": "string"
},
"video": {
"caption": "string",
"filename": "string",
"sha256": "string",
"id": "string",
"mime_type": "image/png"
}
}
Reply callback content encoded as a JSON string.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| type | string | false | none | none |
| audio | object | false | none | none |
| » id | string(none) | false | none | none |
| » mime_type | MediaMimeType | false | none | Supported media mime types. |
| button | object | false | none | none |
| » payload | string(none) | false | none | none |
| » text | string(none) | false | none | none |
| document | object | false | none | none |
| » caption | string(none) | false | none | none |
| » filename | string(none) | false | none | none |
| » sha256 | string(none) | false | none | none |
| » id | string(none) | false | none | none |
| » mime_type | MediaMimeType | false | none | Supported media mime types. |
| image | object | false | none | none |
| » caption | string(none) | false | none | none |
| » sha256 | string(none) | false | none | none |
| » id | string(none) | false | none | none |
| » mime_type | MediaMimeType | false | none | Supported media mime types. |
| sticker | object | false | none | none |
| » sha256 | string(none) | false | none | none |
| » id | string(none) | false | none | none |
| » mime_type | MediaMimeType | false | none | Supported media mime types. |
| text | object | false | none | none |
| » body | string(none) | false | none | none |
| » preview_url | string(none) | false | none | none |
| video | object | false | none | none |
| » caption | string(none) | false | none | none |
| » filename | string(none) | false | none | none |
| » sha256 | string(none) | false | none | none |
| » id | string(none) | false | none | none |
| » mime_type | MediaMimeType | false | none | Supported media mime types. |
Enumerated Values
| Property | Value |
|---|---|
| type | audio |
| type | button |
| type | document |
| type | image |
| type | sticker |
| type | text |
| type | video |
MessageDetails
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"status": "accepted",
"timestamp": 9223372036854776000,
"direction": "string",
"type": "text",
"attributes": {
"header": "string",
"media": {
"id": "string",
"type": "image"
},
"body": "string",
"footer": "string",
"buttons": [
{
"text": "string"
}
]
}
}
Message details structure.
Properties
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| id | string(uuid) | false | none | none |
| status | string | false | none | none |
| timestamp | integer(int64) | false | none | none |
| direction | string(string) | false | none | none |
| type | string | false | none | none |
| attributes | object | false | none | none |
| » header | string(string) | false | none | none |
| » media | object | false | none | none |
| »» id | string(string) | false | none | none |
| »» type | string | false | none | none |
| » body | string(string) | false | none | none |
| » footer | string(string) | false | none | none |
| » buttons | [object] | false | none | none |
| »» text | string(string) | false | none | none |
Enumerated Values
| Property | Value |
|---|---|
| status | accepted |
| status | submitted |
| status | sent |
| status | received |
| status | read |
| status | frozen |
| status | rejected |
| status | failed |
| status | dead |
| status | expired |
| type | text |
| type | template |
| type | media |
| type | image |
| type | audio |
| type | video |
| type | document |