<?php


$params=array(
'token' => '{TOKEN}',
'to' => '',
'body' => ''
);
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat",
  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 => http_build_query($params),
  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;
}
<?php

require_once 'HTTP/Request2.php';

$params=array(
'token' => '{TOKEN}',
'to' => '',
'body' => ''
);

$request = new HTTP_Request2();

$request->setUrl('https://api.ultramsg.com/{INSTANCE_ID}/messages/chat');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Content-Type' => 'application/x-www-form-urlencoded'
));
$request->addPostParameter($params);
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}
<?php
require 'vendor/autoload.php';

use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\Request;

$params=array(
'token' => '{TOKEN}',
'to' => '',
'body' => ''
);

$client = new Client();
$headers = [
  'Content-Type' => 'application/x-www-form-urlencoded'
];
$options = ['form_params' =>$params ];
$request = new Request('POST', 'https://api.ultramsg.com/{INSTANCE_ID}/messages/chat', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
var qs = require("querystring");
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "api.ultramsg.com",
  "port": null,
  "path": "/{INSTANCE_ID}/messages/chat",
  "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());
  });
});
var postData = qs.stringify({
    "token": "{TOKEN}",
    "to": "",
    "body": ""
});
req.write(postData);
req.end();
var request = require("request");

var options = {
  method: 'POST',
  url: 'https://api.ultramsg.com/{INSTANCE_ID}/messages/chat',
  headers: {'content-type': ' application/x-www-form-urlencoded'},
  form: {
    "token": "{TOKEN}",
    "to": "",
    "body": ""
}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
var unirest = require("unirest");

var req = unirest("POST", "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat");

req.headers({
  "content-type": "application/x-www-form-urlencoded"
});

req.form({
    "token": "{TOKEN}",
    "to": "",
    "body": ""
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
    "token": "{TOKEN}",
    "to": "",
    "body": ""
});

var config = {
  method: 'post',
  url: 'https://api.ultramsg.com/{INSTANCE_ID}/messages/chat',
  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);
});
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat",
  "method": "POST",
  "headers": {},
  "data": {
    "token": "{TOKEN}",
    "to": "",
    "body": ""
}
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

var urlencoded = new URLSearchParams();
urlencoded.append("token","{TOKEN}");
urlencoded.append("to","");
urlencoded.append("body","");


var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: urlencoded,
  redirect: 'follow'
};

fetch("https://api.ultramsg.com/{INSTANCE_ID}/messages/chat", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
var data =  "token={TOKEN}&to=&body=";

var xhr = new XMLHttpRequest();
xhr.withCredentials = false;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(data);
import http.client
import ssl 

conn = http.client.HTTPSConnection("api.ultramsg.com",context = ssl._create_unverified_context())

payload = "token={TOKEN}&to=&body="
payload = payload.encode('utf8').decode('iso-8859-1') 

headers = { 'content-type': "application/x-www-form-urlencoded" }

conn.request("POST", "/{INSTANCE_ID}/messages/chat", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
import requests

url = "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat"

payload = "token={TOKEN}&to=&body="
payload = payload.encode('utf8').decode('iso-8859-1')
headers = {'content-type': 'application/x-www-form-urlencoded'}

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
curl --request POST \
  --url https://api.ultramsg.com/{INSTANCE_ID}/messages/chat \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data-urlencode 'token={TOKEN}' \
 --data-urlencode 'to=' \
 --data-urlencode 'body=' 
OkHttpClient client = new OkHttpClient();
RequestBody body = new FormBody.Builder() 
			.add("token", "{TOKEN}")
			.add("to", "")
			.add("body", "")


            .build();

Request request = new Request.Builder()
  .url("https://api.ultramsg.com/{INSTANCE_ID}/messages/chat")
  .post(body)
  .addHeader("content-type", "application/x-www-form-urlencoded")
  .build();

Response response = client.newCall(request).execute();
 
 System.out.println(response.body().string());
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.ultramsg.com/{INSTANCE_ID}/messages/chat")
  .header("Content-Type", "application/x-www-form-urlencoded") 
			.field("token", "{TOKEN}")
			.field("to", "")
			.field("body", "")

  .asString();
   System.out.println(response.getBody());
require 'uri'
require 'net/http' 

url = URI("https://api.ultramsg.com/{INSTANCE_ID}/messages/chat")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true 

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/x-www-form-urlencoded'
form_data = URI.encode_www_form( {
:token => '{TOKEN}',
:to => '',
:body => ''
})
request.body = form_data

response = http.request(request)
puts response.read_body
Imports System.Net
Imports System.Text

Module example
    Sub Main()  
        Dim WebRequest As HttpWebRequest
        WebRequest = HttpWebRequest.Create("https://api.ultramsg.com/{INSTANCE_ID}/messages/chat")
        Dim postdata As String = "token={TOKEN}&to=&body="
        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
using System;
using System.Threading.Tasks;
using RestSharp;

public class Program
{
    public static async Task Main()
    {

        var url = "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat";
        var client = new RestClient(url);

        var request = new RestRequest(url, Method.Post);    
        request.AddHeader("content-type", "application/x-www-form-urlencoded");
  			request.AddParameter("token", "{TOKEN}");
			request.AddParameter("to", "");
			request.AddParameter("body", "");


        RestResponse response = await client.ExecuteAsync(request);
        var output = response.Content;
        Console.WriteLine(output);
    }
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
    "net/url"
)

func main() {

	apiurl:= "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat"
    data := url.Values{}
    			 data.Set("token", "{TOKEN}")
			 data.Set("to", "")
			 data.Set("body", "")

   
	payload := strings.NewReader(data.Encode())

	req, _ := http.NewRequest("POST", apiurl, 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(string(body))

}
#include <curl/curl.h>

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat");

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, "token={TOKEN}&to=&body=");

CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])

