0% found this document useful (0 votes)
11 views

Wa API v2 Push Notification

Uploaded by

Hasimy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Wa API v2 Push Notification

Uploaded by

Hasimy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

OCA WHATSAPP API V2

GUIDE (Push Notification)

Gedung IndiHome Fiber


Jl. Kebon Sirih No.36, Menteng
Jakarta Pusat 10340
Document Name Author Date Description
API for WA Gateway Ahmad Iswandi 2020/08/12 Refinement

Gedung Indihome Fiber +62 8131 1711 441


Jl. Kebon Sirih No.36, Menteng [email protected]
Jakarta Pusat 10340
Getting Started
This document provides information on how to use Whatsapp Bussiness API, in order to you
send notification and messages to your customers.

OCA Endpoint URL : https://wa01.ocatelkom.co.id

Before You Start


You will need:
• A verified whatsapp bussines account
• A username and password of Oca’s account
• A registered message template (please contact our customer service to register your
template

Response Code
The standard OCA WA API Gateway returns HTTP codes in addition to JSON-based error
codes and success messages

HTTP Status Codes


The OCA WA API Gateway attempts to return the appropriate HTTP Status Codes for every
request.

Code Text Description

200 OK Success

401 Unauthorized Missing or incorrect authentication details.

404 Not Found There is no data available, like user setting etc.

406 Not Acceptable Response when there is invalid format in


request

429 Too Many Returned when a request cannot be served due


Requests to the system's rate limit having been
exhausted for the resource.

500 Internal Server Something is broken. This is usually a


Error temporary error in server

Gedung Indihome Fiber +62 8131 1711 441


Jl. Kebon Sirih No.36, Menteng [email protected]
Jakarta Pusat 10340
Success Messages

A successful message will appear as a response value if the HTTP Status code returns 200
(OK). It has a format like the image below

Error Messages

OCA WA API error messages are returned in JSON Format. Each HTTP Status Code will be
accompanied by descriptive error text and code. For example, an error might occur.

Error Codes

This error codes is additional information to explain what happened when some errors
occurred. The following table describes the code which may appear when working with OCA
WA API Gateway. If an error is not listed in the table, going back to HTTP status codes above
in order to determine the best way to address the issues.

Gedung Indihome Fiber +62 8131 1711 441


Jl. Kebon Sirih No.36, Menteng [email protected]
Jakarta Pusat 10340
Code Text Description

5 low-balance Indicating that your account has no enough


balance left

9 Too Many Due to the api rate limit, you have to wait until
Request Code the currently window expires, the default api
rate limit is in 25 request per seconds. You can
check http headers response in order to know
the remaining limit of your request.
• X-RateLimit-limit : the rate limit of
endpoint
• X-RateLimit-Remaining : the number of
request left
• X-RateLimit-Reset: the remaining
window before the rate limit resets

13 Internal Error Corresponds with HTTP 500. An unknown


internal error occured

19 Missing Corresponds with HTTP 401. It indicates


Authorization Authorization header is not set properly
Header

33 Data doesn’t Corresponds with HTTP 404. The certain data


exist is not found

39 [object] Corresponds with HTTP 406. There are


incorrects or missing parameter in request
body, it is like the message_value is not same
as the template message

43 Auth token is Corresponds with HTTP 401. It indicates


not supplied Authorization header is not set properly

45 Auth token is Corresponds with HTTP 401. It indicates


not valid Authorization token is not valid

59 Whatsapp Corresponds with HTTP 406. Your message


Template template doesn’t exist
doesn't exist
Code

Gedung Indihome Fiber +62 8131 1711 441


Jl. Kebon Sirih No.36, Menteng [email protected]
Jakarta Pusat 10340
Authorization
OCA WA API provides authorization method for you to access our resources, we primarily use
JSON Web Token (JWT). We will provide you the JWT token

Gedung Indihome Fiber +62 8131 1711 441


Jl. Kebon Sirih No.36, Menteng [email protected]
Jakarta Pusat 10340
Sending Message Template
You can use POST /api/v2/push/message endpoint to send message template to your
customers. In order to use this feature, you need to create message template. You can request
message template to our customer service. Message template holds your text message and
you can put dynamic data to get more personalize message, like Hi {{name}}, how are you
today? Etc

Gedung Indihome Fiber +62 8131 1711 441


Jl. Kebon Sirih No.36, Menteng [email protected]
Jakarta Pusat 10340
Sending Media Message Template
You can use POST /api/v2/push/message endpoint to send message template to your
customers. In order to use this feature, you need to create message template. You can request
message template to our customer service. With this media message template, you can send
media like image, video & document along with your message text.

Gedung Indihome Fiber +62 8131 1711 441


Jl. Kebon Sirih No.36, Menteng [email protected]
Jakarta Pusat 10340
The main object

Name Required Description

phone_number Yes Destination of phone number


Values: country code + phone number
(+6281381475159, 6281381475159)

message Yes Contain all message information body

The message object

Name Required Description

type Yes The type of your message


Values: template

template Yes Contain template information

The template object

Name Required Description

template_code_id Yes The registered template message, you will be


given the template code id for your requested
template
Values: template code id

payload Yes Contain array of information for specific


template

Gedung Indihome Fiber +62 8131 1711 441


Jl. Kebon Sirih No.36, Menteng [email protected]
Jakarta Pusat 10340
The payload object

Name Required Description

position Yes Describe the position type


Values: header | body

parameters Yes Array containing the content of each position


type

The body parameters object

Name Required Description

type Yes Describe the type for parameters


Values: text

text Yes Contain value of text

Gedung Indihome Fiber +62 8131 1711 441


Jl. Kebon Sirih No.36, Menteng [email protected]
Jakarta Pusat 10340
The header parameters object

Name Required Description

type Yes Describe the type value


Values: text | image | video | document

text Yes, when The value of text


“type” : “text”

image Yes, when Media object containing image


“type” : “image”

video Yes, when Media object containing video


“type” : “video”

document Yes, when Media object containing video


“type” :
“document”

The image, video & document object

Name Required Description

url Yes The protocol and URL of the media to be


sent. Use only with HTTP/HTTPS URLs.

Gedung Indihome Fiber +62 8131 1711 441


Jl. Kebon Sirih No.36, Menteng [email protected]
Jakarta Pusat 10340
Check Message Status
The status of message can be grabbed through this endpoint GET
/api/v2/message/{{msgid}}/status. There are 4 types of status that you can get from this
endpoint submitted, delivered, read, failed/rejected.

Gedung Indihome Fiber +62 8131 1711 441


Jl. Kebon Sirih No.36, Menteng [email protected]
Jakarta Pusat 10340

You might also like