1. Messaging
Returning.AI
  • Getting Started
  • Users
    • Get user
      GET
    • Get Users with Filters
      POST
    • Create New User
      POST
    • Get User Data
      POST
    • Manage User Account
      POST
    • List mini-game logs by user email
      POST
    • Get user's current Mini Games and Streak stats
      POST
    • Get User Milestones
      POST
    • Update User Data, Identifier, And Roles
      POST
    • Update User XP and Currency
      POST
  • Messaging
    • Agent messaging workflow
    • Get Messages
      GET
    • Send Message
      POST
    • Reply Message
      POST
    • React Message
      POST
    • Upload message images
      POST
  • Gamification
    • Leaderboards
      • List leaderboards with pagination
      • Create a new leaderboard
      • Update an existing leaderboard
      • Get a single leaderboard by ID
      • Delete a leaderboard
    • Streaks & Mini Games
      • List user streak logs
      • Update user spin-wheel information
    • Referral
      • Get referral programs
      • Get user's referral summary
    • Rolling Data
      • Get Daily Calculation Data
      • Get Rolling Calculation Data
    • Match Predictions
    • Get tiers and XP settings
      GET
    • Get daily user gamification history
      POST
    • List user gamification logs
      POST
    • Get user activity stats
      POST
  • Rewards & Redemptions
    • Update redemption order status or refund
    • List redemption orders by user email
    • List redemption statuses
    • Get redemption status by ID
    • List redemption orders by community
    • Create redemption order status
    • Get redemption order status history
  • Chart Analysis
    • Create Analysis
    • Get Analysis
    • Update Analysis
    • Delete Analysis
    • List Analyses
    • Append Drawings
  • Bulk Operations
    • List bulk update jobs
    • Get bulk update job status
    • Get bulk update job details
    • Bulk update users from CSV
    • Bulk update premium currency from CSV
  • Channels
    • Iframe
    • List integration channels
  • Events
    • Outgoing webhooks
      • Encryption
      • User Joins Server
      • User Visits server
      • New Message Posted Anywhere
      • New Message Posted To channel
      • Purchased Store Item
    • Incoming webhooks
      • API Keys & Encryption
      • Send message into channels
      • Update Custom User Fields
      • Update In-game currency
  • Widgets
    • Authenticated Widgets
    • Public widgets
  • Community Analytics
    • Get Loyalty Overview
    • Get Phone Verification Contacts
  • Store
    • Purchase History
      • Update redemption instructions or voucher details
    • Categories
      • List Store categories
      • Create Store category
      • Get Store category by ID
      • Update Store category
      • Delete Store category
    • Products
      • List products
      • Update products in bulk
      • Create products in bulk
      • Create product with vouchers
      • Read product
      • Update product and append vouchers
      • Delete product
    • Redemption-transaction
      • Get redemption transaction detail
    • Get Store configuration
    • Update Store configuration
  • Community
    • Appearance
      • Update community theme colors
      • Update community bot profile
      • Update community URL metadata
      • Update community name and URL
    • Community Users
      • Get community users
      • Get user
    • Create community
  • API Keys
    • Community API Keys
      • Create API key
      • Read API keys
      • Delete API key
      • Update API key
    • User API Keys
      • List user API keys
      • Create user API key
      • Update user API key
      • Delete user API key
      • Get current API key information
  • User Fields
    • User Field History
      • Get all user field histories in a community
      • Get user field histories for a specific field
      • Get user field histories for a specific user
      • Get user field histories of specific user field and user
      • Update A User Field Value
      • Deprecated Field-First History Write
      • Deprecated Field-First History Read
    • Get A User Field Definition
    • Update A User Field Definition
    • Create A User Field Definition
    • Delete A User Field Definition
    • List User Field Definitions
    • Delete user field
    • Update user field
    • Get specific user field
  • Legacy
    • Servers
      • Create server
      • List servers
      • Update server metadata
    • Bulk Operations
      • Bulk import users from CSV
    • Authentication
      • Secure Auth
      • Register user with password
      • Verify user email
      • Log in user with password
    • Badges
      • List badges
      • Create badge
      • Update badge
      • Delete badge
      • Remove badge from user
      • Award badge to user
    • Messaging
    • Roles & Permissions
      • List server roles
      • Create role
      • Update role
      • Delete role
      • List user roles
      • Add role to user
      • Remove role from user
    • Users
      • Upload user avatar
    • Channels
      • Create channel
      • Update channel
      • Delete channel
    • API Keys
      • List integration API keys
      • Create integration API key
      • Delete integration API key
      • Update integration API key
  • Schemas
    • Sample Schemas
    • Schemas
    • Outgoing webhooks
    • Analysis
    • Pet
    • Category
    • Tag
    • ValidationError
    • NotFoundError
    • InternalServerError
    • NotImplementedError
    • CreateUserFieldHistoryResponse
    • CreateUserFieldHistorySuccessResponse
    • UserFieldHistoryItem
    • GetUserFieldHistoriesResponse
    • UserFieldHistoriesValidationError
    • UserFieldHistoriesMetaWithValidation
    • UserFieldHistoriesMetaWithPagination
    • GetUserFieldHistoriesSuccessResponse
    • CreateUserFieldResponse
    • CreateUserFieldSuccessResponse
    • DeleteUserFieldResponse
    • DeleteUserFieldSuccessResponse
    • UserFieldCreator
    • GetUserFieldResponse
    • GetUserFieldSuccessResponse
    • ValidationErrorItem
    • GetUserFieldsMetaResponse
    • CreatorInfo
    • UserFieldResponse
    • GetUserFieldsSuccessResponse
    • UpdateUserFieldResponse
    • UpdateUserFieldPayload
    • UpdateUserFieldSuccessResponse
    • MetaResponse
    • GetUserResponse
    • GetUserSuccessResponse
    • Purchased store item
    • ErrorResponse
    • New message posted to channel
    • UpdateAnalysisRequest
    • User visits server
    • AppendDrawingsRequest
    • User join server
    • CreateAnalysisResponse
    • GetAnalysisResponse
    • UpdateAnalysisResponse
    • AppendDrawingsResponse
    • AnalysisMetadata
    • Expiry
    • Levels
    • LevelEntry
    • Drawing
    • HorizontalLineDrawing
    • LineDrawing
    • RectangleDrawing
    • ParallelDrawing
    • FibonacciRetracementDrawing
    • Coordinate
    • DrawingStyle
    • AnalysisDetail
    • AnalysisSummary
    • CreateAnalysisRequest
    • ListAnalysesResponse
    • StandardApiError
    • StandardSuccessEnvelope
    • PurchasedStoreItemEvent
    • ChannelMessagePostedEvent
    • UserVisitedCommunityEvent
    • UserJoinedCommunityEvent
  1. Messaging

