Open a direct message
curl --request POST \
--url https://api.devic.ai/v1/workspaces/direct-messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userUID": "<string>",
"email": "jsmith@example.com"
}
'import requests
url = "https://api.devic.ai/v1/workspaces/direct-messages"
payload = {
"userUID": "<string>",
"email": "jsmith@example.com"
}
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({userUID: '<string>', email: 'jsmith@example.com'})
};
fetch('https://api.devic.ai/v1/workspaces/direct-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.devic.ai/v1/workspaces/direct-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([
'userUID' => '<string>',
'email' => 'jsmith@example.com'
]),
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.devic.ai/v1/workspaces/direct-messages"
payload := strings.NewReader("{\n \"userUID\": \"<string>\",\n \"email\": \"jsmith@example.com\"\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.devic.ai/v1/workspaces/direct-messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"userUID\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devic.ai/v1/workspaces/direct-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 \"userUID\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"workspaceId": "<string>",
"workspaceName": "<string>",
"title": "<string>",
"kind": "<string>",
"archived": true,
"updatedAt": "2023-11-07T05:31:56Z",
"unread": true,
"unreadCount": 123,
"unreadMentionCount": 123,
"manualUnread": true,
"lastReadSeq": 123,
"lastMessageSeq": 123,
"waitingForMe": 123,
"activeRunCount": 123,
"directUserUIDs": [
"<string>"
]
}
}Workspace Threads
Open a direct message
The private conversation with a person of the same account (by userUID or email); the same one if it already exists. Errors: RECIPIENT_NOT_IN_ACCOUNT, INVALID_RECIPIENT (yourself), DIRECT_MESSAGES_REQUIRE_USER (the account integration).
POST
/
v1
/
workspaces
/
direct-messages
Open a direct message
curl --request POST \
--url https://api.devic.ai/v1/workspaces/direct-messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userUID": "<string>",
"email": "jsmith@example.com"
}
'import requests
url = "https://api.devic.ai/v1/workspaces/direct-messages"
payload = {
"userUID": "<string>",
"email": "jsmith@example.com"
}
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({userUID: '<string>', email: 'jsmith@example.com'})
};
fetch('https://api.devic.ai/v1/workspaces/direct-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.devic.ai/v1/workspaces/direct-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([
'userUID' => '<string>',
'email' => 'jsmith@example.com'
]),
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.devic.ai/v1/workspaces/direct-messages"
payload := strings.NewReader("{\n \"userUID\": \"<string>\",\n \"email\": \"jsmith@example.com\"\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.devic.ai/v1/workspaces/direct-messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"userUID\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devic.ai/v1/workspaces/direct-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 \"userUID\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"workspaceId": "<string>",
"workspaceName": "<string>",
"title": "<string>",
"kind": "<string>",
"archived": true,
"updatedAt": "2023-11-07T05:31:56Z",
"unread": true,
"unreadCount": 123,
"unreadMentionCount": 123,
"manualUnread": true,
"lastReadSeq": 123,
"lastMessageSeq": 123,
"waitingForMe": 123,
"activeRunCount": 123,
"directUserUIDs": [
"<string>"
]
}
}Authorizations
An API key from your Devic console, sent as Authorization: Bearer <key>. An embedded front end sends a tenant-session token instead, so no API key reaches the browser, and an OAuth integration sends its access token. Missing, invalid or expired credentials get a 401. See Authentication.
Headers
Body
application/json