Skip to Content

Webhooks

QiQ Social uses Supabase Edge Functions as HTTP endpoints for handling external events and integrations.

Available Endpoints

Publish

Queue a post to publish to its channel right away. The publishing queue runs every minute, so the post usually goes live within a minute or two.

POST /functions/v1/publish Authorization: Bearer <access-token> Content-Type: application/json { "post_id": 1 }

Response: { "ok": true, "post_id": 1 } once the post is queued. The request returns 402 when the plan’s post limit is reached and 409 when the post is already publishing or published. Follow the post’s status for the result: PENDING while queued, RUNNING while publishing, then SUCCESS or FAILURE.

OAuth Connect

Handle OAuth callbacks from platform authorization flows.

POST /functions/v1/connect Content-Type: application/json { "platform": "instagram", "code": "<oauth-authorization-code>", "workspace_id": "uuid" }

Sync

Refresh OAuth tokens and synchronize connection data.

POST /functions/v1/sync Authorization: Bearer <access-token> Content-Type: application/json { "connection_id": 1 }

Import Channels

Fetch and import channels from a connected platform.

POST /functions/v1/import-channels Authorization: Bearer <access-token> Content-Type: application/json { "connection_id": 1 }

Text Assist

AI-powered text enhancement for editing post content.

POST /functions/v1/text-assist Authorization: Bearer <access-token> Content-Type: application/json { "text": "Original text to enhance", "action": "improve" }

Media Assist

AI-powered image generation.

POST /functions/v1/media-assist Authorization: Bearer <access-token> Content-Type: application/json { "prompt": "A professional marketing image for social media" }

Cron-Triggered Functions

These functions run on a schedule and are not called directly via HTTP:

FunctionSchedulePurpose
process-queuePeriodicPublishes posts whose scheduled time has arrived
sync-post-metricsPeriodicFetches engagement metrics (views, likes, comments) from platforms for published posts

Error Handling

Edge Functions return standard HTTP status codes:

CodeDescription
200Success
400Bad request (invalid parameters)
401Unauthorized (missing or invalid token)
403Forbidden (insufficient permissions)
404Resource not found
500Internal server error

Error responses include a JSON body with details:

{ "error": "Description of what went wrong" }
Last updated on