Monitor and respond to community messages

Monitor And Respond To Community Messages#

Use this journey when a server-side agent, Codex task, or Claude Code task needs to monitor normal channel messages and then reply or react through the Returning.AI public API.
WARNING
Keep the Community API key server-side. A browser login token is not a Community API key. Start agents in read-only monitoring mode, and enable replies or reactions only under an explicit automation policy.

Channel support#

Channel surfaceRead pathWrite pathAgent status
Normal/textGET /v1/messages/v1/messages/send, /reply, and /reactReady. This guide applies to normal/text channel agents.
Direct messageNo public DM history/list endpointDM-aware source branches exist, but authentication and participant requirements differNot ready for autonomous monitoring. Do not use this polling loop for DMs.
ForumCurrent list projection does not preserve enough forum-topic contextSame send route with forumTopicIdNot agent-ready. Use only after a separate forum contract is proven.
IframeNo separate public API contractNo separately verified contractNot agent-ready. The old channel-labelled copies are internal-only.
The old Apidog Message Actions Text, Direct, Forum, and Iframe pages were duplicate records for the same operations and used stale /apis/v1/messages public paths. They are intentionally hidden; use only the canonical endpoint links at the end of this guide.

Target and actor are different#

The incoming message ID selects what receives the reply or reaction. The configured agent email or exact username selects who authors that action. Never substitute the incoming author's numeric user_id for either role.

Identifier map#

