WhatsAPP Business API

Send / Receive messages, images, audio and video through WhatsAPP in an automated way by API

  • HTTP API, Send Voice from any programming language.
  • Official API, We work with the official Facebook API
  • 99.9% SLA, We optimize the performance of all servers.
  • Maximum Connectivity, Compatible with any mobile with WhatsAPP
WhatsAPP Business API

Programming languages

Click on the programming language and access examples to integrate the WhatsAPP Business API just by copying and pasting

WhatsAPP Business API functionalities

Send a message by WhatsAPP

API method that allows you to send a message via WhatsAPP to a recipient.
Parameter Description Compulsory / Optional
class=whatsapp Class requested: Class to which the request is made Compulsory
method=sendmessage Class method requested: Method of the class to which the request is made Compulsory
user User and e-mail of your Afilnet account Compulsory
password Password of your Afilnet account Compulsory
platformid Platform identifier Compulsory
destination whatsapp.sendmessage_destination Compulsory
message whatsapp.sendmessage_message Compulsory

Answer:

  • status
  • result (if status=success), here you will receive the following values:
    • No additional values will be sent to you
  • error (if status=error), here you will receive the error code

Error codes:

Code Description
MISSING_USER User or email not included
MISSING_PASSWORD Password not included
MISSING_CLASS Class not included
MISSING_METHOD Method not included
MISSING_COMPULSORY_PARAM Compulsory parameter not included
INCORRECT_USER_PASSWORD Incorrect user or password
INCORRECT_CLASS Incorrect class
INCORRECT_METHOD Incorrect method
CHANNEL_NOT_FOUND The indicated channel does not exist

Parameters:

  • class : whatsapp
  • method : sendmessage
  • user : user
  • password : password
  • platformid : 100
  • destination : 3460000000
  • message : test+message

Request:

https://www.afilnet.com/api/http/?class=whatsapp&method=sendmessage&user=user&password=password&platformid=100&destination=3460000000&message=test+message

Send a file by WhatsAPP

API method that allows you to send a file via WhatsAPP to a recipient.
Parameter Description Compulsory / Optional
class=whatsapp Class requested: Class to which the request is made Compulsory
method=sendfile Class method requested: Method of the class to which the request is made Compulsory
user User and e-mail of your Afilnet account Compulsory
password Password of your Afilnet account Compulsory
platformid Platform identifier Compulsory
destination whatsapp.sendfile_destination Compulsory
type whatsapp.sendfile_type Compulsory
fileurl whatsapp.sendfile_fileurl Compulsory
thumburl whatsapp.sendfile_thumburl Optional
message whatsapp.sendfile_message Optional

Answer:

  • status
  • result (if status=success), here you will receive the following values:
    • No additional values will be sent to you
  • error (if status=error), here you will receive the error code

Error codes:

Code Description
MISSING_USER User or email not included
MISSING_PASSWORD Password not included
MISSING_CLASS Class not included
MISSING_METHOD Method not included
MISSING_COMPULSORY_PARAM Compulsory parameter not included
INCORRECT_USER_PASSWORD Incorrect user or password
INCORRECT_CLASS Incorrect class
INCORRECT_METHOD Incorrect method
CHANNEL_NOT_FOUND The indicated channel does not exist
CHAT_NOT_FOUND The indicated chat does not exist
INCORRECT_FILETYPE The file type is wrong, check the possible values
INCORRECT_FILEURL The file url is not valid
INCORRECT_THUMBURL The url of the thumbnail is invalid

Parameters:

  • class : whatsapp
  • method : sendfile
  • user : user
  • password : password
  • platformid : 100
  • destination : 3460000000
  • type : image
  • fileurl : https://www.example.com/image.jpg
  • thumburl : https://www.example.com/thumb.jpg
  • message : test+message

Request:

https://www.afilnet.com/api/http/?class=whatsapp&method=sendfile&user=user&password=password&platformid=100&destination=3460000000&type=image&fileurl=https://www.example.com/image.jpg&thumburl=https://www.example.com/thumb.jpg&message=test+message

Send a template message via WhatsAPP

