Create a bot
Create a bot. Callable by a company admin whose role includes the messaging update permission. A ResponseBot needs webhook_external_uri (and optionally webhook_auth_token and webhook_http_method) so its messages can be delivered; a BroadcastBot can be added to channel conversations at once with conversation_ids. Returns 400 with the validation errors when the bot or its webhook is invalid.
curl --request POST \
--url https://api.fluid.app/api/v1/messaging/bots \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bot": {
"title": "Paper Order Helper",
"description": "Answers questions about paper stock and delivery times",
"type": "ResponseBot",
"image_url": "https://cdn.fluid.app/bots/3187/paper-order-helper.png",
"avatar_background_color": "1565C0",
"webhook_external_uri": "https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders",
"webhook_auth_token": "pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH",
"webhook_http_method": "post"
}
}
'import requests
url = "https://api.fluid.app/api/v1/messaging/bots"
payload = { "bot": {
"title": "Paper Order Helper",
"description": "Answers questions about paper stock and delivery times",
"type": "ResponseBot",
"image_url": "https://cdn.fluid.app/bots/3187/paper-order-helper.png",
"avatar_background_color": "1565C0",
"webhook_external_uri": "https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders",
"webhook_auth_token": "pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH",
"webhook_http_method": "post"
} }
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({
bot: {
title: 'Paper Order Helper',
description: 'Answers questions about paper stock and delivery times',
type: 'ResponseBot',
image_url: 'https://cdn.fluid.app/bots/3187/paper-order-helper.png',
avatar_background_color: '1565C0',
webhook_external_uri: 'https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders',
webhook_auth_token: 'pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH',
webhook_http_method: 'post'
}
})
};
fetch('https://api.fluid.app/api/v1/messaging/bots', 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.fluid.app/api/v1/messaging/bots",
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([
'bot' => [
'title' => 'Paper Order Helper',
'description' => 'Answers questions about paper stock and delivery times',
'type' => 'ResponseBot',
'image_url' => 'https://cdn.fluid.app/bots/3187/paper-order-helper.png',
'avatar_background_color' => '1565C0',
'webhook_external_uri' => 'https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders',
'webhook_auth_token' => 'pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH',
'webhook_http_method' => 'post'
]
]),
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://api.fluid.app/api/v1/messaging/bots"
payload := strings.NewReader("{\n \"bot\": {\n \"title\": \"Paper Order Helper\",\n \"description\": \"Answers questions about paper stock and delivery times\",\n \"type\": \"ResponseBot\",\n \"image_url\": \"https://cdn.fluid.app/bots/3187/paper-order-helper.png\",\n \"avatar_background_color\": \"1565C0\",\n \"webhook_external_uri\": \"https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders\",\n \"webhook_auth_token\": \"pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH\",\n \"webhook_http_method\": \"post\"\n }\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://api.fluid.app/api/v1/messaging/bots")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bot\": {\n \"title\": \"Paper Order Helper\",\n \"description\": \"Answers questions about paper stock and delivery times\",\n \"type\": \"ResponseBot\",\n \"image_url\": \"https://cdn.fluid.app/bots/3187/paper-order-helper.png\",\n \"avatar_background_color\": \"1565C0\",\n \"webhook_external_uri\": \"https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders\",\n \"webhook_auth_token\": \"pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH\",\n \"webhook_http_method\": \"post\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/v1/messaging/bots")
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 \"bot\": {\n \"title\": \"Paper Order Helper\",\n \"description\": \"Answers questions about paper stock and delivery times\",\n \"type\": \"ResponseBot\",\n \"image_url\": \"https://cdn.fluid.app/bots/3187/paper-order-helper.png\",\n \"avatar_background_color\": \"1565C0\",\n \"webhook_external_uri\": \"https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders\",\n \"webhook_auth_token\": \"pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH\",\n \"webhook_http_method\": \"post\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 3187,
"title": "Paper Order Helper",
"description": "Answers questions about paper stock and delivery times",
"type": "ResponseBot",
"image_url": "https://cdn.fluid.app/bots/3187/paper-order-helper.png",
"avatar_background_color": "1565C0",
"avatar_emoji": null,
"archived_at": null,
"recipient": {
"id": 48176,
"discarded_at": null,
"avatar_background": null,
"first_name": "Paper Order Helper",
"last_name": null,
"email": null,
"phone": null,
"blocked": false
},
"conversation": null,
"conversations": [],
"webhook_external_uri": "https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders",
"webhook_http_method": "post"
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}Authorizations
Bearer token authentication
Body
Show child attributes
Show child attributes
Response
The created bot.
A messaging bot.
When the bot was archived, or null while it is active.
Background color shown behind the bot's avatar.
Emoji shown as the bot's avatar.
Your one-to-one conversation with the bot, or null when you have none.
Show child attributes
Show child attributes
Conversations the bot's recipient belongs to, such as the channels a broadcast bot posts into.
Show child attributes
Show child attributes
What the bot does.
The bot ID.
URL of the bot's avatar image.
The messaging recipient that represents the bot in conversations.
Show child attributes
Show child attributes
The bot's display name. Unique among your company's active bots.
ResponseBot (replies through a webhook in one-to-one conversations) or BroadcastBot (posts into channel conversations).
For a response bot, the URL its webhook delivers messages to; otherwise null.
For a response bot, the HTTP method its webhook uses (post, put, or get); otherwise null.
curl --request POST \
--url https://api.fluid.app/api/v1/messaging/bots \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"bot": {
"title": "Paper Order Helper",
"description": "Answers questions about paper stock and delivery times",
"type": "ResponseBot",
"image_url": "https://cdn.fluid.app/bots/3187/paper-order-helper.png",
"avatar_background_color": "1565C0",
"webhook_external_uri": "https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders",
"webhook_auth_token": "pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH",
"webhook_http_method": "post"
}
}
'import requests
url = "https://api.fluid.app/api/v1/messaging/bots"
payload = { "bot": {
"title": "Paper Order Helper",
"description": "Answers questions about paper stock and delivery times",
"type": "ResponseBot",
"image_url": "https://cdn.fluid.app/bots/3187/paper-order-helper.png",
"avatar_background_color": "1565C0",
"webhook_external_uri": "https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders",
"webhook_auth_token": "pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH",
"webhook_http_method": "post"
} }
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({
bot: {
title: 'Paper Order Helper',
description: 'Answers questions about paper stock and delivery times',
type: 'ResponseBot',
image_url: 'https://cdn.fluid.app/bots/3187/paper-order-helper.png',
avatar_background_color: '1565C0',
webhook_external_uri: 'https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders',
webhook_auth_token: 'pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH',
webhook_http_method: 'post'
}
})
};
fetch('https://api.fluid.app/api/v1/messaging/bots', 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.fluid.app/api/v1/messaging/bots",
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([
'bot' => [
'title' => 'Paper Order Helper',
'description' => 'Answers questions about paper stock and delivery times',
'type' => 'ResponseBot',
'image_url' => 'https://cdn.fluid.app/bots/3187/paper-order-helper.png',
'avatar_background_color' => '1565C0',
'webhook_external_uri' => 'https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders',
'webhook_auth_token' => 'pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH',
'webhook_http_method' => 'post'
]
]),
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://api.fluid.app/api/v1/messaging/bots"
payload := strings.NewReader("{\n \"bot\": {\n \"title\": \"Paper Order Helper\",\n \"description\": \"Answers questions about paper stock and delivery times\",\n \"type\": \"ResponseBot\",\n \"image_url\": \"https://cdn.fluid.app/bots/3187/paper-order-helper.png\",\n \"avatar_background_color\": \"1565C0\",\n \"webhook_external_uri\": \"https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders\",\n \"webhook_auth_token\": \"pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH\",\n \"webhook_http_method\": \"post\"\n }\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://api.fluid.app/api/v1/messaging/bots")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"bot\": {\n \"title\": \"Paper Order Helper\",\n \"description\": \"Answers questions about paper stock and delivery times\",\n \"type\": \"ResponseBot\",\n \"image_url\": \"https://cdn.fluid.app/bots/3187/paper-order-helper.png\",\n \"avatar_background_color\": \"1565C0\",\n \"webhook_external_uri\": \"https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders\",\n \"webhook_auth_token\": \"pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH\",\n \"webhook_http_method\": \"post\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/v1/messaging/bots")
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 \"bot\": {\n \"title\": \"Paper Order Helper\",\n \"description\": \"Answers questions about paper stock and delivery times\",\n \"type\": \"ResponseBot\",\n \"image_url\": \"https://cdn.fluid.app/bots/3187/paper-order-helper.png\",\n \"avatar_background_color\": \"1565C0\",\n \"webhook_external_uri\": \"https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders\",\n \"webhook_auth_token\": \"pp_whk_9fK2mQ7xL4vR8tN1sB6cZ3yH\",\n \"webhook_http_method\": \"post\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 3187,
"title": "Paper Order Helper",
"description": "Answers questions about paper stock and delivery times",
"type": "ResponseBot",
"image_url": "https://cdn.fluid.app/bots/3187/paper-order-helper.png",
"avatar_background_color": "1565C0",
"avatar_emoji": null,
"archived_at": null,
"recipient": {
"id": 48176,
"discarded_at": null,
"avatar_background": null,
"first_name": "Paper Order Helper",
"last_name": null,
"email": null,
"phone": null,
"blocked": false
},
"conversation": null,
"conversations": [],
"webhook_external_uri": "https://bots.piedpiper.com/fluid/dunder-mifflin/paper-orders",
"webhook_http_method": "post"
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}