<?php

$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 => "token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId=",
  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

$request = new HttpRequest();
$request->setUrl('https://api.ultramsg.com/{INSTANCE_ID}/messages/chat');
$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;
}
<?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.ultramsg.com/{INSTANCE_ID}/messages/chat');
$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();
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());
  });
});

req.write(qs.stringify({
  token: '{TOKEN}',
  to: '{TO}',
  body: '{BODY}',
  priority: '{PRIORITY}',
  referenceId: ''
}));
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: '{TO}',
    body: '{BODY}',
    priority: '{PRIORITY}',
    referenceId: ''
  }
};

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": "{TO}",
  "body": "{BODY}",
  "priority": "{PRIORITY}",
  "referenceId": ""
});

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

  console.log(res.body);
});
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat",
  "method": "POST",
  "headers": {},
  "data": {
    "token": "{TOKEN}",
    "to": "{TO}",
    "body": "{BODY}",
    "priority": "{PRIORITY}",
    "referenceId": ""
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
import http.client

conn = http.client.HTTPSConnection("api.ultramsg.com")

payload = "token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId="

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={TO}&body={BODY}&priority={PRIORITY}&referenceId="
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 'token={TOKEN}' \
  --data 'to={TO}' \
  --data 'body={BODY}' \
  --data 'priority={PRIORITY}' \
  --data 'referenceId='
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId=");
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();
HttpResponse<String> response = Unirest.post("https://api.ultramsg.com/{INSTANCE_ID}/messages/chat")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId=")
  .asString();
require 'uri'
require 'net/http'
require 'openssl'

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

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 = "token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId="

response = http.request(request)
puts response.read_body
var client = new RestClient("https://api.ultramsg.com/{INSTANCE_ID}/messages/chat");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("undefined", "token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId=", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
package main

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

func main() {

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

	payload := strings.NewReader("token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId=")

	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))

}
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={TO}&body={BODY}&priority={PRIORITY}&referenceId=");

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

(client/post "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat" {:form-params {:token "{TOKEN}"
                                                                                       :to "{TO}"
                                                                                       :body "{BODY}"
                                                                                       :priority "{PRIORITY}"
                                                                                       :referenceId ""}})
#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.ultramsg.com/{INSTANCE_ID}/messages/chat"]
                                                       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];
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "https://api.ultramsg.com/{INSTANCE_ID}/messages/chat" in
let body = Cohttp_lwt_body.of_string "token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId=" in

Client.call ~body `POST uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
[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 -ContentType 'undefined' -Body 'token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId='
[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 -ContentType 'undefined' -Body 'token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId='
curl --request POST \
  --url https://api.ultramsg.com/{INSTANCE_ID}/messages/chat \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'token={TOKEN}' \
  --data 'to={TO}' \
  --data 'body={BODY}' \
  --data 'priority={PRIORITY}' \
  --data 'referenceId='
http --form POST https://api.ultramsg.com/{INSTANCE_ID}/messages/chat \
  content-type:application/x-www-form-urlencoded \
  token='{TOKEN}' \
  to='{TO}' \
  body='{BODY}' \
  priority='{PRIORITY}' \
  referenceId=''
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.ultramsg.com/{INSTANCE_ID}/messages/chat
POST /{INSTANCE_ID}/messages/chat HTTP/1.1
Host: api.ultramsg.com
Content-Length: 99

token={TOKEN}&to={TO}&body={BODY}&priority={PRIORITY}&referenceId=