Sync Reddit Connection Status
Reddit
Sync Reddit Connection Status
Sync Reddit Connection Status
POST
Sync Reddit Connection Status
CLI:
Overview
Reconciles any unsettledaccounts rows for the caller against the live Reddit connection state. Used after POST /api/composio/connect; completion is detected by polling this endpoint.
For each unsettled row this endpoint:
- Reads the connection status from the provider (
ACTIVE→connected,INITIATED/PENDING→ stayspending,REVOKED/INACTIVE→disconnected,FAILED/EXPIRED→error). - When the row flips to
connected, fetches the Reddit username and avatar (best-effort) and writes them todisplay_name,profile_url, andavatar_url. - Idempotent: rows that are already fully settled (connected with a display name) are skipped.
AI agent notes
Polling cadence. Poll every 3–5 seconds for up to ~2 minutes after the human opens the
redirectUrl from POST /api/composio/connect. Beyond that, fall back to slower polls (every 30 s) — most users finish within 30 seconds, the long tail is users who got distracted.Detecting completion. The response always returns 200, even when nothing changed. Either:- Inspect
synced[]for an entry withstatus: "connected", or - Re-fetch
GET /api/senders?type=redditand look for a row whosestatusisconnectedanddisplay_nameis non-null.
status: "disconnected" to the row. The UI shows it as disconnected; the row sticks around for audit. Remove it from the dashboard if the human wants the disconnected row cleaned up entirely.No-op safety. Calling this when nothing is pending returns { "synced": [] }. It is safe to call on every tick of a long-poll loop.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Response
Returns one entry per unsettled accounts row that was inspected. An empty synced array means nothing was pending. The same shape is returned whether or not any rows actually changed status — diff against GET /api/senders?type=reddit to detect new completions.
One entry per accounts row that was inspected. Rows that are already settled (connected with a display name) are not returned.