API method that allows a templated message via WhatsAPP to a recipient.
Parameter Description Compulsory / Optional
class=whatsapp Class requested: Class to which the request is made Compulsory
method=sendmessagefromtemplate Class method requested: Method of the class to which the request is made Compulsory
user User and e-mail of your Afilnet account Compulsory
password Password of your Afilnet account Compulsory
idtemplate Template identifier Compulsory
platformid Platform identifier Compulsory
destination Recipient of the message (Number in international format) Compulsory
options The options allow you to parameterize and configure the message to be sent (See Annex). Optional

Answer:

  • status
  • result (if status=success), here you will receive the following values:
    • No additional values will be sent to you
  • error (if status=error), here you will receive the error code

Error codes:

Code Description
MISSING_USER User or email not included
MISSING_PASSWORD Password not included
MISSING_CLASS Class not included
MISSING_METHOD Method not included
MISSING_COMPULSORY_PARAM Compulsory parameter not included
INCORRECT_USER_PASSWORD Incorrect user or password
INCORRECT_CLASS Incorrect class
INCORRECT_METHOD Incorrect method
CHANNEL_NOT_FOUND The indicated channel does not exist

Parameters:

  • class : whatsapp
  • method : sendmessagefromtemplate
  • user : user
  • password : password
  • idtemplate : 100
  • platformid : 100
  • destination : 3460000000
  • options : {"header":{"file":"url"}}

Request:

https://www.afilnet.com/api/http/?class=whatsapp&method=sendmessagefromtemplate&user=user&password=password&idtemplate=100&platformid=100&destination=3460000000&options={"header":{"file":"url"}}

Get a list of WhatsAPP conversations

API method that allows you to get a list of WhatsAPP conversations.
Parameter Description Compulsory / Optional
class=whatsapp Class requested: Class to which the request is made Compulsory
method=getchats Class method requested: Method of the class to which the request is made Compulsory
user User and e-mail of your Afilnet account Compulsory
password Password of your Afilnet account Compulsory
platformid Platform identifier Compulsory

Answer:

  • status
  • result (if status=success), here you will receive the following values:
    • list
      • platformid
      • message
      • destination
      • messageid
      • sent
      • status
      • datetime
  • error (if status=error), here you will receive the error code

Error codes:

Code Description
MISSING_USER User or email not included
MISSING_PASSWORD Password not included
MISSING_CLASS Class not included
MISSING_METHOD Method not included
MISSING_COMPULSORY_PARAM Compulsory parameter not included
INCORRECT_USER_PASSWORD Incorrect user or password
INCORRECT_CLASS Incorrect class
INCORRECT_METHOD Incorrect method
CHANNEL_NOT_FOUND The indicated channel does not exist
CHAT_NOT_FOUND The indicated chat does not exist

Parameters:

  • class : whatsapp
  • method : getchats
  • user : user
  • password : password
  • platformid : 100

Request:

https://www.afilnet.com/api/http/?class=whatsapp&method=getchats&user=user&password=password&platformid=100

Get a list of WhatsAPP messages

API method that allows you to get the list of WhatsAPP messages.
Parameter Description Compulsory / Optional
class=whatsapp Class requested: Class to which the request is made Compulsory
method=getmessages Class method requested: Method of the class to which the request is made Compulsory
user User and e-mail of your Afilnet account Compulsory
password Password of your Afilnet account Compulsory
platformid Platform identifier Compulsory
destination Recipient from which you want to obtain the messages Compulsory

Answer:

  • status
  • result (if status=success), here you will receive the following values:
    • list
      • platformid
      • message
      • destination
      • messageid
      • sent
      • status
      • datetime
  • error (if status=error), here you will receive the error code

Error codes:

Code Description
MISSING_USER User or email not included
MISSING_PASSWORD Password not included
MISSING_CLASS Class not included
MISSING_METHOD Method not included
MISSING_COMPULSORY_PARAM Compulsory parameter not included
INCORRECT_USER_PASSWORD Incorrect user or password
INCORRECT_CLASS Incorrect class
INCORRECT_METHOD Incorrect method
CHANNEL_NOT_FOUND The indicated channel does not exist
CHAT_NOT_FOUND The indicated chat does not exist

Parameters:

  • class : whatsapp
  • method : getmessages
  • user : user
  • password : password
  • platformid : 100
  • destination : 34600000000

