Create Message Channel
curl --request POST \
--url https://api.assembly.com/v1/message-channels \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"membershipType": "individual",
"clientId": "client_abc123",
"companyId": "company_abc123",
"memberIds": [
"user_abc123",
"user_def456"
],
"membershipEntityId": "client_abc123"
}
'import requests
url = "https://api.assembly.com/v1/message-channels"
payload = {
"membershipType": "individual",
"clientId": "client_abc123",
"companyId": "company_abc123",
"memberIds": ["user_abc123", "user_def456"],
"membershipEntityId": "client_abc123"
}
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({
membershipType: 'individual',
clientId: 'client_abc123',
companyId: 'company_abc123',
memberIds: ['user_abc123', 'user_def456'],
membershipEntityId: 'client_abc123'
})
};
fetch('https://api.assembly.com/v1/message-channels', 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/message-channels",
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([
'membershipType' => 'individual',
'clientId' => 'client_abc123',
'companyId' => 'company_abc123',
'memberIds' => [
'user_abc123',
'user_def456'
],
'membershipEntityId' => 'client_abc123'
]),
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/message-channels"
payload := strings.NewReader("{\n \"membershipType\": \"individual\",\n \"clientId\": \"client_abc123\",\n \"companyId\": \"company_abc123\",\n \"memberIds\": [\n \"user_abc123\",\n \"user_def456\"\n ],\n \"membershipEntityId\": \"client_abc123\"\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/message-channels")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"membershipType\": \"individual\",\n \"clientId\": \"client_abc123\",\n \"companyId\": \"company_abc123\",\n \"memberIds\": [\n \"user_abc123\",\n \"user_def456\"\n ],\n \"membershipEntityId\": \"client_abc123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.assembly.com/v1/message-channels")
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 \"membershipType\": \"individual\",\n \"clientId\": \"client_abc123\",\n \"companyId\": \"company_abc123\",\n \"memberIds\": [\n \"user_abc123\",\n \"user_def456\"\n ],\n \"membershipEntityId\": \"client_abc123\"\n}"
response = http.request(request)
puts response.read_body{
"clientId": "client_abc123",
"companyId": "company_abc123",
"createdAt": "2023-01-01T00:00:00Z",
"id": "abc123",
"lastMessageDate": "2023-01-03T00:00:00Z",
"lastRead": "2023-01-02T12:00:00Z",
"memberIds": [
"user_abc123",
"user_def456"
],
"membershipEntityId": "client_abc123",
"membershipType": "individual",
"object": "messageChannel",
"unreadCount": 3,
"updatedAt": "2023-01-02T00:00:00Z"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}Message Channels
Create Message Channel
Creates a message channel. Required fields depend on membershipType: company channels need membershipEntityId or companyId; individual channels need membershipEntityId or clientId; group channels need memberIds.
POST
/
v1
/
message-channels
Create Message Channel
curl --request POST \
--url https://api.assembly.com/v1/message-channels \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"membershipType": "individual",
"clientId": "client_abc123",
"companyId": "company_abc123",
"memberIds": [
"user_abc123",
"user_def456"
],
"membershipEntityId": "client_abc123"
}
'import requests
url = "https://api.assembly.com/v1/message-channels"
payload = {
"membershipType": "individual",
"clientId": "client_abc123",
"companyId": "company_abc123",
"memberIds": ["user_abc123", "user_def456"],
"membershipEntityId": "client_abc123"
}
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({
membershipType: 'individual',
clientId: 'client_abc123',
companyId: 'company_abc123',
memberIds: ['user_abc123', 'user_def456'],
membershipEntityId: 'client_abc123'
})
};
fetch('https://api.assembly.com/v1/message-channels', 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/message-channels",
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([
'membershipType' => 'individual',
'clientId' => 'client_abc123',
'companyId' => 'company_abc123',
'memberIds' => [
'user_abc123',
'user_def456'
],
'membershipEntityId' => 'client_abc123'
]),
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/message-channels"
payload := strings.NewReader("{\n \"membershipType\": \"individual\",\n \"clientId\": \"client_abc123\",\n \"companyId\": \"company_abc123\",\n \"memberIds\": [\n \"user_abc123\",\n \"user_def456\"\n ],\n \"membershipEntityId\": \"client_abc123\"\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/message-channels")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"membershipType\": \"individual\",\n \"clientId\": \"client_abc123\",\n \"companyId\": \"company_abc123\",\n \"memberIds\": [\n \"user_abc123\",\n \"user_def456\"\n ],\n \"membershipEntityId\": \"client_abc123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.assembly.com/v1/message-channels")
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 \"membershipType\": \"individual\",\n \"clientId\": \"client_abc123\",\n \"companyId\": \"company_abc123\",\n \"memberIds\": [\n \"user_abc123\",\n \"user_def456\"\n ],\n \"membershipEntityId\": \"client_abc123\"\n}"
response = http.request(request)
puts response.read_body{
"clientId": "client_abc123",
"companyId": "company_abc123",
"createdAt": "2023-01-01T00:00:00Z",
"id": "abc123",
"lastMessageDate": "2023-01-03T00:00:00Z",
"lastRead": "2023-01-02T12:00:00Z",
"memberIds": [
"user_abc123",
"user_def456"
],
"membershipEntityId": "client_abc123",
"membershipType": "individual",
"object": "messageChannel",
"unreadCount": 3,
"updatedAt": "2023-01-02T00:00:00Z"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}Body
application/json
Message channel to create
Response
OK