cURL
curl -sS -X POST "https://dashboard.ondial.ai/api/v1/event-routes" \
-H "Authorization: Bearer $ONDIAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call"
],
"enabled": true
}'const res = await fetch("https://dashboard.ondial.ai/api/v1/event-routes", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.ONDIAL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call"
],
"enabled": true
}),
});
const data = await res.json();
console.log(res.status, data);import os
import requests
res = requests.request(
"POST",
"https://dashboard.ondial.ai/api/v1/event-routes",
headers={
"Authorization": f"Bearer {os.environ['ONDIAL_API_KEY']}",
},
json={
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call",
],
"enabled": True,
},
timeout=30,
)
print(res.status_code, res.json())<?php
$ch = curl_init("https://dashboard.ondial.ai/api/v1/event-routes");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ONDIAL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
'eventType' => 'lead.created',
'campaignId' => '6a7acc769198505873b9c0b0',
'defaultChannels' => [
'call',
],
'enabled' => true,
]),
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status . " " . $response;import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://dashboard.ondial.ai/api/v1/event-routes"))
.header("Authorization", "Bearer " + System.getenv("ONDIAL_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call"
],
"enabled": true
}
"""))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System;
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://dashboard.ondial.ai/api/v1/event-routes");
request.Headers.Add("Authorization", "Bearer " + Environment.GetEnvironmentVariable("ONDIAL_API_KEY"));
request.Content = new StringContent("""
{
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call"
],
"enabled": true
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode + " " + await response.Content.ReadAsStringAsync());package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call"
],
"enabled": true
}`)
req, _ := http.NewRequest("POST", "https://dashboard.ondial.ai/api/v1/event-routes", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("ONDIAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(out))
}{
"route": {
"id": "<string>",
"_id": "<string>",
"eventType": "<string>",
"campaignId": "<string>",
"defaultChannels": [
"<string>"
],
"enabled": true
}
}{
"error": "Invalid or inactive API key",
"reasonCode": "unauthorized"
}{
"error": "Not found",
"reasonCode": "not_found"
}{
"leadId": 177,
"error": "<string>",
"reasonCode": "<string>",
"missing": [
"<string>"
]
}Upsert event route
Map an eventType to a campaign and default channels.
POST
https://dashboard.ondial.ai
/
api
/
v1
/
event-routes
cURL
curl -sS -X POST "https://dashboard.ondial.ai/api/v1/event-routes" \
-H "Authorization: Bearer $ONDIAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call"
],
"enabled": true
}'const res = await fetch("https://dashboard.ondial.ai/api/v1/event-routes", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.ONDIAL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call"
],
"enabled": true
}),
});
const data = await res.json();
console.log(res.status, data);import os
import requests
res = requests.request(
"POST",
"https://dashboard.ondial.ai/api/v1/event-routes",
headers={
"Authorization": f"Bearer {os.environ['ONDIAL_API_KEY']}",
},
json={
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call",
],
"enabled": True,
},
timeout=30,
)
print(res.status_code, res.json())<?php
$ch = curl_init("https://dashboard.ondial.ai/api/v1/event-routes");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ONDIAL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
'eventType' => 'lead.created',
'campaignId' => '6a7acc769198505873b9c0b0',
'defaultChannels' => [
'call',
],
'enabled' => true,
]),
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status . " " . $response;import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://dashboard.ondial.ai/api/v1/event-routes"))
.header("Authorization", "Bearer " + System.getenv("ONDIAL_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("""
{
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call"
],
"enabled": true
}
"""))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System;
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://dashboard.ondial.ai/api/v1/event-routes");
request.Headers.Add("Authorization", "Bearer " + Environment.GetEnvironmentVariable("ONDIAL_API_KEY"));
request.Content = new StringContent("""
{
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call"
],
"enabled": true
}
""", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode + " " + await response.Content.ReadAsStringAsync());package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"eventType": "lead.created",
"campaignId": "6a7acc769198505873b9c0b0",
"defaultChannels": [
"call"
],
"enabled": true
}`)
req, _ := http.NewRequest("POST", "https://dashboard.ondial.ai/api/v1/event-routes", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("ONDIAL_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(out))
}{
"route": {
"id": "<string>",
"_id": "<string>",
"eventType": "<string>",
"campaignId": "<string>",
"defaultChannels": [
"<string>"
],
"enabled": true
}
}{
"error": "Invalid or inactive API key",
"reasonCode": "unauthorized"
}{
"error": "Not found",
"reasonCode": "not_found"
}{
"leadId": 177,
"error": "<string>",
"reasonCode": "<string>",
"missing": [
"<string>"
]
}campaignId must be an API campaign you own. Example eventType: lead.created, invoice.overdue.Authorizations
Paste only your API key (ond_live_… or ond_test_…). Do not type the word Bearer - the playground adds it.
Body
application/json

