Send message
curl --request POST \
--url https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "212612345678",
"content": "Hello",
"type": "text",
"file": {
"mimetype": "image/png",
"filename": "photo.png",
"url": "https://example.com/photo.png"
},
"location": {
"latitude": 33.5731,
"longitude": -7.5898
}
}
'import requests
url = "https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message"
payload = {
"phone": "212612345678",
"content": "Hello",
"type": "text",
"file": {
"mimetype": "image/png",
"filename": "photo.png",
"url": "https://example.com/photo.png"
},
"location": {
"latitude": 33.5731,
"longitude": -7.5898
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '212612345678',
content: 'Hello',
type: 'text',
file: {
mimetype: 'image/png',
filename: 'photo.png',
url: 'https://example.com/photo.png'
},
location: {latitude: 33.5731, longitude: -7.5898}
})
};
fetch('https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone' => '212612345678',
'content' => 'Hello',
'type' => 'text',
'file' => [
'mimetype' => 'image/png',
'filename' => 'photo.png',
'url' => 'https://example.com/photo.png'
],
'location' => [
'latitude' => 33.5731,
'longitude' => -7.5898
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message"
payload := strings.NewReader("{\n \"phone\": \"212612345678\",\n \"content\": \"Hello\",\n \"type\": \"text\",\n \"file\": {\n \"mimetype\": \"image/png\",\n \"filename\": \"photo.png\",\n \"url\": \"https://example.com/photo.png\"\n },\n \"location\": {\n \"latitude\": 33.5731,\n \"longitude\": -7.5898\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"212612345678\",\n \"content\": \"Hello\",\n \"type\": \"text\",\n \"file\": {\n \"mimetype\": \"image/png\",\n \"filename\": \"photo.png\",\n \"url\": \"https://example.com/photo.png\"\n },\n \"location\": {\n \"latitude\": 33.5731,\n \"longitude\": -7.5898\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"212612345678\",\n \"content\": \"Hello\",\n \"type\": \"text\",\n \"file\": {\n \"mimetype\": \"image/png\",\n \"filename\": \"photo.png\",\n \"url\": \"https://example.com/photo.png\"\n },\n \"location\": {\n \"latitude\": 33.5731,\n \"longitude\": -7.5898\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "Operation completed successfully."
}{
"message": "The given data was invalid.",
"errors": {}
}Sessions
Send message
Send a WhatsApp message to a phone number using the selected session.
POST
/
sessions
/
{sessionId}
/
send-message
Send message
curl --request POST \
--url https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "212612345678",
"content": "Hello",
"type": "text",
"file": {
"mimetype": "image/png",
"filename": "photo.png",
"url": "https://example.com/photo.png"
},
"location": {
"latitude": 33.5731,
"longitude": -7.5898
}
}
'import requests
url = "https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message"
payload = {
"phone": "212612345678",
"content": "Hello",
"type": "text",
"file": {
"mimetype": "image/png",
"filename": "photo.png",
"url": "https://example.com/photo.png"
},
"location": {
"latitude": 33.5731,
"longitude": -7.5898
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
phone: '212612345678',
content: 'Hello',
type: 'text',
file: {
mimetype: 'image/png',
filename: 'photo.png',
url: 'https://example.com/photo.png'
},
location: {latitude: 33.5731, longitude: -7.5898}
})
};
fetch('https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone' => '212612345678',
'content' => 'Hello',
'type' => 'text',
'file' => [
'mimetype' => 'image/png',
'filename' => 'photo.png',
'url' => 'https://example.com/photo.png'
],
'location' => [
'latitude' => 33.5731,
'longitude' => -7.5898
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message"
payload := strings.NewReader("{\n \"phone\": \"212612345678\",\n \"content\": \"Hello\",\n \"type\": \"text\",\n \"file\": {\n \"mimetype\": \"image/png\",\n \"filename\": \"photo.png\",\n \"url\": \"https://example.com/photo.png\"\n },\n \"location\": {\n \"latitude\": 33.5731,\n \"longitude\": -7.5898\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"212612345678\",\n \"content\": \"Hello\",\n \"type\": \"text\",\n \"file\": {\n \"mimetype\": \"image/png\",\n \"filename\": \"photo.png\",\n \"url\": \"https://example.com/photo.png\"\n },\n \"location\": {\n \"latitude\": 33.5731,\n \"longitude\": -7.5898\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://backend-dev.wabsync.com/api/v1/sessions/{sessionId}/send-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"212612345678\",\n \"content\": \"Hello\",\n \"type\": \"text\",\n \"file\": {\n \"mimetype\": \"image/png\",\n \"filename\": \"photo.png\",\n \"url\": \"https://example.com/photo.png\"\n },\n \"location\": {\n \"latitude\": 33.5731,\n \"longitude\": -7.5898\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "Operation completed successfully."
}{
"message": "The given data was invalid.",
"errors": {}
}Authorizations
Enter your API token in the format: Bearer {token}
Path Parameters
Example:
"123e4567-e89b-12d3-a456-426614174000"
Body
application/json
Response
Message sent
Example:
"Operation completed successfully."
⌘I