Request:

https://www.afilnet.com/api/http/?class=whatsapp&method=getmessages&user=user&password=password&platformid=100&destination=34600000000

Get a list of unread messages from a WhatsAPP chat

API method that allows you to obtain the list of unread messages from a WhatsAPP.
Parameter Description Compulsory / Optional
class=whatsapp Class requested: Class to which the request is made Compulsory
method=getunreadmessages Class method requested: Method of the class to which the request is made Compulsory
user User and e-mail of your Afilnet account Compulsory
password Password of your Afilnet account Compulsory
platformid Platform identifier Compulsory
destination Recipient from which you want to obtain the messages Compulsory

Answer:

  • status
  • result (if status=success), here you will receive the following values:
    • list
      • platformid
      • message
      • destination
      • messageid
      • issent
      • status
      • datetime
  • error (if status=error), here you will receive the error code

Error codes:

Code Description
MISSING_USER User or email not included
MISSING_PASSWORD Password not included
MISSING_CLASS Class not included
MISSING_METHOD Method not included
MISSING_COMPULSORY_PARAM Compulsory parameter not included
INCORRECT_USER_PASSWORD Incorrect user or password
INCORRECT_CLASS Incorrect class
INCORRECT_METHOD Incorrect method
CHANNEL_NOT_FOUND The indicated channel does not exist
CHAT_NOT_FOUND The indicated chat does not exist

Parameters:

  • class : whatsapp
  • method : getunreadmessages
  • user : user
  • password : password
  • platformid : 100
  • destination : 34600000000

Request:

https://www.afilnet.com/api/http/?class=whatsapp&method=getunreadmessages&user=user&password=password&platformid=100&destination=34600000000



ANNEX: Additional options in Messages

In this annex you will learn how to send messages from your templates. WhatsAPP templates allow you to send more elaborate messages than text messages, allowing you to attach files, as well as include buttons in your messages.

Options

The options allow you to send interactive messages, attach images, videos, documents and share locations via WhatsApp. To do this, here you will learn how to customize the "options" parameter. The "options" parameter must be a string in JSON format following the following specifications:

Main parameters
header Details about the message header (optional)
params Values to the different values of the template (optional)
Example
{"header":"", "params": ""}

Define the header

Defining a header will allow you to attach different files and services to your WhatsAPP messages

Send an image
file Image URL (Allowed formats: JPG, PNG, WEBP)
The file must be uploaded to the internet and be accessible through a URL
Send a Video
file Video URL (Allowed formats: MP4, MPEG, 3GP)
The file must be uploaded to the internet and be accessible through a URL
Send a Document
file Document URL (Allowed formats: TXT, PDF, PPT, DOC, DOCX, XLS, PPTX, XLSX)
The file must be uploaded to the internet and be accessible through a URL
Send a Location
file Latitude and longitude with the format: (0.0000, 0.0000)
location
name Location name
address Location address

Define the parameters

Using parameters will allow you to customize your templates to each recipient, allowing information related to the recipient to be included in the message. Some examples of this information would be: Personal data, Data related to your account, Tracking information, etc.

JSON example: {"params":{"name":"John", "orderid": "10"}}

Valid JSON Examples

Send a message with custom parameters

In this example we are going to send a parameterized message.

Template message with parameters: Dear {{name}}, your order with ID: {{orderid}} has left our warehouses
JSON example: {"params":{"name":"John", "orderid": "10"}}

Send an image

In this example we are going to use a template that has an image as its header.

JSON example: {"header":{"file":"https:\/\/test.com\/test.jpg"}}

Send an Image and message with custom parameters

In this example we are going to use a template that has an image as its header. We attach an image with the tracking number.

Template message with parameters: Dear {{name}}, your order with ID: {{orderid}} has left our warehouses
JSON example: {"header":{"file":"https:\/\/test.com\/test.jpg"}, "params":{"name":"John", "orderid": "10"}}

Send a Video

In this example we are going to use a template that has a video as a header.

JSON example: {"header":{"file":"https:\/\/test.com\/test.mp4"}}

Send a Document

In this example we are going to use a template that has a document as a header.

