JavaScript
import BrainbaseLabs from 'brainbase-labs';
const client = new BrainbaseLabs({
apiKey: process.env['BRAINBASE_LABS_API_KEY'], // This is the default and can be omitted
});
const outboundCampaign = await client.workers.deployments.voice.outboundCampaigns.create(
'deploymentId',
{ workerId: 'workerId', data: [{}] },
);
console.log(outboundCampaign.id);import os
from brainbase_labs import BrainbaseLabs
client = BrainbaseLabs(
api_key=os.environ.get("BRAINBASE_LABS_API_KEY"), # This is the default and can be omitted
)
outbound_campaign = client.workers.deployments.voice.outbound_campaigns.create(
deployment_id="deploymentId",
worker_id="workerId",
data=[{}],
)
print(outbound_campaign.id)curl --request POST \
--url https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"data": [
{}
],
"name": "<string>",
"description": "<string>",
"batch_size": 1,
"batch_interval_minutes": 2,
"additional_data": {},
"telephonyProvider": {},
"created_by": "<string>",
"team_id": "<string>",
"flow_id": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns",
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([
'data' => [
[
]
],
'name' => '<string>',
'description' => '<string>',
'batch_size' => 1,
'batch_interval_minutes' => 2,
'additional_data' => [
],
'telephonyProvider' => [
],
'created_by' => '<string>',
'team_id' => '<string>',
'flow_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns"
payload := strings.NewReader("{\n \"data\": [\n {}\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"batch_size\": 1,\n \"batch_interval_minutes\": 2,\n \"additional_data\": {},\n \"telephonyProvider\": {},\n \"created_by\": \"<string>\",\n \"team_id\": \"<string>\",\n \"flow_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {}\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"batch_size\": 1,\n \"batch_interval_minutes\": 2,\n \"additional_data\": {},\n \"telephonyProvider\": {},\n \"created_by\": \"<string>\",\n \"team_id\": \"<string>\",\n \"flow_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": [\n {}\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"batch_size\": 1,\n \"batch_interval_minutes\": 2,\n \"additional_data\": {},\n \"telephonyProvider\": {},\n \"created_by\": \"<string>\",\n \"team_id\": \"<string>\",\n \"flow_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"data": {},
"batchSize": 123,
"batchIntervalMinutes": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deploymentId": "<string>",
"workerId": "<string>",
"teamId": "<string>",
"name": "<string>",
"description": "<string>",
"additionalData": {},
"telephonyProvider": {},
"flowId": "<string>",
"createdById": "<string>"
}Outbound Campaigns
Create a new outbound campaign
POST
/
api
/
workers
/
{workerId}
/
deployments
/
voice
/
{deploymentId}
/
outbound-campaigns
JavaScript
import BrainbaseLabs from 'brainbase-labs';
const client = new BrainbaseLabs({
apiKey: process.env['BRAINBASE_LABS_API_KEY'], // This is the default and can be omitted
});
const outboundCampaign = await client.workers.deployments.voice.outboundCampaigns.create(
'deploymentId',
{ workerId: 'workerId', data: [{}] },
);
console.log(outboundCampaign.id);import os
from brainbase_labs import BrainbaseLabs
client = BrainbaseLabs(
api_key=os.environ.get("BRAINBASE_LABS_API_KEY"), # This is the default and can be omitted
)
outbound_campaign = client.workers.deployments.voice.outbound_campaigns.create(
deployment_id="deploymentId",
worker_id="workerId",
data=[{}],
)
print(outbound_campaign.id)curl --request POST \
--url https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"data": [
{}
],
"name": "<string>",
"description": "<string>",
"batch_size": 1,
"batch_interval_minutes": 2,
"additional_data": {},
"telephonyProvider": {},
"created_by": "<string>",
"team_id": "<string>",
"flow_id": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns",
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([
'data' => [
[
]
],
'name' => '<string>',
'description' => '<string>',
'batch_size' => 1,
'batch_interval_minutes' => 2,
'additional_data' => [
],
'telephonyProvider' => [
],
'created_by' => '<string>',
'team_id' => '<string>',
'flow_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns"
payload := strings.NewReader("{\n \"data\": [\n {}\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"batch_size\": 1,\n \"batch_interval_minutes\": 2,\n \"additional_data\": {},\n \"telephonyProvider\": {},\n \"created_by\": \"<string>\",\n \"team_id\": \"<string>\",\n \"flow_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {}\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"batch_size\": 1,\n \"batch_interval_minutes\": 2,\n \"additional_data\": {},\n \"telephonyProvider\": {},\n \"created_by\": \"<string>\",\n \"team_id\": \"<string>\",\n \"flow_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://brainbase-monorepo-api.onrender.com/api/workers/{workerId}/deployments/voice/{deploymentId}/outbound-campaigns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": [\n {}\n ],\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"batch_size\": 1,\n \"batch_interval_minutes\": 2,\n \"additional_data\": {},\n \"telephonyProvider\": {},\n \"created_by\": \"<string>\",\n \"team_id\": \"<string>\",\n \"flow_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"data": {},
"batchSize": 123,
"batchIntervalMinutes": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deploymentId": "<string>",
"workerId": "<string>",
"teamId": "<string>",
"name": "<string>",
"description": "<string>",
"additionalData": {},
"telephonyProvider": {},
"flowId": "<string>",
"createdById": "<string>"
}Authorizations
API key authentication
Body
application/json
Contact data array
Campaign name
Campaign description
Number of calls to make simultaneously
Minutes to wait between batches
Additional metadata
Telephony provider configuration
Campaign status
Available options:
CREATED, STARTED, RUNNING, COMPLETED, STOPPED, FAILED User ID who created the campaign
Team ID
Flow ID
Response
Campaign created successfully
⌘I
