Message composer AI (draft / improve)
The AI writing actions in the conversation composer (draft reply, fix spelling, grammar, shorten, expand, and custom instructions) call a single generic AI endpoint with a JSON schema for the reply shape.
Endpoint
Request (draft reply pattern)
The app builds system_prompt from the current draft and channel context, and sends user_prompt asking for the next outgoing message in JSON.
Request (improve / rewrite pattern)
Same endpoint with source: "ai_conversation_message_composer", a system_prompt that includes the current outgoing draft (and optional channel context), and a user_prompt such as:
- Fix spelling
- Fix grammar
- Improve clarity
- Shorten
- Expand
- Or any custom user-entered instruction
Response (shape used by the app)
json
The client parses ai_response_content as JSON (including handling markdown code fences if present) into html_content, text_content, explanation, and suggestions.
Body fields
| Field | Type | Description |
|---|---|---|
system_prompt | String | Full system instructions (includes transcript summary and draft where applicable). |
user_prompt | String | Task for the model (draft, fix, custom). |
source | String | Always ai_conversation_message_composer for this feature. |
organization_id | Number | Organization scope. |
ai_schema | Object | JSON-schema-like description for structured model output. |
Notes
- The composer loads recent inbound messages from List conversation messages (limit 50, excluding reactions) to build the transcript section of
system_prompt. - This endpoint is not tied to a specific saved AI assistant record; it is a generic completion used only for drafting in the composer.
Report an issue with this documentation
Please log in to report issues with our documentation.