(client/post "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat" {:headers {:content-type "application/x-www-form-urlencoded"}:form-params {
:token "{TOKEN}"
:to ""
:body ""
}
})
import 'package:http/http.dart' as http;


var headers = {
  'Content-Type': 'application/x-www-form-urlencoded'
};
var request = http.Request('POST', Uri.parse('https://api.ultramsg.com/{INSTANCE_ID}/messages/chat'));
request.bodyFields = '{
'token':'{TOKEN}',
'to':'',
'body':''
}';
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}
import Foundation
import Cocoa

let postData = NSMutableData(data: "send=true".data(using: String.Encoding.utf8)!)
postData.append("&token={TOKEN}".data(using: String.Encoding.utf8)!)
postData.append("&to=".data(using: String.Encoding.utf8)!)
postData.append("&body=".data(using: String.Encoding.utf8)!)


let request = NSMutableURLRequest(url: NSURL(string: "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat")! as URL,cachePolicy: .useProtocolCachePolicy,timeoutInterval: 10.0)
request.httpMethod = "POST"
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.ultramsg.com/{INSTANCE_ID}/messages/chat"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];
NSDictionary *headers = @{
  @"Content-Type": @"application/x-www-form-urlencoded"
};

[request setAllHTTPHeaderFields:headers];
NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"send=true" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&token={TOKEN}" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&to=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&body=" dataUsingEncoding:NSUTF8StringEncoding]];

[request setHTTPBody:postData];

[request setHTTPMethod:@"POST"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
[email protected]{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri 'https://api.ultramsg.com/{INSTANCE_ID}/messages/chat' -Method POST -Headers $headers  -Body 'token={TOKEN}&to=&body='
[email protected]{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-RestMethod -Uri 'https://api.ultramsg.com/{INSTANCE_ID}/messages/chat' -Method POST -Headers $headers  -Body 'token={TOKEN}&to=&body='
curl --request POST \
  --url https://api.ultramsg.com/{INSTANCE_ID}/messages/chat \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data-urlencode 'token={TOKEN}' \
 --data-urlencode 'to=' \
 --data-urlencode 'body=' 
http --form POST https://api.ultramsg.com/{INSTANCE_ID}/messages/chat \
  content-type:application/x-www-form-urlencoded \
  	token='{TOKEN}' \
	to='' \
	body='' 
wget --quiet \
  --method POST \
  --header 'content-type:application/x-www-form-urlencoded' \
  --body-data 'token={TOKEN}&to=&body=' \
  --output-document \
  - https://api.ultramsg.com/{INSTANCE_ID}/messages/chat