Create Campaign API
This endpoint allows you to create a new campaign by providing necessary details like title, voice, language, script, etc.
Endpoint
POST https://www.toingg.com/api/v3/create_campaign/
Headers
accept: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
Request Body
{
"title": "your title",
"voice": "selected voice",
"language": "english/hindi",
"script": "The script should have a minimum of 200 characters.",
"purpose": "",
"knowledgeBase": "",
"calendar": "10Am to 10Pm IST",
"firstLine": "",
"tone": "",
"postCallAnalysis": false,
"postCallAnalysisSchema": {}
}
Example Code
Python
import requests
url = "https://www.toingg.com/api/v3/create_campaign/"
payload = {
"title": "your title",
"voice": "selected voice",
"language": "english/hindi",
"script": "The script should have a minimum of 200 characters.",
"purpose": "",
"knowledgeBase": "",
"calendar": "10Am to 10Pm IST",
"firstLine": "",
"tone": "",
"postCallAnalysis": False,
"postCallAnalysisSchema": {}
}
headers = {
"accept": "application/json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
JavaScript
const fetch = require('node-fetch');
const url = 'https://www.toingg.com/api/v3/create_campaign/';
const payload = {
title: 'your title',
voice: 'selected voice',
language: 'english/hindi',
script: 'The script should have a minimum of 200 characters.',
purpose: '',
knowledgeBase: '',
calendar: '10Am to 10Pm IST',
firstLine: '',
tone: '',
postCallAnalysis: false,
postCallAnalysisSchema: {}
};
const headers = {
'accept': 'application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Responses
Code | Description | Links |
---|---|---|
200 | Successful Response | No links |
422 | Validation Error | No links |
Response Details
200 - Successful Response
- Media type: application/json
- Example Value:
"string"
422 - Validation Error
- Media type: application/json
- Example Value:
{
"detail": [
{
"loc": [
"string",
0
],
"msg": "string",
"type": "string"
}
]
}