Send Message
curl --request POST \
--url https://swiftchats.axis96.xyz/api/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"phone": "+254720055819",
"message": "Hello John, how are you?",
"header": "Test header",
"footer": "Test footer",
"buttons": [
{
"id": "fine_1",
"title": "I'm fine"
},
{
"id": "bad_2",
"title": "I'm not well"
}
]
}
EOFimport requests
url = "https://swiftchats.axis96.xyz/api/send"
payload = {
"phone": "+254720055819",
"message": "Hello John, how are you?",
"header": "Test header",
"footer": "Test footer",
"buttons": [
{
"id": "fine_1",
"title": "I'm fine"
},
{
"id": "bad_2",
"title": "I'm not well"
}
]
}
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: '+254720055819',
message: 'Hello John, how are you?',
header: 'Test header',
footer: 'Test footer',
buttons: [{id: 'fine_1', title: 'I\'m fine'}, {id: 'bad_2', title: 'I\'m not well'}]
})
};
fetch('https://swiftchats.axis96.xyz/api/send', 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://swiftchats.axis96.xyz/api/send",
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' => '+254720055819',
'message' => 'Hello John, how are you?',
'header' => 'Test header',
'footer' => 'Test footer',
'buttons' => [
[
'id' => 'fine_1',
'title' => 'I\'m fine'
],
[
'id' => 'bad_2',
'title' => 'I\'m not well'
]
]
]),
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://swiftchats.axis96.xyz/api/send"
payload := strings.NewReader("{\n \"phone\": \"+254720055819\",\n \"message\": \"Hello John, how are you?\",\n \"header\": \"Test header\",\n \"footer\": \"Test footer\",\n \"buttons\": [\n {\n \"id\": \"fine_1\",\n \"title\": \"I'm fine\"\n },\n {\n \"id\": \"bad_2\",\n \"title\": \"I'm not well\"\n }\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://swiftchats.axis96.xyz/api/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"+254720055819\",\n \"message\": \"Hello John, how are you?\",\n \"header\": \"Test header\",\n \"footer\": \"Test footer\",\n \"buttons\": [\n {\n \"id\": \"fine_1\",\n \"title\": \"I'm fine\"\n },\n {\n \"id\": \"bad_2\",\n \"title\": \"I'm not well\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://swiftchats.axis96.xyz/api/send")
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\": \"+254720055819\",\n \"message\": \"Hello John, how are you?\",\n \"header\": \"Test header\",\n \"footer\": \"Test footer\",\n \"buttons\": [\n {\n \"id\": \"fine_1\",\n \"title\": \"I'm fine\"\n },\n {\n \"id\": \"bad_2\",\n \"title\": \"I'm not well\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 200,
"data": {
"success": true,
"data": {
"messaging_product": "whatsapp",
"contacts": [
{
"input": "254720055819",
"wa_id": "254720055819"
}
],
"messages": [
{
"id": "wamid.HBgMMjU0NzIwMDU1ODE5FQIAERgSQjY3NEYwN0RENzM2REVDNkIzAA=="
}
],
"chat": {
"id": 78,
"uuid": "43065393-3505-43b7-be89-11e1329e41be",
"organization_id": 7,
"wam_id": "wamid.HBgMMjU0NzIwMDU1ODE5FQIAERgSQjY3NEYwN0RENzM2REVDNkIzAA==",
"contact_id": 13,
"type": "outbound",
"metadata": "{\"text\":{\"body\":\"Hello John, how are you?\"},\"type\":\"text\"}",
"media_id": null,
"status": "delivered",
"deleted_by": null,
"deleted_at": null,
"created_at": "2024-04-12 12:08:48",
"contact": {
"id": 13,
"uuid": "b4eaafb6-12d5-457e-9a53-124f30075dfa",
"organization_id": 7,
"first_name": null,
"last_name": null,
"phone": "254720055819",
"email": null,
"avatar": null,
"address": null,
"contact_group_id": null,
"is_favorite": 0,
"created_by": 0,
"created_at": null,
"updated_at": null,
"deleted_at": null,
"full_name": " "
},
"media": null
}
}
}
}Messages
Send Message
API POST /api/send
This endpoint allows you to send a message to a specified phone number.
Request Body
phone(string, required): The phone number to which the message will be sent.message(string, required): The content of the message to be sent.
Response
- Status: 404
- Content-Type: text/html
The response will be a 404 Not Found error if the requested resource is not available.
Example Response
{
"statusCode": 0,
"data": {
"success": true,
"data": {
"messaging_product": "",
"contacts": [
{
"input": "",
"wa_id": ""
}
],
"messages": [
{
"id": ""
}
],
"chat": {
"id": 0,
"uuid": "",
"organization_id": 0,
"wam_id": "",
"contact_id": 0,
"type": "",
"metadata": "",
"media_id": null,
"status": "",
"deleted_by": null,
"deleted_at": null,
"created_at": "",
"contact": {
"id": 0,
"uuid": "",
"organization_id": 0,
"first_name": null,
"last_name": null,
"phone": "",
"email": null,
"avatar": null,
"address": null,
"contact_group_id": null,
"is_favorite": 0,
"created_by": 0,
"created_at": null,
"updated_at": null,
"deleted_at": null,
"full_name": ""
},
"media": null
}
}
}
}
POST
/
api
/
send
Send Message
curl --request POST \
--url https://swiftchats.axis96.xyz/api/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"phone": "+254720055819",
"message": "Hello John, how are you?",
"header": "Test header",
"footer": "Test footer",
"buttons": [
{
"id": "fine_1",
"title": "I'm fine"
},
{
"id": "bad_2",
"title": "I'm not well"
}
]
}
EOFimport requests
url = "https://swiftchats.axis96.xyz/api/send"
payload = {
"phone": "+254720055819",
"message": "Hello John, how are you?",
"header": "Test header",
"footer": "Test footer",
"buttons": [
{
"id": "fine_1",
"title": "I'm fine"
},
{
"id": "bad_2",
"title": "I'm not well"
}
]
}
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: '+254720055819',
message: 'Hello John, how are you?',
header: 'Test header',
footer: 'Test footer',
buttons: [{id: 'fine_1', title: 'I\'m fine'}, {id: 'bad_2', title: 'I\'m not well'}]
})
};
fetch('https://swiftchats.axis96.xyz/api/send', 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://swiftchats.axis96.xyz/api/send",
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' => '+254720055819',
'message' => 'Hello John, how are you?',
'header' => 'Test header',
'footer' => 'Test footer',
'buttons' => [
[
'id' => 'fine_1',
'title' => 'I\'m fine'
],
[
'id' => 'bad_2',
'title' => 'I\'m not well'
]
]
]),
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://swiftchats.axis96.xyz/api/send"
payload := strings.NewReader("{\n \"phone\": \"+254720055819\",\n \"message\": \"Hello John, how are you?\",\n \"header\": \"Test header\",\n \"footer\": \"Test footer\",\n \"buttons\": [\n {\n \"id\": \"fine_1\",\n \"title\": \"I'm fine\"\n },\n {\n \"id\": \"bad_2\",\n \"title\": \"I'm not well\"\n }\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://swiftchats.axis96.xyz/api/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"+254720055819\",\n \"message\": \"Hello John, how are you?\",\n \"header\": \"Test header\",\n \"footer\": \"Test footer\",\n \"buttons\": [\n {\n \"id\": \"fine_1\",\n \"title\": \"I'm fine\"\n },\n {\n \"id\": \"bad_2\",\n \"title\": \"I'm not well\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://swiftchats.axis96.xyz/api/send")
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\": \"+254720055819\",\n \"message\": \"Hello John, how are you?\",\n \"header\": \"Test header\",\n \"footer\": \"Test footer\",\n \"buttons\": [\n {\n \"id\": \"fine_1\",\n \"title\": \"I'm fine\"\n },\n {\n \"id\": \"bad_2\",\n \"title\": \"I'm not well\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 200,
"data": {
"success": true,
"data": {
"messaging_product": "whatsapp",
"contacts": [
{
"input": "254720055819",
"wa_id": "254720055819"
}
],
"messages": [
{
"id": "wamid.HBgMMjU0NzIwMDU1ODE5FQIAERgSQjY3NEYwN0RENzM2REVDNkIzAA=="
}
],
"chat": {
"id": 78,
"uuid": "43065393-3505-43b7-be89-11e1329e41be",
"organization_id": 7,
"wam_id": "wamid.HBgMMjU0NzIwMDU1ODE5FQIAERgSQjY3NEYwN0RENzM2REVDNkIzAA==",
"contact_id": 13,
"type": "outbound",
"metadata": "{\"text\":{\"body\":\"Hello John, how are you?\"},\"type\":\"text\"}",
"media_id": null,
"status": "delivered",
"deleted_by": null,
"deleted_at": null,
"created_at": "2024-04-12 12:08:48",
"contact": {
"id": 13,
"uuid": "b4eaafb6-12d5-457e-9a53-124f30075dfa",
"organization_id": 7,
"first_name": null,
"last_name": null,
"phone": "254720055819",
"email": null,
"avatar": null,
"address": null,
"contact_group_id": null,
"is_favorite": 0,
"created_by": 0,
"created_at": null,
"updated_at": null,
"deleted_at": null,
"full_name": " "
},
"media": null
}
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
The body is of type object.
Response
200 - application/json
OK
The response is of type object.
