API Reference
Create new chat
Creates a new chat instance for a user based on a provided API integration. Requires a valid platform token in the headers for authentication. Ensure the apiIntegrationId corresponds to an existing integration.
POST
/
create_new_chat
Create new chat
curl --request POST \
--url https://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"apiIntegrationId": "<string>"
}
'import requests
url = "https://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat"
payload = { "apiIntegrationId": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({apiIntegrationId: '<string>'})
};
fetch('https://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat', 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://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat",
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([
'apiIntegrationId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat"
payload := strings.NewReader("{\n \"apiIntegrationId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <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://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apiIntegrationId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"apiIntegrationId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"chatId": "<string>"
}{
"detail": "Your JSON payload is missing required fields. Please consult the documentation."
}{
"detail": "Invalid or missing authorization token."
}{
"detail": "An unexpected error occurred while processing your request."
}Authorizations
Platform token required for authentication. Find or create one inside Profile Icon > API Keys. Example: Bearer sk-agencii-...
Body
application/json
Request body for the /create_new_chat endpoint.
The unique identifier of the API integration for which to create the chat. Example: "dpCD7snQ0tCWrdtp6UhZ"
Response
Chat created successfully. Returns the unique chatId for the new chat.
Response body for the /create_new_chat endpoint.
The unique identifier for the newly created chat. Example: "FVfA971B3fnBH4S1OKlo"
⌘I
Create new chat
curl --request POST \
--url https://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"apiIntegrationId": "<string>"
}
'import requests
url = "https://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat"
payload = { "apiIntegrationId": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({apiIntegrationId: '<string>'})
};
fetch('https://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat', 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://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat",
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([
'apiIntegrationId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat"
payload := strings.NewReader("{\n \"apiIntegrationId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <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://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apiIntegrationId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agency-swarm-app-japboyzddq-uc.a.run.app/create_new_chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"apiIntegrationId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"chatId": "<string>"
}{
"detail": "Your JSON payload is missing required fields. Please consult the documentation."
}{
"detail": "Invalid or missing authorization token."
}{
"detail": "An unexpected error occurred while processing your request."
}