Wachatbot - Api Documentation v2.2

Prev - Chrome Configuration

Step 1, Install our Google Chrome extension

Step 2, Open Whatsapp Web

Step 3, Scan the QR code with the mobile phone/cell phone with which you are going to send the messages, and be registered in our whatsapp API..

Step 4, Activate "Desktop Notifications" on Whatsapp web tab:

Recommended workflow:

1) With .../message/send send Whatsapp messages.


2) 1 or 2 times a day check the failed shipments through .../message/erroneous, and take the appropriate action with the results: if the number does not exist in whatsapp mark it not to send more, if it was a sending error make a second attempt, etc...


3) 1 or 2 times a day review the list of users registered or unregistered through .../userschanges/get and process them, for example: adding them to lists for future mailings, removing them/ block them so as not to send more, etc...


4) 1 time a day, or every 2 days, we recommend checking the size of the pending message queue to make sure there aren't a lot of them and therefore it's sending them ok, for what you use .../message /pending, is useful to detect if the extension is stopped, Chrome is closed, if the speed at which you are sending messages to our server is much higher than what can be sent by Whatsapp, etc. If the pending queue is filled with many messages, it is useful to use .../message/clear to clear the queue of pending messages from previous days and start sending messages for that day, while solve the problem that caused is congestion

Send Whatsapp

https://app.wachatbot.com:12345/api/message/send

(POST) application/x-www-form-urlencoded

Request Example: targetPhone=34667207231&message=Mensaje&token=XXX-XXX-XXX-XXXXX

Response OK (JSON): {"status" : "success", "message_id": "1234"}

Response Fail (JSON): {"status" : "error", "summary": "..."}

*message_id: es el id. del mensaje, sirve para comprobar si hubo un fallo en le envio

Example Php 7 (file_get_contents)

Example Php 7 (curl_init)

Example Visual Basic

Example VisualFoxPro

Example Curl

Get the total number of Whatsapps sent correctly

https://app.wachatbot.com:12345/api/message/totalsent

(POST) application/x-www-form-urlencoded

Request Example: token=XXX-XXX-XXX-XXXXX

Response OK (JSON): {"count" : 1253}

Response Fail (JSON): {"status" : "error", "summary": "..."}

Example Php 7 (file_get_contents)

Example Php 7 (curl_init)

Example Visual Basic

Example VisualFoxPro

Example Curl

List Messages Send Failed

https://app.wachatbot.com:12345/api/message/erroneous

(POST) application/x-www-form-urlencoded

Request Example: token=XXX-XXX-XXX-XXXXX

Response (JSON): [ { "message_id" : 23, "message_error": "unknown" }, { "message_id" : 19, "message_error": "no_whatsapp_phone" }, { "message_id": 17, "message_error": "no_whatsapp_phone" } ]

* Returns the list of messages that gave some type of error when trying to send them, in case the phone is not a number registered with WhatsApp it returns the error 'no_whatsapp_phone', if not it returns the generic error 'unknown'

Example Php 7 (file_get_contents)

Example Php 7 (curl_init)

Example Visual Basic

Example VisualFoxPro

Example Curl

List Messages Pending Sending

https://app.wachatbot.com:12345/api/message/pending

(POST) application/x-www-form-urlencoded

Request Example: token=XXX-XXX-XXX-XXXXX

Response (JSON): [ { "message_id" : 23 }, { "message_id" : 19 }, { "message_id": 17 } ]

* Returns the list of messages pending to be sent

Example Php 7 (file_get_contents)

Example Php 7 (curl_init)

Example Visual Basic

Example VisualFoxPro

Example Curl

List Users Added/Unsubscribed/Black List

https://app.wachatbot.com/api/userschanges/get

GET (text/plain)

Request Example: https://app.wachatbot.com/api/userschanges/get?date=2019-10-01&token=XXX-XXX-XXX-XXXXX

Response (JSON):

{"contacts":[
{ "phone" : "XXXXXXXXXXX", "status" : "1", "date" : "5/15/2020 4:10:46 PM", "group": "(general)"},
{ "phone" : "XXXXXXXXXXX", "status" : "0", "date" : "4/27/2020 10:19:44 AM"}, "group": ""}
{ "phone" : "XXXXXXXXXXX", "status" : "-1", "date" : "5/27/2020 10:19:44 AM"}, "group": ""}
]}

* Returns the list of users indicating if they sent the message of registration (status = 1) of cancellation (status = 0) or if they were manually added to the blacklist (status = -1) on a date equal to or later than that indicated in the date parameter. It also returns the date (YYYY-MM-DD), time (UTC) in which they did it, and the group in which they registered (in case of status=1). If it was unsubscribed or added to the blacklist, the group name is returned blank.

Example Php 7 (file_get_contents)

Example Php 7 (curl_init)

Example Curl

Block a user from being sent any more messages

https://app.wachatbot.com/api/userschanges/block

GET (text/plain)

Request Example: https://app.wachatbot.com/api/userschanges/block?phone=55555555&token=XXX-XXX-XXX-XXXXX

Response (JSON):

{"contacts":[
{ "phone" : "55555555", "status" : "blocked"},
]}

Example Php 7 (file_get_contents)

Example Php 7 (curl_init)

Example Curl

Clear Pending Messages list

https://app.wachatbot.com:12345/api/message/clear

(POST) application/x-www-form-urlencoded

Request Example: token=XXX-XXX-XXX-XXXXX

Response (JSON): { "status" : "ok" }

* Delete the list of messages pending to be sent

Example Php 7 (file_get_contents)

Example Php 7 (curl_init)

Example Visual Basic

Example VisualFoxPro

Example Curl