A successful GET /v1/messages item looks like this:
{
  "id": "<messageId>",
  "message": "Can someone help with my account?",
  "user": {
    "user_id": "<numericPlatformUserId>",
    "email": "member@example.com"
  },
  "channel": {
    "channel_id": "<channelObjectId>",
    "name": "support"
  },
  "timestamp": "2026-08-15T04:00:00.000Z"
}
Returned fieldWhat it meansUse it for
idMessage IDmessageId in reply and react requests. This chooses the message being acted on.
user.user_idNumeric Returning.AI ID of the message authorFiltering later GET requests or looking up that user. Do not put it in mutation sender.
user.emailEmail of the message authorIdentifying or filtering the incoming author. For a normal reply, it is not the recipient field.
channel.channel_idChannel IDScoping the next message poll.
timestampMessage timestampLogging and observability. Use message IDs, not timestamps alone, for deduplication.
The important distinction is target versus actor:
messageId identifies the incoming message to reply to or react to.
sender identifies the existing community user whose identity the agent is acting as.
Configure a dedicated agent user's exact email or platform username as sender. Do not copy the incoming author's user_id into sender, and do not use a display name.
GET messages returns the author's email and numeric ID, but not their username. If a workflow genuinely needs the username, call POST /v1/users/info with the email or numeric ID and read data.username. Username lookup is not required merely to reply.

Executable sequence#

1
Resolve a channel
Call GET /v1/channels and save the target channel's _id as channel_id.
2
Poll newest normal messages
The response is newest-first. Process each page oldest-to-newest so replies remain conversational, and checkpoint every processed message id. There is no cursor API, so overlap polls and deduplicate by ID.
3
Reply as the configured agent user
{
  "messageId": "<incomingMessage.id>",
  "message": "I can help with that. What account detail should I check?",
  "sender": "community-agent@example.com"
}
sender is the agent's community user, not the incoming author. Email is the recommended stable value; the exact platform username also works.
4
React when a lightweight acknowledgement is enough
{
  "messageId": "<incomingMessage.id>",
  "emoji": ":eyes:",
  "sender": "community-agent@example.com"
}
Use a registered shortname such as :eyes: or :smile:. Raw Unicode such as 👀 is rejected.
5
Verify and checkpoint
For normal channel sends and replies, poll GET /v1/messages again and match a unique correlation marker in your text. GET messages does not expose reaction state; verify reactions in the UI or another reaction-capable surface. Save the incoming message ID only after the configured action reaches its chosen verification boundary.

Node.js monitoring example#

alreadyProcessed and markProcessed are application-owned durable checkpoint functions. Do not use an in-memory set for a production worker that may restart.

Optional user lookup#

Use lookup only when the workflow needs more author context or an exact username:
{
  "idOrEmail": "<incoming.user.user_id>"
}
Read data.username from the response. The lookup needs getUserData; it does not replace messageId when replying or reacting.

Polling, retries, and failure recovery#

SituationAction
Empty messages arrayNormal result. Wait for the next bounded poll.
Poll transport error or 5xxGET is read-only; retry with bounded exponential backoff.
Reply times out after submissionDo not immediately retry. A duplicate reply can be created. Read recent normal messages for your unique correlation marker first.
400 Sender field is requiredSet sender to the configured agent user's email or exact username.
404 User not foundThe sender does not resolve in this community. Do not substitute display name, numeric user ID, or MongoDB _id.
400 Emoji not foundSend a registered emoji shortname, not raw Unicode.
401Confirm this is a Community API key, not a browser session token, and that the Authorization header is correct.
403Check the relevant message permission and channel/user access.
WARNING
Send and reply have no documented idempotency key. Exact retries can create duplicates. Include a non-secret correlation marker in agent-authored text when deterministic readback matters.

Boundaries#

GET /v1/messages returns normal messages, not direct-message history.
Omitting channel_id returns a community-wide newest-first normal-message feed.
Direct-message replies have additional participant and recipient rules and need a separate tested flow.
data.total is the number returned in this response, not the total stored history.
Use snake_case query parameters: channel_id and user_id.

Endpoint reference#

Get Messages
Reply Message
React Message
Send Message
Get User Data
Modified at 2026-08-15 07:17:45
Previous
Update User XP and Currency
Next
Get Messages
Built with