JSON example: {"header":{"file":"https:\/\/test.com\/test.mp4"}}

Send a Location

In this example we are going to use a template that has a location as its header.

JSON example: {"header":{"file":"(LATITUDE, LONGITUDE)","location":{"name":"NAME","address":"ADDRESS"}}}

Tools that enhance our WhatsApp Business API

SECURE API CONNECTION

SECURE API CONNECTION

Security tailored to your business

Configure your API connections, create new accesses and manage existing ones.

Filter all API accesses by IP, add or remove enabled IPs to guarantee the security of your accesses.

Keep track of all connections made, API used and connection dates / time

MULTIPLE APIs

MULTIPLE APIs

Connectivity tailored to your business

We offer you multiple APIs to connect with us, we have an HTTP API, BASIC AUTH, SOAP and JWT Authentication so that you can connect with us the way you want.

Connect with any of the APIs in a secure, simple and centralized way . Afilnet API is perfect for your software.

API Logs

API Logs

Get to know each request in detail

Thanks to our logs you will be able to review all the requests made and the corresponding response from our API, which will allow you to consult details when you need them.

The information you can consult is the following:

  • Source IP of the request
  • Date & Time of the request
  • API & Method being called
  • Parameters sent to the API
  • API response
  • metadata

Steps to use WhatsApp Business API

Follow the steps to access WhatsApp Business API

01

Register as a client

You need to be registered as a customer in order to obtain credentials to use the WhatsAPP Business API . Once you are registered, you can make the requests you need to our API.

02

Check your business on Facebook

To be able to use the WhatsAPP Business API, it is essential to have a verified business profile on Facebook. You can find more information on Facebook Business

03

Acquire WhatsAPP Business

Contact us so that we can provide you with a virtual number for WhatsAPP Business, see the service rates on our rates page.

04

Integrate WhatsAPP Business

Use the API methods that we offer and integrate with WhatsAPP Business Afilnet services

WhatsAPP Business API service features

Automate WhatsAPP

Automate WhatsAPP

Automate notifications by WhatsAPP through API
Audio, Images, Videos and Documents

Audio, Images, Videos and Documents

Receive and / or send the files you need through WhatsAPP Business API.
Management of contacts and talks

Management of contacts and talks

Manage your contacts and conversations on WhatsAPP with our API.
Send cloud services by WhatsAPP

Send cloud services by WhatsAPP

Send files to the cloud through WhatsAPP, attach surveys, contracts and much more.
White list security

White list security

Enable white lists and allow connections only from the included IPs.
Multiple accesses per account

Multiple accesses per account

You can create as many users to connect to the API with the same account as you want.
Subaccounts

Subaccounts

Create sub-accounts for other companies or departments with their own API connection and balance.
Free API

Free API

You can make use of the API without limitations and for free, you only pay for the use of the services.

WhatsAPP Business API FAQ

Here you will find the most common questions we have received about the WhatsAPP Business API service.

Through WhatsAPP Business API you will be able to receive all WhatsAPP messages sent to your account, reply to them and initiate conversations with messages based on templates pre-authorized by WhatsAPP.

You can only send WhatsAPP to users who have previously allowed to be contacted by this channel and only using messages based on previously authorized templates.

You can have as many active Chats by WhatsAPP as you need, as long as you meet the requirements established by WhatsAPP.

In the WhatsAPP Business API service you pay for the active channels for WhatsAPP, you will only pay a monthly fee per active WhatsAPP Business number and the price per conversation (unlimited chats with one recipient for 24 hours), you can consult more information on our page rates.

Try Afilnet for free!

Sign up for free and try Afilnet! We offer you a free trial of our services. *



(*) Promotion only valid for companies that have never used the Afilnet service before. When requesting the free balance, Afilnet may request to verify your company information


Bulk SMS · Email Marketing · Social network · Instant messaging · Certification · and much more
Continue IMPORTANT INFORMATION ABOUT COOKIES: If you continue to use this web we will assume that you accept the terms of use. You will find more information in our Cookies Policy.
Payment methods
Wire transfer
Credit card
Paypal
Western Union
Skrill
Crypto
Afilnet in your language

Copyright © 2024 Afilnet · All rights reserved