Publish to a topic
Publish to a topic #
POST /v1/notify/sendThis call queues the event for every integration attached to the topic and returns right away. Each channel is then delivered asynchronously. Use the same API key as for SMS.
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
topic |
string | Yes | Slug of an active topic (1 to 255 characters). |
messaging
email
sms
mobile_push
web_push
webhook
|
object | array | At least one | Event blocks. Each one is an object, or an array of objects if you want to send several. |
Event block fields
| Block | Required fields | Optional fields |
|---|---|---|
messaging |
platform, content | Slack: channel, username, icon_emoji, icon_url, thread_ts, blocks, attachments. Telegram: chat_id, parse_mode, disable_notification, disable_web_page_preview, message_thread_id, reply_to_message_id |
email |
to, body | subject, text, from, reply_to, cc, bcc, tags, provider |
sms |
to, message | sender_id, sms_type, provider |
mobile_push |
device_token, message | title, priority, collapse_key, provider |
web_push |
channels, event | data, socket_id, provider |
webhook |
— | provider |
Good to know
platformis required in amessagingblock:slackortelegram.- When the topic has several integrations for the same event, add
providerto any other block (for example"resend") to reach only that provider. bodyis the HTML content.subjectdefaults to “Notification”.tois an international number (E.164).sms_typeisTransactionalorPromotional.- A
webhookblock goes to your endpoint as-is, as the JSON body, with the method and headers set on the integration. - For a Custom API integration, the
webhookblock is the data: write${data.order_id}in the URL, headers or body of the integration and each call fills it.${topic},${message_id},${timestamp}are also available. A placeholder alone in its quotes in the body keeps its type (number, true/false, object). - Block fields are checked at delivery, not here. A block missing a required field is accepted by this call, then its delivery is recorded as failed.
Example request
const credentials = btoa('ACCESS_KEY:ACCESS_SECRET');
const res = await fetch('https://api.callistosignal.com/v1/notify/send', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Basic ' + credentials
},
body: JSON.stringify({
topic: 'orders',
email: {
to: '[email protected]',
subject: 'Order #4821 shipped',
body: '<p>Your order #4821 is on its way.</p>'
},
messaging: {
platform: 'slack',
content: 'Order #4821 shipped'
},
sms: {
to: '+22507XXXXXXXX',
message: 'Your order #4821 is on its way.'
}
})
});
if (!res.ok) {
// 400, 401, 429…: the body carries the reason
const { message } = await res.json();
throw new Error(`Notify refused (${res.status}): ${message}`);
}
const data = await res.json();
$ch = curl_init('https://api.callistosignal.com/v1/notify/send');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_USERPWD => 'ACCESS_KEY:ACCESS_SECRET',
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'topic' => 'orders',
'email' => [
'to' => '[email protected]',
'subject' => 'Order #4821 shipped',
'body' => '<p>Your order #4821 is on its way.</p>',
],
'messaging' => [
'platform' => 'slack',
'content' => 'Order #4821 shipped',
],
'sms' => [
'to' => '+22507XXXXXXXX',
'message' => 'Your order #4821 is on its way.',
],
]),
]);
$response = curl_exec($ch);
curl_close($ch);
# Send one event to every integration of a topic (pip install requests)
import requests
res = requests.post(
'https://api.callistosignal.com/v1/notify/send',
auth=('ACCESS_KEY', 'ACCESS_SECRET'),
json={
'topic': 'orders',
'email': {
'to': '[email protected]',
'subject': 'Order #4821 shipped',
'body': '<p>Your order #4821 is on its way.</p>',
},
'messaging': {'platform': 'slack', 'content': 'Order #4821 shipped'},
'sms': {'to': '+22507XXXXXXXX', 'message': 'Your order #4821 is on its way.'},
},
timeout=10,
)
if not res.ok:
# 400, 401, 429…: the body carries the reason
raise RuntimeError('Notify refused (%d): %s' % (res.status_code, res.json().get('message')))
data = res.json()
// Send one event to every integration of a topic
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
body, _ := json.Marshal(map[string]any{
"topic": "orders",
"email": map[string]string{
"to": "[email protected]",
"subject": "Order #4821 shipped",
"body": "<p>Your order #4821 is on its way.</p>",
},
"messaging": map[string]string{"platform": "slack", "content": "Order #4821 shipped"},
"sms": map[string]string{"to": "+22507XXXXXXXX", "message": "Your order #4821 is on its way."},
})
req, _ := http.NewRequest("POST", "https://api.callistosignal.com/v1/notify/send", bytes.NewReader(body))
req.SetBasicAuth("ACCESS_KEY", "ACCESS_SECRET")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var out map[string]any
json.NewDecoder(res.Body).Decode(&out)
if res.StatusCode >= 300 {
// 400, 401, 429…: the body carries the reason
panic(fmt.Sprintf("Notify refused (%d): %v", res.StatusCode, out["message"]))
}
fmt.Println(out["status"], out["queued_events"])
}
curl -u 'ACCESS_KEY:ACCESS_SECRET' \
-X POST https://api.callistosignal.com/v1/notify/send \
-H 'Content-Type: application/json' \
-d '{
"topic": "orders",
"email": {
"to": "[email protected]",
"subject": "Order #4821 shipped",
"body": "<p>Your order #4821 is on its way.</p>"
},
"messaging": {
"platform": "slack",
"content": "Order #4821 shipped"
},
"sms": {
"to": "+22507XXXXXXXX",
"message": "Your order #4821 is on its way."
}
}'
Response
{
"status": "queued",
"topic": "orders",
"queued_events": 3,
"topic_messages": 3
}
Response fields
status— Alwaysqueued: delivery is asynchronous.topic— The topic the event was published to.queued_events— Number of event block types in the request.topic_messages— Number of deliveries created: one per block and per matching integration.0means that none of the integrations on the topic handles the blocks you sent.
Rejected requests
Nothing is queued if:
topicis missing, empty or longer than 255 characters (400);- the request contains no event block (
400); - the topic does not exist or is disabled (
404); - no active integration is attached to the topic (
404).