NAV Navigation
Shell HTTP JavaScript Node.js Ruby Python Java Go PHP

Modica WhatsApp Business Messaging API v1.2.0

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 Modica WhatsApp Business Messaging API

Base URLs:

Terms of service Email: API Support Web: API Support License: Modica API - Terms Of Use

Authentication

messages

WhatsApp Messaging endpoints.

PostMessages

Code samples

# You can also use wget
curl -X POST https://api.modicagroup.com/rest/wab/v1/messages \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST https://api.modicagroup.com/rest/wab/v1/messages HTTP/1.1
Host: api.modicagroup.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "to": "+64123456789",
  "type": "text",
  "text": {
    "body": "Hello"
  }
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('https://api.modicagroup.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",
  "text": {
    "body": "Hello"
  }
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('https://api.modicagroup.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'
}

result = RestClient.post 'https://api.modicagroup.com/rest/wab/v1/messages',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://api.modicagroup.com/rest/wab/v1/messages', headers = headers)

print(r.json())

URL obj = new URL("https://api.modicagroup.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"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.modicagroup.com/rest/wab/v1/messages", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/json',
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.modicagroup.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

Send a message to a customer.

Body parameter

{
  "to": "+64123456789",
  "type": "text",
  "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": 500,
  "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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
4XX X-RateLimit-Limit integer int32 Requests per second limit.

Callbacks

messageCallback

{$statusCallbackUrl}

PostMessages

Code samples

# You can also use wget
curl -X POST https://api.modicagroup.com/rest/wab/v1/messages \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST https://api.modicagroup.com/rest/wab/v1/messages HTTP/1.1
Host: api.modicagroup.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'
};

fetch('https://api.modicagroup.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'
};

fetch('https://api.modicagroup.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'
}

result = RestClient.post 'https://api.modicagroup.com/rest/wab/v1/messages',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://api.modicagroup.com/rest/wab/v1/messages', headers = headers)

print(r.json())

URL obj = new URL("https://api.modicagroup.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"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.modicagroup.com/rest/wab/v1/messages", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/json',
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.modicagroup.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": 500,
  "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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
4XX X-RateLimit-Limit integer int32 Requests per second limit.

{$replyCallbackUrl}

PostMessages

Code samples

# You can also use wget
curl -X POST https://api.modicagroup.com/rest/wab/v1/messages \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST https://api.modicagroup.com/rest/wab/v1/messages HTTP/1.1
Host: api.modicagroup.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'
};

fetch('https://api.modicagroup.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'
};

fetch('https://api.modicagroup.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'
}

result = RestClient.post 'https://api.modicagroup.com/rest/wab/v1/messages',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://api.modicagroup.com/rest/wab/v1/messages', headers = headers)

print(r.json())

URL obj = new URL("https://api.modicagroup.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"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.modicagroup.com/rest/wab/v1/messages", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/json',
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.modicagroup.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": 500,
  "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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
4XX X-RateLimit-Limit integer int32 Requests per second limit.

PatchMessages

Code samples

# You can also use wget
curl -X PATCH https://api.modicagroup.com/rest/wab/v1/messages \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

PATCH https://api.modicagroup.com/rest/wab/v1/messages HTTP/1.1
Host: api.modicagroup.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "message_id": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('https://api.modicagroup.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'
};

fetch('https://api.modicagroup.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'
}

result = RestClient.patch 'https://api.modicagroup.com/rest/wab/v1/messages',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.patch('https://api.modicagroup.com/rest/wab/v1/messages', headers = headers)

print(r.json())

URL obj = new URL("https://api.modicagroup.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"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PATCH", "https://api.modicagroup.com/rest/wab/v1/messages", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/json',
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PATCH','https://api.modicagroup.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

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": 500,
  "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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
4XX X-RateLimit-Limit integer int32 Requests per second limit.

GetMessages

Code samples

# You can also use wget
curl -X GET https://api.modicagroup.com/rest/wab/v1/messages?id=string \
  -H 'Accept: application/json'

GET https://api.modicagroup.com/rest/wab/v1/messages?id=string HTTP/1.1
Host: api.modicagroup.com
Accept: application/json


const headers = {
  'Accept':'application/json'
};

fetch('https://api.modicagroup.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'
};

fetch('https://api.modicagroup.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'
}

result = RestClient.get 'https://api.modicagroup.com/rest/wab/v1/messages',
  params: {
  'id' => '[Uuid](#schemauuid)'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.modicagroup.com/rest/wab/v1/messages', params={
  'id': 'string'
}, headers = headers)

print(r.json())

URL obj = new URL("https://api.modicagroup.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"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.modicagroup.com/rest/wab/v1/messages", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.modicagroup.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 message by message ID

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",
  "reference": "abcd-1234-xyz-987",
  "application_id": "wab_customer_a",
  "status": "received",
  "business_number_id": "102046588645210",
  "customer_number_id": "64123456789",
  "timestamp": 123456789,
  "direction": "MT",
  "type": "text",
  "attributes": {
    "body": "The body of the message"
  }
}

401 Response

{
  "message": "Whatsapp Cloud API error",
  "statusCode": 401,
  "error": "unauthorized error message"
}

429 Response

{
  "message": "Whatsapp Cloud API error",
  "statusCode": 500,
  "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 Message response structure. MessageDetails
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
4XX X-RateLimit-Limit integer int32 Requests per second limit.

messages_broadcast_post

Code samples

# You can also use wget
curl -X POST https://api.modicagroup.com/rest/wab/v1/messages/broadcast \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST https://api.modicagroup.com/rest/wab/v1/messages/broadcast HTTP/1.1
Host: api.modicagroup.com
Content-Type: application/json
Accept: application/json

const inputBody = '{
  "destination": [
    "+64123456789",
    "+64223456789"
  ],
  "type": "text",
  "text": {
    "body": "Hello"
  }
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('https://api.modicagroup.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",
    "+64223456789"
  ],
  "type": "text",
  "text": {
    "body": "Hello"
  }
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('https://api.modicagroup.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'
}

result = RestClient.post 'https://api.modicagroup.com/rest/wab/v1/messages/broadcast',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://api.modicagroup.com/rest/wab/v1/messages/broadcast', headers = headers)

print(r.json())

URL obj = new URL("https://api.modicagroup.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"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.modicagroup.com/rest/wab/v1/messages/broadcast", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/json',
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.modicagroup.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

Send a broadcast message to customers.

Body parameter

{
  "destination": [
    "+64123456789",
    "+64223456789"
  ],
  "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"
  }
]

401 Response

{
  "message": "Whatsapp Cloud API error",
  "statusCode": 401,
  "error": "unauthorized error message"
}

429 Response

{
  "message": "Whatsapp Cloud API error",
  "statusCode": 500,
  "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
401 Unauthorized Unauthorized access error. 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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.

Callbacks

messageCallback

{$statusCallbackUrl}

messages_broadcast_post

Code samples

# You can also use wget
curl -X POST https://api.modicagroup.com/rest/wab/v1/messages/broadcast \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST https://api.modicagroup.com/rest/wab/v1/messages/broadcast HTTP/1.1
Host: api.modicagroup.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'
};

fetch('https://api.modicagroup.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'
};

fetch('https://api.modicagroup.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'
}

result = RestClient.post 'https://api.modicagroup.com/rest/wab/v1/messages/broadcast',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://api.modicagroup.com/rest/wab/v1/messages/broadcast', headers = headers)

print(r.json())

URL obj = new URL("https://api.modicagroup.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"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.modicagroup.com/rest/wab/v1/messages/broadcast", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/json',
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.modicagroup.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": 500,
  "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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.

{$replyCallbackUrl}

messages_broadcast_post

Code samples

# You can also use wget
curl -X POST https://api.modicagroup.com/rest/wab/v1/messages/broadcast \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST https://api.modicagroup.com/rest/wab/v1/messages/broadcast HTTP/1.1
Host: api.modicagroup.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'
};

fetch('https://api.modicagroup.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'
};

fetch('https://api.modicagroup.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'
}

result = RestClient.post 'https://api.modicagroup.com/rest/wab/v1/messages/broadcast',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('https://api.modicagroup.com/rest/wab/v1/messages/broadcast', headers = headers)

print(r.json())

URL obj = new URL("https://api.modicagroup.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"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.modicagroup.com/rest/wab/v1/messages/broadcast", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/json',
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.modicagroup.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": 500,
  "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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.

media

WhatsApp Media endpoints.

PostMedia

Code samples

# You can also use wget
curl -X POST https://api.modicagroup.com/rest/wab/v1/media \
  -H 'Content-Type: multipart/form-data' \
  -H 'Accept: application/json'

POST https://api.modicagroup.com/rest/wab/v1/media HTTP/1.1
Host: api.modicagroup.com
Content-Type: multipart/form-data
Accept: application/json

const inputBody = '{
  "file": "string"
}';
const headers = {
  'Content-Type':'multipart/form-data',
  'Accept':'application/json'
};

fetch('https://api.modicagroup.com/rest/wab/v1/media',
{
  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'
};

fetch('https://api.modicagroup.com/rest/wab/v1/media',
{
  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'
}

result = RestClient.post 'https://api.modicagroup.com/rest/wab/v1/media',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'multipart/form-data',
  'Accept': 'application/json'
}

r = requests.post('https://api.modicagroup.com/rest/wab/v1/media', headers = headers)

print(r.json())

URL obj = new URL("https://api.modicagroup.com/rest/wab/v1/media");
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"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.modicagroup.com/rest/wab/v1/media", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'multipart/form-data',
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.modicagroup.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

uploading media

Body parameter

file: string

Parameters

Name In Type Required Description
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": 500,
  "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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
4XX X-RateLimit-Limit integer int32 Requests per second limit.

GetMedia

Code samples

# You can also use wget
curl -X GET https://api.modicagroup.com/rest/wab/v1/media?media_id=string \
  -H 'Accept: application/octet-stream'

GET https://api.modicagroup.com/rest/wab/v1/media?media_id=string HTTP/1.1
Host: api.modicagroup.com
Accept: application/octet-stream


const headers = {
  'Accept':'application/octet-stream'
};

fetch('https://api.modicagroup.com/rest/wab/v1/media?media_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/octet-stream'
};

fetch('https://api.modicagroup.com/rest/wab/v1/media?media_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/octet-stream'
}

result = RestClient.get 'https://api.modicagroup.com/rest/wab/v1/media',
  params: {
  'media_id' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/octet-stream'
}

r = requests.get('https://api.modicagroup.com/rest/wab/v1/media', params={
  'media_id': 'string'
}, headers = headers)

print(r.json())

URL obj = new URL("https://api.modicagroup.com/rest/wab/v1/media?media_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/octet-stream"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.modicagroup.com/rest/wab/v1/media", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/octet-stream',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.modicagroup.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

downloading media

Download message media.

Parameters

Name In Type Required Description
media_id query string true The ID for the media item.

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": 500,
  "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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
4XX X-RateLimit-Limit integer int32 Requests per second limit.

status

WhatsApp Status endpoints.

GetHealthz

Code samples

# You can also use wget
curl -X GET https://api.modicagroup.com/rest/wab/v1/healthz \
  -H 'Accept: application/json'

GET https://api.modicagroup.com/rest/wab/v1/healthz HTTP/1.1
Host: api.modicagroup.com
Accept: application/json


const headers = {
  'Accept':'application/json'
};

fetch('https://api.modicagroup.com/rest/wab/v1/healthz',
{
  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'
};

fetch('https://api.modicagroup.com/rest/wab/v1/healthz',
{
  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'
}

result = RestClient.get 'https://api.modicagroup.com/rest/wab/v1/healthz',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.modicagroup.com/rest/wab/v1/healthz', headers = headers)

print(r.json())

URL obj = new URL("https://api.modicagroup.com/rest/wab/v1/healthz");
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"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.modicagroup.com/rest/wab/v1/healthz", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

 'application/json',
);

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.modicagroup.com/rest/wab/v1/healthz', 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 /healthz

Check the health of the API

Check the health of the API

Example responses

401 Response

{
  "message": "Whatsapp Cloud API error",
  "statusCode": 401,
  "error": "unauthorized error message"
}

429 Response

{
  "message": "Whatsapp Cloud API error",
  "statusCode": 500,
  "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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
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 X-RateLimit-Limit integer int32 Requests per second limit.
4XX X-RateLimit-Limit integer int32 Requests per second limit.

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 false 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

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

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",
  "reference": "string",
  "application_id": "string",
  "status": "accepted",
  "business_number_id": "string",
  "customer_number_id": "string",
  "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
reference string(string) false none none
application_id string(string) false none none
status string false none none
business_number_id string(none) false none none
customer_number_id string(none) 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