Send Message
Send a new message in a conversation.- Endpoint:
POST /messages - Authentication: API Key Required
Headers
Message Types
Thecontent_type field determines the message format and required fields:
-
TEXT (
"content_type": "text")- Basic text messages
- Requires
contentfield - No file handling needed
-
MEDIA (
audio/*, image/*, application/pdf, etc.)- Used for file attachments
- Requires
filenamefield - Must obtain pre-signed URL before upload
- Supports various formats (audio, image, PDF, XLSX, CSV)
- More detail below Media Handling
Request Body
Example: Text Message
Example: Media Message
Response
Supported Content Types
Status Codes
200: Message sent successfully400: Validation error401: Invalid or missing API key422: Missing organization ID500: Server error
Example Request
Notes
-
File Uploads:
- Obtain pre-signed URL before uploading media
- Use appropriate content type headers
- Respect file size limits
-
Message Processing:
- Messages are processed asynchronously
- Check message status for delivery confirmation
- All timestamps are in UTC
-
Metadata Usage:
- Use metadata for custom tracking
- Metadata must be valid JSON
- Maximum metadata size: 4KB
-
Rate Limits:
- 100 messages per minute per organization
- Larger limits available for enterprise plans
Media Handling
For sending media messages (images, audio, PDFs, etc.), you’ll need to follow a three-step process:Step 1: Get Pre-signed URL
Endpoint:POST /media/presigned-url
Headers:
Step 2: Upload File
Use the pre-signed URL to upload your file:${PRESIGNED_URL} with the URL received from Step 1, and adjust the file path to your local file
location.
Step 3: Send Message
After successful upload, send the message:Supported File Types
Complete Example
Media Upload Notes
-
File Naming:
- Uploaded files are automatically prefixed with timestamp
- Format:
YYYYMMDD_HHMMSS_original_filename
-
Storage Organization:
- Files are stored in type-specific folders
- Each organization has its own directory
- Maintains clean separation of different file types
-
Limitations:
- Text files are not supported for pre-signed URLs
- Pre-signed URLs expire after 15 minutes
- File type must match the declared content type
-
Error Cases:
422: Missing organization ID400: Invalid file type or unsupported operation500: Server error during URL generation
Message Metadata
Themetadata field in messages serves several critical functions:
-
File Storage Information
- Tracks file storage details for system generated files
- Used when system generates a file response
- System automatically processes the file:
- Extracts bucket and path information
- Transfers file to conversation media bucket
- Updates message with standardized S3 URI
- Supports both HTTPS and S3 protocol URLs
- File access requires proper authentication
- Example message metadata:
-
Workflow Instance Status
The metadata tracks workflow execution state through the
workflow_instance_statusfield: Available Status ValuesExample Status Updates === “Initial workflow start”=== “Workflow paused for user input”=== “Workflow completion”Status TransitionsRUNNING→ Any statusPAUSED→RUNNING,CANCELLED,TERMINATEDCOMPLETED(Terminal state)FAILED(Terminal state)CANCELLED(Terminal state)TERMINATED(Terminal state)
- Status updates are real-time
- Terminal states cannot transition to other states
- Each status update includes timestamp information
- Status changes may trigger notifications or webhook events
- Historical status changes are preserved in workflow logs
-
Ticket Integration
The metadata contains ticket information that automatically manages support ticket lifecycles: Status Management
- Ticket status is automatically updated based on task instance status:
- Updates are handled atomically to prevent race conditions
- Status changes are tracked in ticket history
Example Metadata UsageNotification System When tickets are created or updated:- Assignees receive email notifications
- Notifications include:
- Ticket ID
- Task name and description
- Workflow name
- Exception details (if any)
- Assignment details
- Ticket updates are processed atomically using database transactions
- Missing ticket IDs are safely ignored
- Status updates are immediate and automatic
- All ticket activities are logged for audit purposes
- Ticket status is automatically updated based on task instance status:

