[ API DOCUMENTATION ]
This documentation will provide instructions on how to quickly integrate whatsapp247.com messaging services into various solutions by using HTTP API. whatsapp247.com API is based on REST standards. In order to interact with our API, any HTTP client in any programming language can be used. Our apis are very strong . You can integrate our api with any kind of software or website . We are offering PHP , Javascript , Python , C# , VB.NET , Java , NodsJS and much more . Our api support single request/multiple request also supported with schedule option.
How to get started
Easy. Only two steps actually:
1. Create an account at whatsapp247.com
In order to use our API, you will need credentials. You will need api_key. These credentails can be obtained by creating an account and then by logging in cutomer portal
Login
2: Scan Qr Code
Scan Qr Code To Connect Your WhatsApp (Scan)
All requests are submitted through the HTTP GET / POST Method
https://whatsapp247.com/api/send.php?api_key=XXX&mobile=923xxxx&priority=0&message=HelloWorld!
Our Postman Collections for WhatsApp API
You can find our api collections on Postman https://documenter.getpostman.com/view/9576087/2s9Ykraevf
Parameters For API
api_key * | Your Api Key (API-KEY) |
mobile * | Phone with international format e.g. 923001234567 |
message * | Text Message |
priority | This parameter is optional, You can use it to create a professional queue for messages The Messages with less priority value are sent first. example of usage : priority = 0: for High priority like OTP messages. priority = 10: used with general messages. priority =20: Non-urgent notifications to your customers. priority =30: Non-urgent promotional offers to your customers. Default value : 10 |
type | 0=Text, 1= Images, 2= Documents Default Value: 0=Text type=1 => send images Supported extensions ( jpg , jpeg , gif , png , svg , webp , bmp ) . Max file size : 3 MB . type=2 => send documents Supported most extensions like ( zip , xlsx , csv , pptx , docx ....etc ) . . Max file size : 3 MB Images & Documents Can be Sent Via A Live URL Path i.e (url=https://sample-url.com/image.jpg) OR Directly Upload From Your System (file=C:/Users/Downloads/sample.jpg) Send Images Sample Code Send Documents Sample Code |
url (optional) | image / documents HTTP Link (URL Address) (if type = 1 or 2)
https://sample-videos.com/img/Sample-jpg-image-50kb.jpg |
file (optional) | use the following parameter file to send a direct file instead of any URL, Example: file=C:/Users/Downloads/sample.jpg |
schedule | Schedule Your Messages schedule=1 schedule_time=2024-10-04 09:16:33 Sample Code |
personalized | Send Customized SMS (Text Data Will Be Change In Each & Every Messages) personalized=1 message=[{"mobile":923101234567,"message":"Hello Ahmad Shahzad"},{"mobile":923011234567,"message":"Hello Ali Ahmad"},{"mobile":923331234567,"message":"Hello Mustafa Kamal"}] Sample Code |
API Sample Codes
php - cURL
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://whatsapp247.com/api/send.php', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => 'api_key=YOUR-SECRET-API-KEY&mobile=923XXX&message=HelloWorld', CURLOPT_HTTPHEADER => array( 'Content-Type: application/x-www-form-urlencoded' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?>
Axios Method
var axios = require('axios'); var qs = require('qs'); var data = qs.stringify({ 'api_key': 'YOUR-SECRET-API-KEY', 'mobile': '923XXXX', 'message': 'HelloWorld' }); var config = { method: 'post', maxBodyLength: Infinity, url: 'https://whatsapp247.com/api/send.php', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, data : data }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); });
jQuery Method
var settings = { "url": "https://whatsapp247.com/api/send.php", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/x-www-form-urlencoded" }, "data": { "api_key": "YOUR-SECRET-API-KEY", "mobile": "923XXXX", "message": "HelloWorld" } }; $.ajax(settings).done(function (response) { console.log(response); });
http.client Method
import http.client conn = http.client.HTTPSConnection("whatsapp247.com") payload = 'api_key=YOUR-SECRET-API-KEY&mobile=923XXXX&message=HelloWorld' headers = { 'Content-Type': 'application/x-www-form-urlencoded' } conn.request("POST", "/api/send.php", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
cURL (Bash)
curl --location --request POST 'https://whatsapp247.com/api/send.php' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'api_key=YOUR-SECRET-API-KEY' \ --data-urlencode 'mobile=923XXXX' \ --data-urlencode 'message=HelloWorld'
OkHttp - Method
OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded"); RequestBody body = RequestBody.create(mediaType, "api_key=YOUR-SECRET-API-KEY&mobile=923XXXX&message=HelloWorld"); Request request = new Request.Builder() .url("https://whatsapp247.com/api/send.php") .method("POST", body) .addHeader("Content-Type", "application/x-www-form-urlencoded") .build(); Response response = client.newCall(request).execute();
VB.NET
Imports System.Net Imports System.Text Module example Sub Main() Dim WebRequest As HttpWebRequest WebRequest = HttpWebRequest.Create("https://whatsapp247.com/api/send.php") Dim postdata As String = "api_key={TOKEN}&mobile=&body=HellowWordld" Dim enc As UTF8Encoding = New System.Text.UTF8Encoding() Dim postdatabytes As Byte() = enc.GetBytes(postdata) WebRequest.Method = "POST" WebRequest.ContentType = "application/x-www-form-urlencoded" WebRequest.GetRequestStream().Write(postdatabytes) 'WebRequest.GetRequestStream().Write(postdatabytes, 0, postdatabytes.Length) Dim ret As New System.IO.StreamReader(WebRequest.GetResponse().GetResponseStream()) console.writeline(ret.ReadToEnd()) End Sub End Module
C# API
var options = new RestClientOptions("https://whatsapp247.com") { MaxTimeout = -1, }; var client = new RestClient(options); var request = new RestRequest("/api/send.php", Method.Post); request.AddHeader("Content-Type", "application/x-www-form-urlencoded"); request.AddParameter("api_key", "YOUR-SECRET-API-KEY"); request.AddParameter("mobile", "923XXXX"); request.AddParameter("message", "HelloWorld"); RestResponse response = await client.ExecuteAsync(request); Console.WriteLine(response.Content);