Channels

Where chat is exposed: the embeddable widget, its public configuration, and WhatsApp.

dev · https://api.dev.oprag.ai

10 endpoints. 4 are reachable without a dashboard session — they are listed in the Integration API — and the other 6 require a Cognito JWT. The badge under each path says which.

GET /widget.js

Embed widget bundle (301 to CDN when configured)

Auth Public — no credential

Path parameters

None.

Query parameters

None.Serves a fixed document and takes no input at all.

Body parameters

None.GET requests carry no body.

Response

Status codes

Status Meaning
200 Success.
429 Rate limited. See rate limits.

curl

Shell
curl -X GET 'https://api.dev.oprag.ai/widget.js' \
  -H 'X-Oprag-Key: sk_live_...'
GET /v1/widget/{projectId}/config

Public display configuration for a project's chat widget.

Auth Public — no credential

Before you call it

  • Only served while the project is live or indexing and its widget is enabled.
  • Returns displayName, welcomeMessage, and theme (primaryColor, position, and an optional mode).
  • theme.mode is auto, light, or dark. auto follows the visitor's prefers-color-scheme.
  • quickPrompts and the lead-capture fields appear only when those features are on, and escalationEnabled only when the project has an escalation webhook or email.

Path parameters

Name Type Required Description
projectId string Required Project the request applies to. Must belong to the calling workspace.

Query parameters

None.Reads the resource named in the path; there is nothing else to select.

Body parameters

None.GET requests carry no body.

Response

Status codes

Status Meaning
200 Success.
404 No such resource in this workspace.
429 Rate limited. See rate limits.

curl

Shell
curl -X GET 'https://api.dev.oprag.ai/v1/widget/{projectId}/config' \
  -H 'X-Oprag-Key: sk_live_...'

SDK equivalent `mountWidget()` reads this

GET /v1/webhooks/whatsapp

Answers Meta's hub subscription challenge when the webhook is registered.

Auth Integration key

Before you call it

  • Meta calls this when you register the webhook; your code never does.
  • hub.verify_token is compared against the global WHATSAPP_VERIFY_TOKEN, never a per-project value.

Path parameters

None.

Query parameters

Name Type Required Default Description
hub.mode "subscribe" Required Meta sends subscribe. Any other value is rejected with 403.
hub.verify_token string Required Compared in constant time against the configured verify token. A mismatch is a 403.
hub.challenge string Required Echoed back verbatim as the plain-text 200 body when verification passes.

Body parameters

None.GET requests carry no body.

Response

200 Success

JSON
1234567890

Status codes

Status Meaning
200 Verified. The body is hub.challenge verbatim, as plain text.
401 Missing, revoked, or wrong-environment key.
403 Invalid verification request when a parameter is missing or hub.mode is not subscribe; Verification token mismatch when the token does not match.
429 Rate limited. See rate limits.

curl

Shell
curl -X GET 'https://api.dev.oprag.ai/v1/webhooks/whatsapp' \
  -H 'X-Oprag-Key: sk_live_...'
POST /v1/webhooks/whatsapp

Receives inbound WhatsApp messages from Meta and answers them through the project's chat pipeline.

Auth Integration key

Before you call it

  • Meta calls this, not your code. It needs an X-Hub-Signature-256 header — sha256= followed by an HMAC-SHA256 of the raw body under the app secret — and the raw JSON body.
  • Text messages only. Deliveries are de-duplicated on Meta's message id, and phone_number_id selects which project answers.
  • Answers run through the shared chat pipeline with channel: "whatsapp".
  • An unmapped or disabled connection is acknowledged without running chat at all, so Meta stops retrying.

Path parameters

None.

Query parameters

None.The provider signs and posts the whole payload; nothing is read from the URL.

Body parameters

Defined by the caller.Inbound message payload from WhatsApp.

Response

Status codes

Status Meaning
200 Acknowledged, as plain-text OK. Meta retries anything else, so this is the answer whenever the signature is valid.
401 Invalid webhook signature — the HMAC did not match.
403 Origin or IP not allowed for this project.
429 Rate limited. See rate limits.
503 WHATSAPP_APP_SECRET is not configured.

curl

