Skip to content

fix: Mark conversation_id as required in message schema#423

Open
markdennis22 wants to merge 1 commit intomainfrom
fix/message-conversation-id-required
Open

fix: Mark conversation_id as required in message schema#423
markdennis22 wants to merge 1 commit intomainfrom
fix/message-conversation-id-required

Conversation

@markdennis22
Copy link
Contributor

@markdennis22 markdennis22 commented Mar 25, 2026

Why?

The conversation_id field in the message response schema is not marked as required, making it appear optional in the rendered API docs. A customer reported this was confusing — they thought there were cases where the Create Conversation API wouldn't return a conversation ID.

How?

Added conversation_id to the required array in the message schema across all API versions (v2.7–v2.10, v2.12–v2.15, and Unstable). Version 2.11 already had it and was left unchanged.

What was confusing and how this fixes it

Before After
conversation_id rendered without a "required" badge in the response docs conversation_id now shows the red "required" badge, matching type, id, created_at, body, and message_type
Customers thought the API might sometimes omit the conversation ID Docs now clearly communicate that conversation_id is always returned

Companion PR in developer-docs: intercom/developer-docs#798

Generated with Claude Code

The conversation_id field was missing from the required array in the
message schema, making it appear optional in rendered API docs. This
confused customers into thinking the Create Conversation endpoint might
not always return a conversation ID. Added conversation_id to the
required array across all versions (2.11 already had it).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@levindixon
Copy link
Contributor

This adds conversation_id to the required array on the shared message schema (components/schemas/message), but that schema is referenced by two endpoints with different behavior:

Endpoint conversation_id in response?
createConversation (POST /conversations) Always present
createMessage (POST /messages) — admin message Absent — stripped by messages_controller.rb:171

The spec itself already reflects this: the createMessage "admin message created" example does not include conversation_id. Marking it required in the shared schema creates a contradiction between the schema and that example.

Suggested approach: use allOf at the createConversation endpoint level only (this pattern is already used 23 times in the spec). In each version file's createConversation 200 response:

# before
              schema:
                "$ref": "#/components/schemas/message"
# after
              schema:
                allOf:
                - "$ref": "#/components/schemas/message"
                required:
                - conversation_id

Leave the shared message schema and createMessage endpoint unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants