Create an Inbound Campaign
curl --request POST \
--url https://api.getmalakai.com/campaigns/inbound \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'x-access-token: <x-access-token>' \
--data '
{
"campaign_name": "<string>",
"agent_id": "<string>",
"workflow_id": "<string>",
"transfer_numbers": {},
"webhooks": {}
}
'import requests
url = "https://api.getmalakai.com/campaigns/inbound"
payload = {
"campaign_name": "<string>",
"agent_id": "<string>",
"workflow_id": "<string>",
"transfer_numbers": {},
"webhooks": {}
}
headers = {
"Authorization": "<authorization>",
"x-access-token": "<x-access-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<authorization>',
'x-access-token': '<x-access-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
campaign_name: '<string>',
agent_id: '<string>',
workflow_id: '<string>',
transfer_numbers: {},
webhooks: {}
})
};
fetch('https://api.getmalakai.com/campaigns/inbound', 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://api.getmalakai.com/campaigns/inbound",
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([
'campaign_name' => '<string>',
'agent_id' => '<string>',
'workflow_id' => '<string>',
'transfer_numbers' => [
],
'webhooks' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"x-access-token: <x-access-token>"
],
]);
$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://api.getmalakai.com/campaigns/inbound"
payload := strings.NewReader("{\n \"campaign_name\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"workflow_id\": \"<string>\",\n \"transfer_numbers\": {},\n \"webhooks\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("x-access-token", "<x-access-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://api.getmalakai.com/campaigns/inbound")
.header("Authorization", "<authorization>")
.header("x-access-token", "<x-access-token>")
.header("Content-Type", "application/json")
.body("{\n \"campaign_name\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"workflow_id\": \"<string>\",\n \"transfer_numbers\": {},\n \"webhooks\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getmalakai.com/campaigns/inbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["x-access-token"] = '<x-access-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"campaign_name\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"workflow_id\": \"<string>\",\n \"transfer_numbers\": {},\n \"webhooks\": {}\n}"
response = http.request(request)
puts response.read_body{
"responseCode": 2000,
"message": "Campaign created successfully",
"data": {
"campaign_name": "Demo Campaign",
"agent_id": "25e57eca-5582-4ba7-849c-1234",
"webhooks": [
"https://example.com/webhook"
],
"transfer_numbers": {
"Support": "+1234567890",
"Sales": "+0987654321"
},
"phone_number": "+1122334455",
"model": "Claude 3 Haiku",
"workflow_id": "291069c3-d653-479c-97f9-5678"
}
}
Inbound
Create an Inbound Campaign
Create a new inbound campaign from scratch
POST
campaigns
/
inbound
Create an Inbound Campaign
curl --request POST \
--url https://api.getmalakai.com/campaigns/inbound \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'x-access-token: <x-access-token>' \
--data '
{
"campaign_name": "<string>",
"agent_id": "<string>",
"workflow_id": "<string>",
"transfer_numbers": {},
"webhooks": {}
}
'import requests
url = "https://api.getmalakai.com/campaigns/inbound"
payload = {
"campaign_name": "<string>",
"agent_id": "<string>",
"workflow_id": "<string>",
"transfer_numbers": {},
"webhooks": {}
}
headers = {
"Authorization": "<authorization>",
"x-access-token": "<x-access-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<authorization>',
'x-access-token': '<x-access-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
campaign_name: '<string>',
agent_id: '<string>',
workflow_id: '<string>',
transfer_numbers: {},
webhooks: {}
})
};
fetch('https://api.getmalakai.com/campaigns/inbound', 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://api.getmalakai.com/campaigns/inbound",
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([
'campaign_name' => '<string>',
'agent_id' => '<string>',
'workflow_id' => '<string>',
'transfer_numbers' => [
],
'webhooks' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"x-access-token: <x-access-token>"
],
]);
$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://api.getmalakai.com/campaigns/inbound"
payload := strings.NewReader("{\n \"campaign_name\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"workflow_id\": \"<string>\",\n \"transfer_numbers\": {},\n \"webhooks\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("x-access-token", "<x-access-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://api.getmalakai.com/campaigns/inbound")
.header("Authorization", "<authorization>")
.header("x-access-token", "<x-access-token>")
.header("Content-Type", "application/json")
.body("{\n \"campaign_name\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"workflow_id\": \"<string>\",\n \"transfer_numbers\": {},\n \"webhooks\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getmalakai.com/campaigns/inbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["x-access-token"] = '<x-access-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"campaign_name\": \"<string>\",\n \"agent_id\": \"<string>\",\n \"workflow_id\": \"<string>\",\n \"transfer_numbers\": {},\n \"webhooks\": {}\n}"
response = http.request(request)
puts response.read_body{
"responseCode": 2000,
"message": "Campaign created successfully",
"data": {
"campaign_name": "Demo Campaign",
"agent_id": "25e57eca-5582-4ba7-849c-1234",
"webhooks": [
"https://example.com/webhook"
],
"transfer_numbers": {
"Support": "+1234567890",
"Sales": "+0987654321"
},
"phone_number": "+1122334455",
"model": "Claude 3 Haiku",
"workflow_id": "291069c3-d653-479c-97f9-5678"
}
}
Headers
string
required
Your API key for authentication. Prefix with
Bearer .string
required
Your access token for authentication.
Body
string
required
The name of the campaign to be created (e.g., “Demo Campaign”).
string
required
The ID of the agent associated with the campaign (e.g.,
“25e57eca-5582-4ba7-849c-xxxx”).
string
required
The workflow ID linked to the campaign (e.g., “291069c3-d653-479c-97f9-xxxx”).
object
Key-value pairs of labels and phone numbers for call transfers.
object
Webhook configurations for the campaign; null if not set.
Request Example
{
"campaign_name": "demo_campaign",
"agent_id": "AGENT_ID_HERE",
"workflow_id": "WORKFLOW_ID_HERE",
"max_duration": 300,
"schema_analysis": ["did the human answer?"],
"model": "Claude 3 Haiku",
"transfer_numbers": {
"test": "PHONE_NUMBER_HERE"
},
"webhooks": [],
"contacts": ["CONTACT_ID_HERE"],
"dialers": ["DIALER_ID_HERE"]
}
Response
string
Status of the request in the form of a short message.
object[]
List of the created campaign objects, each including a unique
id.{
"responseCode": 2000,
"message": "Campaign created successfully",
"data": {
"campaign_name": "Demo Campaign",
"agent_id": "25e57eca-5582-4ba7-849c-1234",
"webhooks": [
"https://example.com/webhook"
],
"transfer_numbers": {
"Support": "+1234567890",
"Sales": "+0987654321"
},
"phone_number": "+1122334455",
"model": "Claude 3 Haiku",
"workflow_id": "291069c3-d653-479c-97f9-5678"
}
}
⌘I