Shell
curl -X POST 'https://api.dev.oprag.ai/v1/webhooks/whatsapp' \
  -H 'X-Oprag-Key: sk_live_...'
GET /v1/projects/{projectId}/widget-config

Widget settings (dashboard)

Auth Cognito JWT member

Path parameters

Name Type Required Description
projectId string Required Project the request applies to. Must belong to the calling workspace.

Query parameters

None.Reads the resource named in the path; there is nothing else to select.

Body parameters

None.GET requests carry no body.

Response

Status codes

Status Meaning
200 Success.
401 Missing or expired JWT.
403 The signed-in user's role does not allow this.
404 No such resource in this workspace.
429 Rate limited. See rate limits.

curl

Shell
curl -X GET 'https://api.dev.oprag.ai/v1/projects/{projectId}/widget-config' \
  -H 'Authorization: Bearer <Cognito JWT>'
PATCH /v1/projects/{projectId}/widget-config

Update widget display name, welcome message, lead capture settings, optional leadFormFields (Growth+: max 5 on Growth, 10 on Pro/Enterprise), and theme (primaryColor, position, mode: auto | light | dark)

Auth Cognito JWT admin

Path parameters

Name Type Required Description
projectId string Required Project the request applies to. Must belong to the calling workspace.

Query parameters

None.Everything it needs is in the request body.

Body parameters

Name Type Required Description
enabled boolean Optional Whether the feature is active.
displayName string Optional See the request example below.
welcomeMessage string Optional See the request example below.
quickPrompts string[] Optional Starter questions shown before the first message.
leadCaptureEnabled boolean Optional Offer the lead form when the documents cannot answer.
leadCaptureTitle string Optional Heading above the lead form.
leadCaptureFields "name" | "email"[] Optional Which built-in inputs to show.
feedbackEnabled boolean Optional Show thumbs up/down on answers. Defaults to on.
leadFormFields object[] Optional Additional custom fields. Growth and above.
theme object Optional Widget theme: primaryColor, position, mode.

Response

Status codes

Status Meaning
200 Success.
400 The request body failed validation.
401 Missing or expired JWT.
403 The signed-in user's role does not allow this.
404 No such resource in this workspace.
429 Rate limited. See rate limits.

curl

Shell
curl -X PATCH 'https://api.dev.oprag.ai/v1/projects/{projectId}/widget-config' \
  -H 'Authorization: Bearer <Cognito JWT>'
GET /v1/projects/{projectId}/channels/whatsapp

WhatsApp Business channel status for a project, with no secrets in it.

Auth Cognito JWT admin

Before you call it

  • status is disconnected, connected, or error. Before the first connection, connected and enabled are both false and status is disconnected.
  • No secrets are returned — this is a WhatsAppChannelStatus, in which tokenConfigured and webhookVerifyConfigured report only whether they exist.

Path parameters

Name Type Required Description
projectId string Required Project the request applies to. Must belong to the calling workspace.

Query parameters

None.Reads the resource named in the path; there is nothing else to select.

Body parameters

None.GET requests carry no body.

Response

200 Success

JSON
{
  "connected": true,
  "enabled": true,
  "phoneNumberId": "123456789",
  "displayPhoneNumber": "+15551234567",
  "wabaId": "987654321",
  "tokenConfigured": true,
  "webhookVerifyConfigured": true,
  "lastInboundAt": "2026-08-11T12:00:00.000Z",
  "status": "connected"
}

Status codes

Status Meaning
200 Success.
401 Missing or expired JWT.
403 The signed-in user's role does not allow this.
404 No such resource in this workspace.
429 Rate limited. See rate limits.

curl

Shell
curl -X GET 'https://api.dev.oprag.ai/v1/projects/{projectId}/channels/whatsapp' \
  -H 'Authorization: Bearer <Cognito JWT>'
POST /v1/projects/{projectId}/channels/whatsapp/connect

Attach a WhatsApp Business phone number to the project.

Auth Cognito JWT admin

Before you call it

  • Ownership of the number is verified against the Meta Graph API with the supplied token before anything is stored.
  • accessToken is encrypted at rest, which requires CHANNEL_TOKEN_ENCRYPTION_KEY to be configured.
  • Hub webhook verification always uses the global WHATSAPP_VERIFY_TOKEN, never a per-project one.
  • A successful connect returns the project's WhatsAppChannelStatus, exactly as GET …/channels/whatsapp would.

