Send A Text Message
Requiresmessages.send scope. Use either sender_phone or sender_number_id.
curl -X POST "https://{tenant}.sinjapp.org/api/v1/messages" \
-H "X-Api-Key: {tenant_api_key}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"sender_phone": "{sender_phone}",
"to_phone": "{recipient_phone}",
"type": "text",
"content": "Hello from Sinjapp Business"
}'
const response = await fetch('https://{tenant}.sinjapp.org/api/v1/messages', {
method: 'POST',
headers: {
'X-Api-Key': tenantApiKey,
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
sender_phone: senderPhone,
to_phone: recipientPhone,
type: 'text',
content: 'Hello from Sinjapp Business',
}),
})
const message = await response.json()
<?php
$response = file_get_contents('https://{tenant}.sinjapp.org/api/v1/messages', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => [
'X-Api-Key: ' . $tenantApiKey,
'Accept: application/json',
'Content-Type: application/json',
],
'content' => json_encode([
'sender_phone' => $senderPhone,
'to_phone' => $recipientPhone,
'type' => 'text',
'content' => 'Hello from Sinjapp Business',
]),
'timeout' => 30,
],
]));
$message = json_decode($response, true);
import requests
response = requests.post(
"https://{tenant}.sinjapp.org/api/v1/messages",
headers={
"X-Api-Key": tenant_api_key,
"Accept": "application/json",
"Content-Type": "application/json",
},
json={
"sender_phone": sender_phone,
"to_phone": recipient_phone,
"type": "text",
"content": "Hello from Sinjapp Business",
},
timeout=30,
)
message = response.json()
Send Media
For images, documents, and voice files, usemultipart/form-data with the media field. Supported message types are image, voice, and document.
curl -X POST "https://{tenant}.sinjapp.org/api/v1/messages" \
-H "X-Api-Key: {tenant_api_key}" \
-H "Accept: application/json" \
-F "sender_phone={sender_phone}" \
-F "to_phone={recipient_phone}" \
-F "type=image" \
-F "content=Image caption" \
-F "media=@/path/to/image.png"
const formData = new FormData()
formData.append('sender_phone', senderPhone)
formData.append('to_phone', recipientPhone)
formData.append('type', 'image')
formData.append('content', 'Image caption')
formData.append('media', file)
const response = await fetch('https://{tenant}.sinjapp.org/api/v1/messages', {
method: 'POST',
headers: {
'X-Api-Key': tenantApiKey,
'Accept': 'application/json',
},
body: formData,
})
const message = await response.json()
<?php
$client = curl_init('https://{tenant}.sinjapp.org/api/v1/messages');
curl_setopt_array($client, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'X-Api-Key: ' . $tenantApiKey,
'Accept: application/json',
],
CURLOPT_POSTFIELDS => [
'sender_phone' => $senderPhone,
'to_phone' => $recipientPhone,
'type' => 'image',
'content' => 'Image caption',
'media' => new CURLFile('/path/to/image.png'),
],
]);
$message = json_decode(curl_exec($client), true);
curl_close($client);
import requests
with open("/path/to/image.png", "rb") as media:
response = requests.post(
"https://{tenant}.sinjapp.org/api/v1/messages",
headers={
"X-Api-Key": tenant_api_key,
"Accept": "application/json",
},
data={
"sender_phone": sender_phone,
"to_phone": recipient_phone,
"type": "image",
"content": "Image caption",
},
files={"media": media},
timeout=30,
)
message = response.json()
Read Message Logs
Requiresmessages.read scope.
curl "https://{tenant}.sinjapp.org/api/v1/messages" \
-H "X-Api-Key: {tenant_api_key}" \
-H "Accept: application/json"
const response = await fetch('https://{tenant}.sinjapp.org/api/v1/messages', {
headers: {
'X-Api-Key': tenantApiKey,
'Accept': 'application/json',
},
})
const messages = await response.json()
<?php
$response = file_get_contents('https://{tenant}.sinjapp.org/api/v1/messages', false, stream_context_create([
'http' => [
'method' => 'GET',
'header' => [
'X-Api-Key: ' . $tenantApiKey,
'Accept: application/json',
],
'timeout' => 30,
],
]));
$messages = json_decode($response, true);
import requests
response = requests.get(
"https://{tenant}.sinjapp.org/api/v1/messages",
headers={
"X-Api-Key": tenant_api_key,
"Accept": "application/json",
},
timeout=30,
)
messages = response.json()