Send Message
POST https://api.credal.ai/api/v0/copilots/sendMessage Content-Type: application/json
Deprecated. Use the v1 Agents API instead: send a message with POST /v1/agents/sendMessage, then poll for the response with GET /v1/agents/fetchAgentResponse.
Reference: https://docs.credal.ai/api-reference/api-reference/copilots/send-message
Authentication
Section titled “Authentication”Authorizationheader (bearer token, required) — Bearer authentication of the formBearer <token>, where token is your auth token.
Request
Section titled “Request”Body (application/json)
Section titled “Body (application/json)”This endpoint expects an object.
agentId(UUID, required) — Credal-generated Agent ID to specify which agent to route the request to.message(string, required) — The message you want to send to your agent.userEmail(string, required) — The user profile you want to use when sending the message.conversationId(UUID, optional) — Credal-generated conversation ID for sending follow up messages. Conversation ID is returned after initial message. Optional, to be left off for first messages on new conversations.inputVariables(list of InputVariable, optional) — Optional input variables to be used in the message. Map the name of the variable to a list of urls.
Response
Section titled “Response”sendChatResult(SendMessageResponse, required)
InputVariable
Section titled “InputVariable”name(string, required)ids(list of UUID, required)
SendMessageResponse
Section titled “SendMessageResponse”type:ai_response_resultconversationId(UUID, required)inserted_audit_log(InsertedAuditLog, required)messageId(UUID, required)referencedSources(list of ReferencedSource, required)response(ResponseChunk, required)sourcesInDataContext(list of ReferencedSource, required)warnings(list of string, required)webSearchResults(list of WebSearchResult, required)
type:blocked_resultblocks(list of string, required)conversationId(UUID, required)inserted_audit_log(InsertedAuditLog, required)warnings(list of string, required)
InsertedAuditLog
Section titled “InsertedAuditLog”id(UUID, required)
ReferencedSource
Section titled “ReferencedSource”id(string, required)externalResourceId(ExternalResourceId, required)name(string, required)url(string, optional)
ResponseChunk
Section titled “ResponseChunk”message(string, required)dataChunk(string, required)structuredOutput(any, optional)
WebSearchResult
Section titled “WebSearchResult”title(string, required)url(string, required)contents(string, required)
ExternalResourceId
Section titled “ExternalResourceId”externalResourceId(string, required)resourceType(enum, required)- Allowed values:
GOOGLE_DRIVE_ITEM,MICROSOFT_DRIVE_ITEM,ZENDESK_TICKET,ZENDESK_ARTICLE,ZENDESK_GROUP,ZENDESK_ARTICLE_SECTION,ZENDESK_ARTICLE_CATEGORY,CONFLUENCE_PAGE,CONFLUENCE_SPACE,JIRA_TICKET,JIRA_PROJECT,SALESFORCE_TASK,BOX_FILE,BOX_FOLDER,NOTION_PAGE,NOTION_DATABASE,SLACK_CHANNEL,MONGO_COLLECTION_SYNC,UNKNOWN
- Allowed values:
Examples
Section titled “Examples”Request
{
"agentId": "82e4b12a-6990-45d4-8ebd-85c00e030c24",
"message": "Is Credal SOC 2 compliant?",
"userEmail": "ravin@credal.ai",
"inputVariables": [
{
"name": "input1",
"ids": [
"82e4b12a-6990-45d4-8ebd-85c00e030c24"
]
},
{
"name": "input2",
"ids": [
"82e4b12a-6990-45d4-8ebd-85c00e030c25",
"82e4b12a-6990-45d4-8ebd-85c00e030c26"
]
}
]
}Response
{
"sendChatResult": {
"type": "ai_response_result",
"conversationId": "fc938005-92db-411a-88eb-32ca50d5f744",
"inserted_audit_log": {
"id": "5842804e-ffbe-4f8d-873e-f007fff93440"
},
"messageId": "dd721cd8-4bf2-4b94-9869-258df3dab9dc",
"referencedSources": [
{
"id": "1",
"externalResourceId": {
"externalResourceId": "123456",
"resourceType": "GOOGLE_DRIVE_ITEM"
},
"name": "Example Document",
"url": "https://drive.google.com/file/d/123456/view"
}
],
"response": {
"message": "Based on the context provided, Credal is SOC 2 compliant...",
"dataChunk": "...SOC 2 is a technical audit that requires companies to establish and follow strict information security policies and procedures. Credal's SOC 2 report is available upon request..."
},
"sourcesInDataContext": [
{
"id": "1",
"externalResourceId": {
"externalResourceId": "123456",
"resourceType": "GOOGLE_DRIVE_ITEM"
},
"name": "Example Document",
"url": "https://drive.google.com/file/d/123456/view"
},
{
"id": "2",
"externalResourceId": {
"externalResourceId": "123457",
"resourceType": "GOOGLE_DRIVE_ITEM"
},
"name": "Example Document 2",
"url": "https://drive.google.com/file/d/123457/view"
}
],
"warnings": [],
"webSearchResults": [
{
"title": "SOC 2 Compliance",
"url": "https://www.credal.ai/soc2",
"contents": "Credal is SOC 2 compliant. Learn more about SOC 2 compliance at Credal."
}
]
}
}SDK Code
import { CredalClient } from "@credal/sdk";
async function main() {
const client = new CredalClient({
apiKey: "YOUR_TOKEN_HERE",
});
await client.copilots.sendMessage({
agentId: "82e4b12a-6990-45d4-8ebd-85c00e030c24",
message: "Is Credal SOC 2 compliant?",
userEmail: "ravin@credal.ai",
inputVariables: [
{
name: "input1",
ids: [
"82e4b12a-6990-45d4-8ebd-85c00e030c24",
],
},
{
name: "input2",
ids: [
"82e4b12a-6990-45d4-8ebd-85c00e030c25",
"82e4b12a-6990-45d4-8ebd-85c00e030c26",
],
},
],
});
}
main();
from credal import CredalV0
import uuid
from credal.copilots import InputVariable
client = CredalV0(
api_key="YOUR_TOKEN_HERE",
)
client.copilots.send_message(
agent_id=uuid.UUID("82e4b12a-6990-45d4-8ebd-85c00e030c24"),
message="Is Credal SOC 2 compliant?",
user_email="ravin@credal.ai",
input_variables=[
InputVariable(
name="input1",
ids=[
uuid.UUID("82e4b12a-6990-45d4-8ebd-85c00e030c24")
],
),
InputVariable(
name="input2",
ids=[
uuid.UUID("82e4b12a-6990-45d4-8ebd-85c00e030c25"),
uuid.UUID("82e4b12a-6990-45d4-8ebd-85c00e030c26")
],
)
],
)