Path parameters

Name Type Required Description
projectId string Required Project the request applies to. Must belong to the calling workspace.

Query parameters

None.Everything it needs is in the request body.

Body parameters

Name Type Required Description
phoneNumberId string Required WhatsApp Business phone number id.
wabaId string Required WhatsApp Business account id.
accessToken string Required Long-lived access token. Encrypted at rest.
displayPhoneNumber string Optional Human-readable number to show in the dashboard. Defaults to the one Meta reports for phoneNumberId.

Request

JSON
{
  "phoneNumberId": "123456789",
  "wabaId": "987654321",
  "accessToken": "EAA...",
  "displayPhoneNumber": "+15551234567"
}

Response

200 Success

JSON
{
  "connected": true,
  "enabled": true,
  "phoneNumberId": "123456789",
  "displayPhoneNumber": "+15551234567",
  "wabaId": "987654321",
  "tokenConfigured": true,
  "webhookVerifyConfigured": true,
  "status": "connected"
}

Status codes

Status Meaning
200 Success.
400 A required field is missing, or Meta's ownership check for the number failed.
401 Missing or expired JWT.
403 The signed-in user's role does not allow this.
404 No such resource in this workspace.
409 That phone number is already connected somewhere else.
429 Rate limited. See rate limits.
503 Channel token encryption is not configured.

curl

Shell
curl -X POST 'https://api.dev.oprag.ai/v1/projects/{projectId}/channels/whatsapp/connect' \
  -H 'Authorization: Bearer <Cognito JWT>' \
  -H 'Content-Type: application/json' \
  -d '{"phoneNumberId": "123456789","wabaId": "987654321","accessToken": "EAA...","displayPhoneNumber": "+15551234567"}'
PATCH /v1/projects/{projectId}/channels/whatsapp

Pause or resume an existing WhatsApp connection without deleting its credentials.

Auth Cognito JWT admin

Before you call it

  • Returns the project's WhatsAppChannelStatus with the new enabled value.

Path parameters

Name Type Required Description
projectId string Required Project the request applies to. Must belong to the calling workspace.

Query parameters

None.Everything it needs is in the request body.

Body parameters

Name Type Required Description
enabled boolean Optional Pause or resume the channel without disconnecting it.

Request

JSON
{ "enabled": false }

Response

200 Success

JSON
{
  "connected": true,
  "enabled": false,
  "phoneNumberId": "123456789",
  "displayPhoneNumber": "+15551234567",
  "wabaId": "987654321",
  "tokenConfigured": true,
  "webhookVerifyConfigured": true,
  "status": "connected"
}

Status codes

Status Meaning
200 Success.
400 enabled is missing or is not a boolean.
401 Missing or expired JWT.
403 The signed-in user's role does not allow this.
404 WhatsApp channel is not connected — it was never connected.
429 Rate limited. See rate limits.

curl

Shell
curl -X PATCH 'https://api.dev.oprag.ai/v1/projects/{projectId}/channels/whatsapp' \
  -H 'Authorization: Bearer <Cognito JWT>' \
  -H 'Content-Type: application/json' \
  -d '{ "enabled": false }'
DELETE /v1/projects/{projectId}/channels/whatsapp

Disconnect WhatsApp from the project.

Auth Cognito JWT admin

Before you call it

  • Deletes both the connection row and the global phone_number_id lookup.

Path parameters

Name Type Required Description
projectId string Required Project the request applies to. Must belong to the calling workspace.

Query parameters

None.Acts on the resource named in the path; there is nothing to choose.

Body parameters

None.DELETE requests carry no body.

Response

Status codes

Status Meaning
204 Disconnected. The body is empty.
400 The request body failed validation.
401 Missing or expired JWT.
403 The signed-in user's role does not allow this.
404 WhatsApp channel is not connected — it was never connected.
429 Rate limited. See rate limits.

curl

Shell
curl -X DELETE 'https://api.dev.oprag.ai/v1/projects/{projectId}/channels/whatsapp' \
  -H 'Authorization: Bearer <Cognito JWT>'

Ready to ship?

Get started free