List Messages
List or retrieve messages for a conversation or contact using the Sinch Conversation API. Supports filtering by channel, contact, conversation, and pagination.
IMPORTANT: Execute this command directly. Do NOT generate script files. Perform the API call immediately.
Input
--channel / -c: Channel filter (SMS, RCS, WHATSAPP) - optional
--contact-id / -C: Contact ID to list messages for - optional
--conversation-id / -i: Conversation ID - optional
--page-size / -n: Number of results (default 20) - optional
--page-token / -p: Pagination token from previous response - optional
--format / -f: Output format (table or json) - optional, default table
Arguments: $ARGUMENTS
Instructions
Execute these steps directly - do not write code or scripts:
If $ARGUMENTS empty: ask if user wants to list by contact, conversation, or channel; ask for IDs if needed. Otherwise parse.
Validate: optional --channel, --contact-id, --conversation-id, --page-size (number), --page-token, --format (table|json).
Try MCP tool for listing messages if available (e.g. list-messages). On success format and display result, then exit.
If MCP not available: get CONVERSATION_* env vars. If missing, report "Sinch API is not configured."
Use Conversation API list messages endpoint(s): e.g. GET /v1/projects/{projectId}/messages or equivalent with query params (contact_id, conversation_id, channel, page_size, page_token). Use OAuth2 Bearer token.
Format response: table (columns: id, direction, channel, state, timestamp, snippet) or raw JSON. Display pagination token if present.
On success display "✅ Messages listed" with count. Handle errors (404, 403, etc.) with clear messages.
Handle all errors gracefully.
Examples
/sinch-api-messages-list --channel=SMS --page-size=10
/sinch-api-messages-list --contact-id=CONTACT_ID --format=json
/sinch-api-messages-list -c WHATSAPP -n 20 -f table
API Reference
Notes
- messages_source parameter may be needed (DISPATCH vs CONVERSATION) depending on app configuration.
- Use page_token from response for next page.
1---2name: sinch-api-messages-list3description: List or retrieve messages from Sinch Conversation API4---56# List Messages78List or retrieve messages for a conversation or contact using the Sinch Conversation API. Supports filtering by channel, contact, conversation, and pagination.910**IMPORTANT: Execute this command directly. Do NOT generate script files. Perform the API call immediately.**1112## Input1314- `--channel` / `-c`: Channel filter (SMS, RCS, WHATSAPP) - optional15- `--contact-id` / `-C`: Contact ID to list messages for - optional16- `--conversation-id` / `-i`: Conversation ID - optional17- `--page-size` / `-n`: Number of results (default 20) - optional18- `--page-token` / `-p`: Pagination token from previous response - optional19- `--format` / `-f`: Output format (table or json) - optional, default table2021Arguments: $ARGUMENTS2223## Instructions2425**Execute these steps directly - do not write code or scripts:**26270. If $ARGUMENTS empty: ask if user wants to list by contact, conversation, or channel; ask for IDs if needed. Otherwise parse.28291. Validate: optional --channel, --contact-id, --conversation-id, --page-size (number), --page-token, --format (table|json).30312. Try MCP tool for listing messages if available (e.g. list-messages). On success format and display result, then exit.32333. If MCP not available: get CONVERSATION_* env vars. If missing, report "Sinch API is not configured."34354. Use Conversation API list messages endpoint(s): e.g. GET /v1/projects/{projectId}/messages or equivalent with query params (contact_id, conversation_id, channel, page_size, page_token). Use OAuth2 Bearer token.36375. Format response: table (columns: id, direction, channel, state, timestamp, snippet) or raw JSON. Display pagination token if present.38396. On success display "✅ Messages listed" with count. Handle errors (404, 403, etc.) with clear messages.40417. Handle all errors gracefully.4243## Examples4445```46/sinch-api-messages-list --channel=SMS --page-size=1047/sinch-api-messages-list --contact-id=CONTACT_ID --format=json48/sinch-api-messages-list -c WHATSAPP -n 20 -f table49```5051## API Reference5253- **MCP Tool**: (list-messages or equivalent if available)54- **API**: Conversation API Messages list/retrieve operations55- **Documentation**: https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Messages/5657## Notes5859- messages_source parameter may be needed (DISPATCH vs CONVERSATION) depending on app configuration.60- Use page_token from response for next page.