<?php
$curl = curl_init();
curl_setopt_array($curl , array (
CURLOPT_URL => "https://api.whatmsg.com/msg" ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 30 ,
CURLOPT_SSL_VERIFYHOST => 0 ,
CURLOPT_SSL_VERIFYPEER => 0 ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST" ,
CURLOPT_POSTFIELDS => "apikey=APIKEY&from=SENDER-WHATSAPP-PHONE-NUMER&to=WHATSAPP-PHONE-NUMBER&msgbody=MESSAGE" ,
CURLOPT_HTTPHEADER => array (
"content-type: application/x-www-form-urlencoded"
),
));
$response = curl_exec($curl );
$err = curl_error($curl );
curl_close($curl );
if ($err ) {
echo "cURL Error #:" . $err ;
} else {
echo $response ;
}
Copy
<?php
$request = new HttpRequest();
$request ->setUrl('https://api.whatmsg.com/msg' );
$request ->setMethod(HTTP_METH_POST);
$request ->setHeaders(array (
'content-type' => 'application/x-www-form-urlencoded'
));
$request ->setContentType('application/x-www-form-urlencoded' );
$request ->setPostFields(array (
'token' => '{TOKEN}' ,
'to' => '{TO}' ,
'body' => '{BODY}' ,
'priority' => '{PRIORITY}' ,
'referenceId' => ''
));
try {
$response = $request ->send();
echo $response ->getBody();
} catch (HttpException $ex ) {
echo $ex ;
}
Copy
function SendMassage() {
const re= UrlFetchApp.fetch('https://api.whatmsg.com/msg' ,{
method:'POST',
headers:{
'Accept': 'application/json',
'Content-Type': 'application/json'
},
payload:JSON.stringify({
apikey:"APIKEY",
from:"=SENDER-WHATSAPP-PHONE-NUMER",
to:"RECEIVE-WHATSAPP-PHONE-NUMBER",
msgbody:"MASSAGE"
})
})
var data = JSON.parse(re.getContentText());
Logger.log(data)
}
Copy
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body ->append(new http\QueryString(array (
'token' => '{TOKEN}' ,
'to' => '{TO}' ,
'body' => '{BODY}' ,
'priority' => '{PRIORITY}' ,
'referenceId' => ''
)));
$request ->setRequestUrl('https://api.whatmsg.com/msg' );
$request ->setRequestMethod('POST' );
$request ->setBody($body );
$request ->setHeaders(array (
'content-type' => 'application/x-www-form-urlencoded'
));
$client ->enqueue($request )->send();
$response = $client ->getResponse();
echo $response ->getBody();
Copy
var qs = require ("querystring" );
var http = require ("https" );
var options = {
"method" : "POST" ,
"hostname" : "api.whatmsg.com" ,
"port" : null ,
"path" : "/mensaje" ,
"headers" : {
"content-type" : "application/x-www-form-urlencoded"
}
};
var req = http.request (options, function (res ) {
var chunks = [];
res.on ("data" , function (chunk ) {
chunks.push (chunk);
});
res.on ("end" , function ( ) {
var body = Buffer .concat (chunks);
console .log (body.toString ());
});
});
req.write (qs.stringify ({
token : '{TOKEN}' ,
to : '{TO}' ,
body : '{BODY}' ,
priority : '{PRIORITY}' ,
referenceId : ''
}));
req.end ();
Copy
var request = require ("request" );
var options = {
method : 'POST' ,
url : 'https://api.whatmsg.com/msg' ,
headers : {'content-type' : 'application/x-www-form-urlencoded' },
form : {
token : '{TOKEN}' ,
to : '{TO}' ,
body : '{BODY}' ,
priority : '{PRIORITY}' ,
referenceId : ''
}
};
request (options, function (error, response, body ) {
if (error) throw new Error (error);
console .log (body);
});
Copy
var unirest = require ("unirest" );
var req = unirest ("POST" , "https://api.whatmsg.com/msg" );
req.headers ({
"content-type" : "application/x-www-form-urlencoded"
});
req.form ({
"token" : "{TOKEN}" ,
"to" : "{TO}" ,
"body" : "{BODY}" ,
"priority" : "{PRIORITY}" ,
"referenceId" : ""
});
req.end (function (res ) {
if (res.error ) throw new Error (res.error );
console .log (res.body );
});
Copy
var settings = {
"async" : true ,
"crossDomain" : true ,
"url" : "https://api.whatmsg.com/msg" ,
"method" : "POST" ,
"data" : {
"apikey" : "apikevalue" ,
"to" : "whatsapp number receiving msg" //Avoid include "-" or "+" ,
"from" : "whatsapp number sending the massage" ,
"msgbody" : "body of the massage" ,
}
}
$.ajax (settings).done (function (response ) {
console .log (response);
});
Copy
import http.client
conn = http.client.HTTPSConnection("api.whatmsg.com" )
payload = "apikey=APIKEY&from=SENDER-WHATSAPP-PHONE-NUMER&to=WHATSAPP-PHONE-NUMBER&msgbody=MESSAGE"
headers = { 'content-type' : "application/x-www-form-urlencoded" }
conn.request("POST" , "/mensaje" , payload, headers)
res = conn.getresponse()
data = res.read()
print (data.decode("utf-8" ))
Copy
import requests
url = "https://api.whatmsg.com/msg"
payload = "apikey=APIKEY&from=SENDER-WHATSAPP-PHONE-NUMER&to=WHATSAPP-PHONE-NUMBER&msgbody=MESSAGE"
headers = {'content-type' : 'application/x-www-form-urlencoded' }
response = requests.request("POST" , url, data=payload, headers=headers)
print (response.text)
Copy
curl --request POST \
--url https://api.whatmsg.com/msg \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'token={TOKEN}' \
--data 'to={TO}' \
--data 'body={BODY}' \
--data 'priority={PRIORITY}' \
--data 'referenceId='
Copy
OkHttpClient client = new OkHttpClient ();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded" );
RequestBody body = RequestBody.create(mediaType, "apikey=APIKEY&from=SENDER-WHATSAPP-PHONE-NUMER&to=WHATSAPP-PHONE-NUMBER&msgbody=MESSAGE" );
Request request = new Request .Builder()
.url("https://api.whatmsg.com/msg" )
.post(body)
.addHeader("content-type" , "application/x-www-form-urlencoded" )
.build();
Response response = client.newCall(request).execute();
Copy
HttpResponse<String> response = Unirest.post("https://api.whatmsg.com/msg" )
.header("content-type" , "application/x-www-form-urlencoded" )
.body("apikey=APIKEY&from=SENDER-WHATSAPP-PHONE-NUMER&to=WHATSAPP-PHONE-NUMBER&msgbody=MESSAGE" )
.asString();
Copy
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.whatmsg.com/msg" )
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type" ] = 'application/x-www-form-urlencoded'
request.body = "apikey=APIKEY&from=SENDER-WHATSAPP-PHONE-NUMER&to=WHATSAPP-PHONE-NUMBER&msgbody=MESSAGE"
response = http.request(request)
puts response.read_body
Copy
var client = new RestClient("https://api.whatmsg.com/msg" );
var request = new RestRequest(Method.POST);
request.AddHeader("content-type" , "application/x-www-form-urlencoded" );
request.AddParameter("undefined" , "apikey=APIKEY&from=SENDER-WHATSAPP-PHONE-NUMER&to=WHATSAPP-PHONE-NUMBER&msgbody=MESSAGE" , ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Copy
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main () {
url := "https://api.whatmsg.com/msg"
payload := strings.NewReader("apikey=APIKEY&from=SENDER-WHATSAPP-PHONE-NUMER&to=WHATSAPP-PHONE-NUMBER&msgbody=MESSAGE" )
req, _ := http.NewRequest("POST" , url, payload)
req.Header.Add("content-type" , "application/x-www-form-urlencoded" )
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string (body))
}
Copy
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST" );
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.whatmsg.com/msg" );
struct curl_slist *headers = NULL ;
headers = curl_slist_append(headers, "content-type: application/x-www-form-urlencoded" );
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "apikey=APIKEY&from=SENDER-WHATSAPP-PHONE-NUMER&to=WHATSAPP-PHONE-NUMBER&msgbody=MESSAGE" );
CURLcode ret = curl_easy_perform(hnd);
Copy
(require '[clj-http.client :as client])
(client/post "https://api.whatmsg.com/msg" {:form-params {:token "{TOKEN}"
:to "{TO}"
:body "{BODY}"
:priority "{PRIORITY}"
:referenceId "" }})
Copy
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"content-type" : @"application/x-www-form-urlencoded" };
NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"token={TOKEN}" dataUsingEncoding:NSUTF8StringEncoding ]];
[postData appendData:[@"&to={TO}" dataUsingEncoding:NSUTF8StringEncoding ]];
[postData appendData:[@"&body={BODY}" dataUsingEncoding:NSUTF8StringEncoding ]];
[postData appendData:[@"&priority={PRIORITY}" dataUsingEncoding:NSUTF8StringEncoding ]];
[postData appendData:[@"&referenceId=" dataUsingEncoding:NSUTF8StringEncoding ]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.whatmsg.com/msg" ]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0 ];
[request setHTTPMethod:@"POST" ];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog (@"%@" , error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog (@"%@" , httpResponse);
}
}];
[dataTask resume];
Copy
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri .of_string "https://api.whatmsg.com/msg" in
let body = Cohttp_lwt_body .of_string "apikey=APIKEY&from=SENDER-WHATSAPP-PHONE-NUMER&to=WHATSAPP-PHONE-NUMBER&msgbody=MESSAGE" in
Client .call ~body `POST uri
>>= fun (res, body_stream) ->
Copy
$headers =@{}
$headers .Add("content-type" , "application/x-www-form-urlencoded" )
$response = Invoke-WebRequest -Uri 'https://api.whatmsg.com/msg' -Method POST -Headers $headers -ContentType 'undefined' -Body 'token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId='
Copy
$headers =@{}
$headers .Add("content-type" , "application/x-www-form-urlencoded" )
$response = Invoke-RestMethod -Uri 'https://api.whatmsg.com/msg' -Method POST -Headers $headers -ContentType 'undefined' -Body 'token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId='
Copy
curl --request POST \
--url https://api.whatmsg.com/msg \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'token={TOKEN}' \
--data 'to={TO}' \
--data 'body={BODY}' \
--data 'priority={PRIORITY}' \
--data 'referenceId='
Copy
http --form POST https://api.whatmsg.com/msg \
content-type:application/x-www-form-urlencoded \
token='{TOKEN}' \
to='{TO}' \
body='{BODY}' \
priority='{PRIORITY}' \
referenceId=''
Copy
wget --quiet \
--method POST \
--header 'content-type: application/x-www-form-urlencoded' \
--body-data 'token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId=' \
--output-document \
- https://api.whatmsg.com/msg
Copy
POST /mensaje HTTP/1.1
Host: api.whatmsg.com
Content-Length: 99
token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId=
Copy