curl --request POST \
--url https://api.assembly.com/v1/messages \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data @- <<EOF
{
"channelId": "550e8400-e29b-41d4-a716-446655440000",
"text": "Thanks for the update, I'll review the contract today.",
"senderId": "550e8400-e29b-41d4-a716-446655440001"
}
EOFimport requests
url = "https://api.assembly.com/v1/messages"
payload = {
"channelId": "550e8400-e29b-41d4-a716-446655440000",
"text": "Thanks for the update, I'll review the contract today.",
"senderId": "550e8400-e29b-41d4-a716-446655440001"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channelId: '550e8400-e29b-41d4-a716-446655440000',
text: 'Thanks for the update, I\'ll review the contract today.',
senderId: '550e8400-e29b-41d4-a716-446655440001'
})
};
fetch('https://api.assembly.com/v1/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.assembly.com/v1/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([
'channelId' => '550e8400-e29b-41d4-a716-446655440000',
'text' => 'Thanks for the update, I\'ll review the contract today.',
'senderId' => '550e8400-e29b-41d4-a716-446655440001'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.assembly.com/v1/messages"
payload := strings.NewReader("{\n \"channelId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"text\": \"Thanks for the update, I'll review the contract today.\",\n \"senderId\": \"550e8400-e29b-41d4-a716-446655440001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.assembly.com/v1/messages")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"channelId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"text\": \"Thanks for the update, I'll review the contract today.\",\n \"senderId\": \"550e8400-e29b-41d4-a716-446655440001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.assembly.com/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channelId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"text\": \"Thanks for the update, I'll review the contract today.\",\n \"senderId\": \"550e8400-e29b-41d4-a716-446655440001\"\n}"
response = http.request(request)
puts response.read_body{
"channelId": "550e8400-e29b-41d4-a716-446655440000",
"createdAt": "<string>",
"creatorId": "<string>",
"data": "<string>",
"id": "<string>",
"identityId": "<string>",
"isAttachmentIncluded": false,
"object": "message",
"previousAttributes": {},
"ref": "<string>",
"senderId": "550e8400-e29b-41d4-a716-446655440001",
"text": "Thanks for the update, I'll review the contract today.",
"updatedAt": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}Send a message
Sends a message to a channel. Requires channelId and text. channelId must be a bare UUID (do not include the GetStream ‘messaging:’ prefix). When senderId is provided it must be a member of the channel; otherwise the authenticated user is used as the author.
curl --request POST \
--url https://api.assembly.com/v1/messages \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data @- <<EOF
{
"channelId": "550e8400-e29b-41d4-a716-446655440000",
"text": "Thanks for the update, I'll review the contract today.",
"senderId": "550e8400-e29b-41d4-a716-446655440001"
}
EOFimport requests
url = "https://api.assembly.com/v1/messages"
payload = {
"channelId": "550e8400-e29b-41d4-a716-446655440000",
"text": "Thanks for the update, I'll review the contract today.",
"senderId": "550e8400-e29b-41d4-a716-446655440001"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channelId: '550e8400-e29b-41d4-a716-446655440000',
text: 'Thanks for the update, I\'ll review the contract today.',
senderId: '550e8400-e29b-41d4-a716-446655440001'
})
};
fetch('https://api.assembly.com/v1/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.assembly.com/v1/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([
'channelId' => '550e8400-e29b-41d4-a716-446655440000',
'text' => 'Thanks for the update, I\'ll review the contract today.',
'senderId' => '550e8400-e29b-41d4-a716-446655440001'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.assembly.com/v1/messages"
payload := strings.NewReader("{\n \"channelId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"text\": \"Thanks for the update, I'll review the contract today.\",\n \"senderId\": \"550e8400-e29b-41d4-a716-446655440001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.assembly.com/v1/messages")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"channelId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"text\": \"Thanks for the update, I'll review the contract today.\",\n \"senderId\": \"550e8400-e29b-41d4-a716-446655440001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.assembly.com/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channelId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"text\": \"Thanks for the update, I'll review the contract today.\",\n \"senderId\": \"550e8400-e29b-41d4-a716-446655440001\"\n}"
response = http.request(request)
puts response.read_body{
"channelId": "550e8400-e29b-41d4-a716-446655440000",
"createdAt": "<string>",
"creatorId": "<string>",
"data": "<string>",
"id": "<string>",
"identityId": "<string>",
"isAttachmentIncluded": false,
"object": "message",
"previousAttributes": {},
"ref": "<string>",
"senderId": "550e8400-e29b-41d4-a716-446655440001",
"text": "Thanks for the update, I'll review the contract today.",
"updatedAt": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}Authorizations
Body
Message to send
ChannelID identifies the channel the message is sent to. Required. Must be a bare UUID and must not include the GetStream 'messaging:' prefix.
"550e8400-e29b-41d4-a716-446655440000"
Text is the body of the message. Required. Limited to 5000 characters by GetStream.
"Thanks for the update, I'll review the contract today."
SenderID optionally overrides the author of the message. When omitted, the authenticated user is used. When set it must be the UUID of a member of the channel.
"550e8400-e29b-41d4-a716-446655440001"
Response
OK
ChannelID is the channel the message belongs to (bare UUID, without the GetStream 'messaging:' prefix).
"550e8400-e29b-41d4-a716-446655440000"
IsAttachmentIncluded indicates whether the message has one or more attachments.
false
Object is the resource type discriminator, always "message".
"message"
SenderID is the UUID of the member who authored the message.
"550e8400-e29b-41d4-a716-446655440001"
Text is the body of the message. Empty when the message only carries attachments.
"Thanks for the update, I'll review the contract today."