What's new, 30 November 2026: Platform API: know when a colleague is handling a conversation. A state endpoint, four conversation events, a gate for automated agents, and a way to mark a conversation handled.
WASync · Developers

OAuth2 for third-party apps

Only for apps that other WASync customers install. Authorization Code with PKCE, rotating refresh tokens, and one structural limit.

Skip this if you are automating your own account

An API key does everything in these docs with none of the machinery. OAuth is the right tool for exactly one job: your app is installed by other WASync customers, and those customers have to consent to connections they own.

Register the app

Register at https://developers.wasync.app/apps. You get a client_id and a client_secret (shown once), and you set one or more redirect_uri (matched exactly at token exchange), an optional webhook_url, and the scopes you need.

The flow

Authorization Code with PKCE — S256 is required. Send the user to /oauth/authorize with response_type=code, your client_id, redirect_uri, scope, a state and a code_challenge.

EndpointURL
Authorizehttps://cloudapi.wasync.app/oauth/authorize
Token (client_secret_post; none for clients that register themselves)https://cloudapi.wasync.app/oauth/token
Registration (RFC 7591)https://cloudapi.wasync.app/oauth/register
Discoveryhttps://cloudapi.wasync.app/.well-known/oauth-authorization-server

These URLs — and the MCP server URL — read cloudapi.wasync.app on purpose. They are protocol identifiers your client library and our discovery documents have already registered, so they must match byte-for-byte. Only the REST base URL and the human-facing pages use the canonical developers.wasync.app.

Bitrix24. WASync shows a short user code, and someone with Write access to the portal's API & Agents area enters it under Settings → API & Agents, picking connections and scopes. Every Bitrix24 administrator has that access; so does anyone an administrator has granted it to in the access matrix on the Staff page.

Next to the code, the person sees the name of the app and how long ago the request was started, and for an app registered in the console the address the access is sent to. An app that registered itself is marked Unverified app — it registered itself, its name is shown in quotes as not verified, and it always goes through the code.

Standalone. The developer approves at https://developers.wasync.app/authorize. The step is skipped — the request is approved automatically — only when the app's own developer account owns exactly one workspace and that workspace has at least one connection. An empty workspace always shows the code.

Your own app, your number in Bitrix24. The consent screen shows the code whenever your developer workspace is empty; type it in WASync inside Bitrix24 (Settings → API & Agents → Authorize an app or agent). If your developer workspace also has connections, add the standard prompt=consent parameter to the /oauth/authorize request: the code is then always shown and nothing is approved automatically, so you choose where the app is authorized.

Clients that register themselves

An MCP client does not need an app from the developer console: it can register itself at the registration endpoint (OAuth 2.0 Dynamic Client Registration, RFC 7591) and receives a client_id. Most clients do this on their own; see the MCP guide for Codex, Claude Code, Cursor and VS Code.

Register a public client
curl -X POST https://cloudapi.wasync.app/oauth/register \
  -H 'Content-Type: application/json' \
  -d '{
    "client_name": "My MCP client",
    "redirect_uris": ["http://127.0.0.1/callback"],
    "token_endpoint_auth_method": "none",
    "grant_types": ["authorization_code", "refresh_token"],
    "response_types": ["code"]
  }'

What such a client is, and is not:

  • A public client. No client_secret is issued. token_endpoint_auth_method is always none; the token request carries client_id, code, redirect_uri and the PKCE code_verifier, and no secret.
  • Redirect URIs (at most 5): http on 127.0.0.1, localhost or [::1] with any path, where the port is ignored when you authorize, so the client may listen on any free port. Or one of the hosted callbacks of Claude, ChatGPT, Cursor and VS Code. Any other address is refused with invalid_redirect_uri; register an app in the console for those.
  • Scopes: whatsapp.read and whatsapp.send at most. A wider request is narrowed to these two, and the scope in the registration and token responses says what you got.
  • MCP only. Its access tokens are issued for the MCP server (https://cloudapi.wasync.app/api/mcp). Asking for the REST API as the resource is refused with invalid_target.
  • Always approved by code. The person sees the app marked as unverified, with its name in quotes, and types the short code as described below. Nothing is approved automatically.

The request body is JSON, 8 KB at most. Registration and opening authorization requests are rate limited: a 429 on registration carries Retry-After, and an authorization request over the limit comes back to your redirect URI with error=temporarily_unavailable. A client that was registered but never authorized is removed after 30 days; register again when that happens. Errors follow RFC 7591: invalid_redirect_uri or invalid_client_metadata with an error_description.

Exchange the code

Token exchange
curl -X POST https://cloudapi.wasync.app/oauth/token \
  -d grant_type=authorization_code \
  -d code=$AUTH_CODE \
  -d redirect_uri=https://your.app/callback \
  -d client_id=$CLIENT_ID \
  -d client_secret=$CLIENT_SECRET \
  -d code_verifier=$CODE_VERIFIER

access_token lives 15 minutes. refresh_token lives 30 days and rotates on use — persist the new one atomically and serialise refreshes across workers, or two workers racing will invalidate each other's token.

The access token goes in the same header as an API key: Authorization: Bearer …. Both credential types reach every endpoint.

One structural limit

A grant is only ever issued over connections that already exist, so an OAuth-only integration cannot create a workspace's first connection. An API key can — which is why the quickstart starts with one.

Webhooks for OAuth apps

An OAuth app sets webhook_url on the app itself rather than calling PUT /webhook, and the grant must have been approved with whatsapp.events or nothing is delivered. Everything else — the signature scheme, the retry policy, the payloads — is identical to the Webhooks guide.

Subscriptions created before 24 July 2026 receive only message.received; those created before 10 August 2026 do not receive the connection events. Re-authorize to pick up the newer event types, or write to support and ask for them to be added to your existing subscription.

Was this page helpful?

On this page