curl --request POST \
--url https://api.tightknit.ai/v1/slack_messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel_id": "<string>",
"dm_slack_profile_ids": [
"<string>"
],
"text": "<string>",
"blocks": [
{
"type": "<string>"
}
],
"identity": "community",
"thread_ts": "<string>",
"publish_to_site": true
}
'import requests
url = "https://api.tightknit.ai/v1/slack_messages"
payload = {
"channel_id": "<string>",
"dm_slack_profile_ids": ["<string>"],
"text": "<string>",
"blocks": [{ "type": "<string>" }],
"identity": "community",
"thread_ts": "<string>",
"publish_to_site": True
}
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({
channel_id: '<string>',
dm_slack_profile_ids: ['<string>'],
text: '<string>',
blocks: [{type: '<string>'}],
identity: 'community',
thread_ts: '<string>',
publish_to_site: true
})
};
fetch('https://api.tightknit.ai/v1/slack_messages', 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.tightknit.ai/v1/slack_messages",
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([
'channel_id' => '<string>',
'dm_slack_profile_ids' => [
'<string>'
],
'text' => '<string>',
'blocks' => [
[
'type' => '<string>'
]
],
'identity' => 'community',
'thread_ts' => '<string>',
'publish_to_site' => true
]),
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.tightknit.ai/v1/slack_messages"
payload := strings.NewReader("{\n \"channel_id\": \"<string>\",\n \"dm_slack_profile_ids\": [\n \"<string>\"\n ],\n \"text\": \"<string>\",\n \"blocks\": [\n {\n \"type\": \"<string>\"\n }\n ],\n \"identity\": \"community\",\n \"thread_ts\": \"<string>\",\n \"publish_to_site\": true\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.tightknit.ai/v1/slack_messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"channel_id\": \"<string>\",\n \"dm_slack_profile_ids\": [\n \"<string>\"\n ],\n \"text\": \"<string>\",\n \"blocks\": [\n {\n \"type\": \"<string>\"\n }\n ],\n \"identity\": \"community\",\n \"thread_ts\": \"<string>\",\n \"publish_to_site\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tightknit.ai/v1/slack_messages")
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 \"channel_id\": \"<string>\",\n \"dm_slack_profile_ids\": [\n \"<string>\"\n ],\n \"text\": \"<string>\",\n \"blocks\": [\n {\n \"type\": \"<string>\"\n }\n ],\n \"identity\": \"community\",\n \"thread_ts\": \"<string>\",\n \"publish_to_site\": true\n}"
response = http.request(request)
puts response.read_body{
"object": "slack_message",
"composition_id": "cmps_7h2k9m4n1p6q",
"status": "sent",
"channel_id": "C01ABC123",
"ts": "1718000042.000123",
"message_id": "msg_9f2b8c1d4e5a",
"failed_dm_slack_profile_ids": [
"U0BRY4S6LNQ"
]
}{
"type": "about:blank",
"title": "Not found",
"status": 404,
"code": "not_found",
"detail": "<string>",
"param": "<string>",
"used_by": [
{
"object": "event",
"id": "cevt_V1StGXR8Z5jd",
"field": "cover_image_file_id"
}
],
"request_id": "req_9f2b8c1d4e5a6b7c8d9e0f1a2b3c4d5e"
}Create Slack message
Deprecated: create a composition and send it with POST /v1/compositions/{composition_id}/deliver instead, which can also schedule it and DM groups, feeds and event registrants.
Posts to a channel, sends direct messages, or both. The message goes out immediately and cannot be unsent. It is recorded as a composition, composition_id, and goes out through the same paced, retried delivery a composition’s does; the response waits up to 20 seconds for it, then answers with status saying how far it got.
A refusal carries one of these code values:
invalid_blocks(400): Slack or the Block Kit check rejected the blocks.not_in_channel(422): The Tightknit app is not in the channel and could not join it.channel_not_allowed(422): The channel is private and the Tightknit app is not in it, or it is archived, a direct message, or the Tightknit Hub.thread_not_found(422): No message in the channel has thisthread_ts.cannot_publish(422): The channel’s feed does not accept site posts.dm_delivery_failed(422): No direct message could be delivered.no_workspace(409): Slack is not connected to the community.no_community(409): Acommunitysend, but the community has no name configured.missing_scope(409): The Slack app lacks a permission the send needs; reconnect Slack.slack_unavailable(503): Slack could not be reached; retry later.
curl --request POST \
--url https://api.tightknit.ai/v1/slack_messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"channel_id": "<string>",
"dm_slack_profile_ids": [
"<string>"
],
"text": "<string>",
"blocks": [
{
"type": "<string>"
}
],
"identity": "community",
"thread_ts": "<string>",
"publish_to_site": true
}
'import requests
url = "https://api.tightknit.ai/v1/slack_messages"
payload = {
"channel_id": "<string>",
"dm_slack_profile_ids": ["<string>"],
"text": "<string>",
"blocks": [{ "type": "<string>" }],
"identity": "community",
"thread_ts": "<string>",
"publish_to_site": True
}
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({
channel_id: '<string>',
dm_slack_profile_ids: ['<string>'],
text: '<string>',
blocks: [{type: '<string>'}],
identity: 'community',
thread_ts: '<string>',
publish_to_site: true
})
};
fetch('https://api.tightknit.ai/v1/slack_messages', 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.tightknit.ai/v1/slack_messages",
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([
'channel_id' => '<string>',
'dm_slack_profile_ids' => [
'<string>'
],
'text' => '<string>',
'blocks' => [
[
'type' => '<string>'
]
],
'identity' => 'community',
'thread_ts' => '<string>',
'publish_to_site' => true
]),
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.tightknit.ai/v1/slack_messages"
payload := strings.NewReader("{\n \"channel_id\": \"<string>\",\n \"dm_slack_profile_ids\": [\n \"<string>\"\n ],\n \"text\": \"<string>\",\n \"blocks\": [\n {\n \"type\": \"<string>\"\n }\n ],\n \"identity\": \"community\",\n \"thread_ts\": \"<string>\",\n \"publish_to_site\": true\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.tightknit.ai/v1/slack_messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"channel_id\": \"<string>\",\n \"dm_slack_profile_ids\": [\n \"<string>\"\n ],\n \"text\": \"<string>\",\n \"blocks\": [\n {\n \"type\": \"<string>\"\n }\n ],\n \"identity\": \"community\",\n \"thread_ts\": \"<string>\",\n \"publish_to_site\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tightknit.ai/v1/slack_messages")
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 \"channel_id\": \"<string>\",\n \"dm_slack_profile_ids\": [\n \"<string>\"\n ],\n \"text\": \"<string>\",\n \"blocks\": [\n {\n \"type\": \"<string>\"\n }\n ],\n \"identity\": \"community\",\n \"thread_ts\": \"<string>\",\n \"publish_to_site\": true\n}"
response = http.request(request)
puts response.read_body{
"object": "slack_message",
"composition_id": "cmps_7h2k9m4n1p6q",
"status": "sent",
"channel_id": "C01ABC123",
"ts": "1718000042.000123",
"message_id": "msg_9f2b8c1d4e5a",
"failed_dm_slack_profile_ids": [
"U0BRY4S6LNQ"
]
}{
"type": "about:blank",
"title": "Not found",
"status": 404,
"code": "not_found",
"detail": "<string>",
"param": "<string>",
"used_by": [
{
"object": "event",
"id": "cevt_V1StGXR8Z5jd",
"field": "cover_image_file_id"
}
],
"request_id": "req_9f2b8c1d4e5a6b7c8d9e0f1a2b3c4d5e"
}Authorizations
Body
Members to also send the message to as a direct message from the app, one each, up to 1000. A profile's slack_profile_id. One who is not a member the app can message is left out and listed in failed_dm_slack_profile_ids.
1 - 1000 elements^[UW][A-Z0-9]{8,20}$The message as Slack mrkdwn, sent as a single section block. At most 3000 UTF-16 code units; most emoji count as two or more. Send this or blocks.
1 - 3000Response
Success
How far the send got before the response. One of:
sent: everything reached Slack.partially_sent: the send finished, but some of it did not reach Slack, or Slack could not confirm it did: a channel post with anullts, or the members infailed_dm_slack_profile_ids.sending: it is still going out.tsis set once the channel post has landed, andfailed_dm_slack_profile_idsnames only the misses known so far.
Whatever the status, sending again repeats what already went out.
sent, partially_sent, sending "sent"
Was this page helpful?

