Bots
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.
POST
/
api
/
v1
/
messaging
/
bots
Create a bot
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"
}
}Response
The created bot.
A messaging bot.
⌘I
Create a bot
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"
}
}