Switched on per partner.
GET /api/partner/connect/settings tells you whether
it is on for you and which providers you can use./api/partner, authenticated by your partner key as
X-API-KEY, from your backend only.
What you can connect
When the sign-in gives access to just one account, it is connected straight
away, with no picker. For publishing providers,
provider is the same value the
Publishing API returns in an account’s provider field.
Which providers are available depends on how OnlySocial is configured, so ask
rather than assume:
GET /api/partner/connect/settings returns the list. A
provider that is not on it is refused with a 422 and
"error_code": "provider_not_supported".1. Read the settings and register your return URLs
Response
entitiesistruewhen your customer ticks accounts after signing in.configuredisfalsewhen OnlySocial is not set up for that provider yet. A link for it fails at the start withprovider_not_configured.asks_fornames what the hosted page asks your customer for when you did not send it (serverfor Mastodon,handle, optional, for Bluesky), and what a Telegram call needs (bot_token).
PUT. Matching is exact, including the path and any
trailing slash. Removing a URL also stops unfinished sessions from completing
against it.
2. Check the allowance
A workspace’s plan limits how many publishing accounts it can connect. Ask before you show your customer a Connect button:Response
limitandremainingarenullwhen the plan sets no account limit.providerssays, per provider, whether a new account may be added now. WhatsApp numbers and Telegram bots have their own limits, checked when they are stored, so they always readtruehere.
false is refused at once
with a 422 and "error_code": "account_limit_reached", before your customer
signs in anywhere. A reconnect never uses a new slot, so it is never refused for
the limit.
3. Create a connection
Response
connect_url as a top-level navigation in your customer’s browser,
not an iframe and not a fetch. Everything after they click Continue is bound to
that browser. The session lasts 30 minutes.
Optional fields:
state comes back to you on the return URL and in the completion events, so
use it to match the session to your own customer. Do not put secrets or
personal data in it; at most 500 characters.
Idempotency-Key (1–200 characters) is optional. The same key and the same
request returns the same connection with 200; a different request on that key
is a 409. Only a pending, unexpired session carries a connect_url. Use a
new key to start over.
4. Read the result
Your customer comes back to your registered URL withconnection_id and
state. That redirect is a hint, not the answer. Read the authoritative result:
On
connected:
accountslists every account connected, in the order the provider listed them. Each hasid,uuid,provider,nameandusername. A WhatsApp number is listed here too.account_idandaccountare the first of them, for code that reads one.uuidis the{account}in the Publishing API’sGET /accounts/{account}.idis the integer the Publishing API’s post endpoints take inaccounts.skippedlists accounts your customer ticked that were not connected, each withnameandreason(for exampleaccount_limit_reachedwhen the plan had room for fewer).channel_idis the messaging channel, when there is one: a WhatsApp number or Telegram bot always has one; a publishing account has one when the workspace has an inbox and the network supports messaging. It isnullotherwise, and that is not an error.
connected means the number was stored and subscribed. Whether
messages actually flow still depends on Meta account eligibility and messaging
rules.
POST /api/partner/workspaces/{workspace}/connections/{connection}/cancel
cancels an unfinished session. Repeating it is safe, and it never disconnects an
account or channel that already connected.
Reconnect
When an account or channel stops working (an expired or revoked sign-in), send your customer a reconnect link: create a connection with its uuid.account_id: a publishing account of that workspace and thatprovider.channel_id: a messaging channel. A WhatsApp channel is reconnected through WhatsApp’s signup; a channel that belongs to an account (a Page’s Messenger, an Instagram account) reconnects that account, so send that account’sprovider.
- If they sign in as a different one, nothing is changed and the session fails
with
reconnection_target_mismatch. - For a Page, channel or location, there is no picker on a reconnect. The
sign-in must have access to that same Page, channel or location, or the
session fails with
reconnection_target_mismatch. - A target that is not in that workspace, or not that provider’s, is a
422. - WhatsApp is the one exception: the number is picked inside Meta’s dialog. If
your customer picks a different number, that number is connected, and the
session fails with
reconnection_target_mismatchand the newchannel_id, so you can decide what to do.
When the profile cannot be proven
Some providers give a different user id to each app, so after OnlySocial moves apps a reconnect cannot always prove it is the same profile. By default such a reconnect fails withreconnect_needs_confirmation and nothing is changed.
If you know who your customer is, send "allow_unverified": true with the
reconnect. The hosted page then shows the account being reconnected and the
profile they signed in as, and your customer confirms or refuses. A profile
proven to be a different one is still refused.
Telegram
Telegram has no sign-in screen, so there is no link: you collect the bot’s BotFather token in your software and send it.connected, with the bot’s
channel_id, and meta.webhook_registered / meta.webhook_taken_over. 201
for a new bot, 200 for the same bot again (its channel is refreshed, not
duplicated). The token is never stored on the connection or echoed back.
- A
422onbot_tokenmeans the token was rejected, or the bot is OnlySocial’s own bot, or it is already connected to another workspace, or the plan’s limit is reached. - A
422ontakeovermeans the bot’s webhook points somewhere else. Connecting it here stops that from receiving the bot’s messages, so resend with"takeover": trueonly if your customer confirms.
Read channels
GET /api/partner/workspaces/{workspace}/channels:per_pageup to 100.GET /api/partner/workspaces/{workspace}/channels/{channel}
Or subscribe
Rather than polling, subscribe the workspace’s webhooks (with theosk_ key you
issued for it) to publishing.account.connection.completed, .failed,
.cancelled and .expired. Every connection sends them. See
Events.
A connection that has a messaging channel (WhatsApp, Telegram, Facebook Pages,
Instagram, TikTok, YouTube, LinkedIn pages, Google Business Profile, Threads,
Reddit, Mastodon and Bluesky) also sends salesbot.channel.connection.*, with
the same connection id, so a subscriber that only listens to messaging events
hears about it too.
Delivery is at least once. Deduplicate on the envelope’s id.
Error codes
Provider error bodies are deliberately not exposed. Fix the configuration, or
let your customer retry with a new session.
Keep it safe
- The partner key stays on your server. It can act on every workspace you have provisioned.
connect_urlcarries a one-session capability and lasts 30 minutes. Hand it straight to the customer’s browser; do not log it, e-mail it or put it in an analytics event. To invite a customer by e-mail (a reconnect reminder, say), e-mail a link to your own app and create the connection when they arrive.- A Telegram bot token is a credential: send it from your server only, and do not keep it once the bot is connected.
- A connection id is not a secret, but your
stateshould be unguessable if you use it to resume anything on your side. - Send
allow_unverifiedonly when your own records tie the link to the account’s owner: a confirmed reconnect hands the account’s scheduled posts to the profile that signed in.
