Curl
PHP
Node.js
JavaScript
Python
Java
Ruby
VB.NET
C#
Go
C
Clojure
Dart
Swift
Objective-C
PowerShell
Shell
curl -X POST http://<tu-host>:3000/api/send-message \
-H 'Content-Type: application/json' \
-d '{
"instanceId":33,
"token":"TOKEN",
"to":"+573001112233",
"type":"text",
"message":"Hola 👋"
}'
<?php
$ch = curl_init('http://<tu-host>:3000/api/send-message');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'instanceId' => 33,
'token' => 'TOKEN',
'to' => '+573001112233',
'type' => 'text',
'message' => 'Hola 👋'
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_exec($ch);
?>
import fetch from 'node-fetch';
fetch('http://<tu-host>:3000/api/send-message', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ instanceId:33, token:'TOKEN', to:'+573001112233', type:'text', message:'Hola 👋' })
});
fetch('http://<tu-host>:3000/api/send-message', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ instanceId:33, token:'TOKEN', to:'+573001112233', type:'text', message:'Hola 👋' })
});
import requests
requests.post('http://<tu-host>:3000/api/send-message',
json={'instanceId':33,'token':'TOKEN','to':'+573001112233','type':'text','message':'Hola 👋'})
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://<tu-host>:3000/api/send-message"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{\"instanceId\":33,\"token\":\"TOKEN\",\"to\":\"+573001112233\",\"type\":\"text\",\"message\":\"Hola 👋\"}"))
.build();
client.send(request, HttpResponse.BodyHandlers.ofString());
require 'net/http'
require 'json'
Net::HTTP.post URI('http://<tu-host>:3000/api/send-message'),
{instanceId:33, token:'TOKEN', to:'+573001112233', type:'text', message:'Hola 👋'}.to_json,
"Content-Type" => "application/json"
Imports System.Net
Imports System.Text
Dim data = "{\"instanceId\":33,\"token\":\"TOKEN\",\"to\":\"+573001112233\",\"type\":\"text\",\"message\":\"Hola 👋\"}"
Dim client As New WebClient()
client.Headers(HttpRequestHeader.ContentType) = "application/json"
client.UploadString("http://<tu-host>:3000/api/send-message", data)
using var client = new HttpClient();
var content = new StringContent("{\"instanceId\":33,\"token\":\"TOKEN\",\"to\":\"+573001112233\",\"type\":\"text\",\"message\":\"Hola 👋\"}", Encoding.UTF8, "application/json");
await client.PostAsync("http://<tu-host>:3000/api/send-message", content);
package main
import ("bytes"; "net/http")
func main() {
http.Post("http://<tu-host>:3000/api/send-message", "application/json",
bytes.NewBuffer([]byte(`{"instanceId":33,"token":"TOKEN","to":"+573001112233","type":"text","message":"Hola 👋"}`)))
}
#include <curl/curl.h>
int main(){
CURL *curl = curl_easy_init();
if(curl){
const char *data = "{\"instanceId\":33,\"token\":\"TOKEN\",\"to\":\"+573001112233\",\"type\":\"text\",\"message\":\"Hola 👋\"}";
curl_easy_setopt(curl, CURLOPT_URL, "http://<tu-host>:3000/api/send-message");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
return 0;
}
(require '[clj-http.client :as client])
(client/post "http://<tu-host>:3000/api/send-message"
{:headers {"Content-Type" "application/json"}
:body "{\"instanceId\":33,\"token\":\"TOKEN\",\"to\":\"+573001112233\",\"type\":\"text\",\"message\":\"Hola 👋\"}"})
import 'package:http/http.dart' as http;
void main() {
http.post(Uri.parse('http://<tu-host>:3000/api/send-message'),
headers:{'Content-Type':'application/json'},
body:'{"instanceId":33,"token":"TOKEN","to":"+573001112233","type":"text","message":"Hola 👋"}');
}
import Foundation
let url = URL(string: "http://<tu-host>:3000/api/send-message")!
var req = URLRequest(url: url)
req.httpMethod = "POST"
req.addValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = "{\"instanceId\":33,\"token\":\"TOKEN\",\"to\":\"+573001112233\",\"type\":\"text\",\"message\":\"Hola 👋\"}".data(using: .utf8)
URLSession.shared.dataTask(with: req).resume()
#import <Foundation/Foundation.h>
int main(){
NSURL *url = [NSURL URLWithString:@"http://<tu-host>:3000/api/send-message"];
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
req.HTTPMethod = @"POST";
[req addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
req.HTTPBody = [@"{\"instanceId\":33,\"token\":\"TOKEN\",\"to\":\"+573001112233\",\"type\":\"text\",\"message\":\"Hola 👋\"}" dataUsingEncoding:NSUTF8StringEncoding];
[[[NSURLSession sharedSession] dataTaskWithRequest:req] resume];
return 0;
}
Invoke-RestMethod -Uri http://<tu-host>:3000/api/send-message -Method Post -Body '{"instanceId":33,"token":"TOKEN","to":"+573001112233","type":"text","message":"Hola 👋"}' -ContentType 'application/json'
wget --method=POST --header='Content-Type: application/json' \
--body-data='{"instanceId":33,"token":"TOKEN","to":"+573001112233","type":"text","message":"Hola 👋"}' \
http://<tu-host>:3000/api/send-message
Acepta
+E.164
, solo dígitos (10–15) o JID (@c.us
/@g.us
). Si envías dígitos, lo normalizamos a JID.