# Agent Connectors Connect a Wiro agent to the services it works with: browse the connector catalog, connect a connector with its fields or its vendor's sign-in, pick the accounts it may act on, choose what it may do without asking, answer its approval requests, read each connection's state and disconnect it. Every call of the cycle, with its request and answer. ## Overview A connector gives an agent the tools of one outside service: Google search through Serper, a Shopify store, Google Ads, HubSpot, a Facebook Page. Each connector is one row of Wiro's connector catalog, named by its `slug`, such as `serper`, `shopify` or `facebook-pages`. You connect a connector to one agent at a time, in one of three ways. The first two always take your customer's own credentials: - **Fields.** The values the vendor issues, such as an API key, an app password or a store address, sent once with `ConnectorConnect`. Wiro stores them encrypted. Where the connector has a check, Wiro first makes one read call to the vendor with them and refuses values the vendor refuses. - **Sign-in.** The vendor's own consent screen in a browser. `ConnectorConnect` answers with an `authorizeUrl`; your customer opens it, agrees, and the vendor sends the browser back through Wiro to your page. Vendors whose sign-in needs an app of your own (Blogger, Gmail, Google Ads, Google Analytics 4, Google Business Profile, Google Merchant Center, Google Search Console, YouTube, Facebook Pages, Instagram, Meta Ads, Threads, LinkedIn, TikTok, X, Reddit, Pinterest, Tumblr, HubSpot, Mailchimp and Shopify) take that app's client id and secret with the connect. Google Calendar, Google Drive and Google Play Console don't sign in: they take a service account's JSON as a field. - **A Wiro project.** Wiro AI Models (`wiro`), Wiro's own model and task tools, takes one of your Wiro projects instead of values: see [Wiro AI Models](#the-wiro-connector). Once a connector is connected, the agent has the connector's tools, named `__`: a running agent gets them from its next message, with no restart. Values and tokens are never sent back in an answer and never reach the agent's chat. By default the agent runs the tools that only read, asks a person in the chat before it creates, sends, changes or deletes anything, and does those in its Scheduled Tasks without asking: see [Permissions and Approvals](#permissions-and-approvals). Every connector also has a public page, `https://wiro.ai/connectors/{slug}`, with its fields, setup steps, tools and the calls to connect it. ### The cycle at a glance | Step | Call | What you get | |------|------|--------------| | 1. Browse the catalog | [`POST /AgentConnector/List`](#post-agentconnectorlist) | Every available connector with its Connect fields and tools. No API key needed. | | 2. Read one connector | [`POST /AgentConnector/Detail`](#post-agentconnectordetail) | The same row for one `slug`. No API key needed. | | 3a. Connect with fields | [`POST /UserAgent/ConnectorConnect`](#connect-with-fields) with `values` | `status: "connected"`, and a running agent gets the connector with no restart. | | 3b. Or start a sign-in | [`POST /UserAgent/ConnectorConnect`](#connect-with-a-sign-in) with `redirecturl` | `status: "pending"` and the `authorizeUrl` to open in the browser. | | 4. The browser comes back | [`GET /AgentConnector/OAuthCallback`](#the-callback-and-your-redirect-url), called by the vendor | A redirect to your `redirecturl` with `connector_connected=true` or `connector_error=`. | | 5. Read the state | [`POST /UserAgent/ConnectorList`](#post-useragentconnectorlist) | Each connection's `status`: `connected`, `pending`, `reauth` or `error`. | | 6. Pick accounts | [`POST /UserAgent/ConnectorAccounts`](#post-useragentconnectoraccounts), [`POST /UserAgent/ConnectorSetAccounts`](#post-useragentconnectorsetaccounts) | The Pages, ad accounts, advertisers or properties the connection can reach, and the ones it may act on. | | 7. Choose what runs without asking | [`POST /UserAgent/ConnectorPermissions`](#post-useragentconnectorpermissions), [`POST /UserAgent/ConnectorSetPermissions`](#post-useragentconnectorsetpermissions) | Each tool's value in Chat and in Autopilot: `allow`, `ask` or `block`. | | 8. Answer approvals | [`POST /UserAgent/Message/ApprovalCardAct`](#post-useragentmessageapprovalcardact), or a [reply](#answering-with-a-reply) | An action that asked runs once (or from now on), or is declined, and the agent goes on in the chat. Answer the card with ApprovalCardAct, or reply `yes`, `always` or `no` in the chat; in Telegram, Slack and Discord, answer the agent's question there. | | 9. Disconnect | [`POST /UserAgent/ConnectorDisconnect`](#post-useragentconnectordisconnect) | The connection, its values and tokens deleted, and a running agent loses the connector with no restart. | ### Who your customer sees A sign-in you start with your project API key comes from your product. The vendor's consent screen shows your organization's name (else your team's name, else your account's name) and your organization's avatar when it is an https image, or, for a connector that signs in with an app of your own, that app's name and logo as you set them in the vendor's developer console. Wiro's own app signs in only from Wiro's own panel, and sign-ins started there show Wiro. One Wiro address can still show: the redirect URI, `https://api.wiro.ai/v1/AgentConnector/OAuthCallback`, which the browser passes through on its way back to your `redirecturl`. Some vendors show it on their consent screen, and some also show the address that identifies the sign-in's client, which is on the same API host. The help text of your own app's fields names the redirect URI too, since the app must register it: if your customers must not read it there, register the OAuth app yourself and keep the own-app fields out of the forms they fill in. Otherwise, the connector texts your customer may read (field labels, help texts, error sentences) name the vendor only. ## Authentication | Call | API key | Who may call it | |------|---------|-----------------| | `AgentConnector/List`, `AgentConnector/Detail` | Not needed | Anyone. A signed-in caller gets the same answer. | | `UserAgent/ConnectorList` | Required | The agent's owner, or a member of the agent's team. | | `UserAgent/ConnectorConnect`, `UserAgent/ConnectorAccounts`, `UserAgent/ConnectorSetAccounts`, `UserAgent/ConnectorDisconnect`, `UserAgent/ConnectorPermissions`, `UserAgent/ConnectorSetPermissions` | Required | The agent's owner, or an admin of the agent's team. | | `UserAgent/Message/ApprovalCardAct` | Required | The agent's owner, or a member of the agent's team who sees the card in the chat. `always` takes the owner or a team admin. See [Who may answer](#post-useragentmessageapprovalcardact). | | `AgentConnector/OAuthCallback` | None | The vendor's redirect in your customer's browser. You never call it. | Send your project API key in the `x-api-key` header, as on every other endpoint (see [Authentication](/docs/authentication)). Every answer has `result` and `errors: [{ code, message }]`; HTTP 200 with `result: false` is a refusal. The access refusals: | Code | Message | |------|---------| | `95` | `User agent not found` | | `96` | `You don't have access to this user agent` (ApprovalCardAct: `Only the agent's owner and its team can answer its approvals.`) | | `97` | `Only a team admin can perform this action on a team-owned agent.` (ApprovalCardAct's `always`: `Only an agent admin can allow this for good.`) | ## The Catalog ### **POST** /AgentConnector/List Lists every available connector, in display order (`sortorder`, then title), at most 500 rows. Public: no API key needed. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `search` | string | No | Matches the slug, title or description, ignoring case. At most 100 characters. | | `category` | string | No | One category: `ads`, `ai`, `analytics`, `commerce`, `content`, `crm`, `data`, `email`, `marketing`, `messaging`, `productivity`, `social` or `stores`. | ```bash curl -X POST "https://api.wiro.ai/v1/AgentConnector/List" \ -H "Content-Type: application/json" \ -d '{ "search": "facebook" }' ``` ##### Response ```json { "result": true, "errors": [], "agentconnectors": [ { "slug": "facebook-pages", "title": "Facebook Pages", "description": "Publish posts, photos and videos to your Facebook Pages and read their engagement.", "category": "social", "iconurl": "https://wiro.ai/images/icons/skills/facebook.svg", "websiteurl": "https://www.facebook.com", "authtype": "provider-oauth", "transport": "local", "credentialfields": [ { "name": "appid", "label": "App ID", "description": "1. Go to [Meta for Developers → My Apps](https://developers.facebook.com/apps/)\n2. Click **Create App** ...\n5. Add `https://api.wiro.ai/v1/AgentConnector/OAuthCallback` as a Valid OAuth Redirect URI", "required": true, "secret": false, "format": "text", "pattern": "^[0-9]+$", "serveronly": true, "mode": "oauth" }, { "name": "appsecret", "label": "App Secret", "description": "1. Go to [Meta for Developers](https://developers.facebook.com/apps/) → select your app\n2. Go to **App Settings → Basic** ...", "required": true, "secret": true, "format": "password", "serveronly": true, "mode": "oauth" }, { "name": "systemusertoken", "label": "System User Token", "description": "Use a token generated for a **Meta Business Manager System User** ...", "required": true, "secret": true, "format": "password", "mode": "key" } ], "accountpickers": [ { "key": "pages", "label": "Facebook Pages", "description": "The Pages the agent may post to, comment on and read insights of.", "multiple": true } ], "scopes": [ "pages_show_list", "pages_manage_posts", "publish_video", "pages_manage_engagement", "pages_read_engagement", "pages_read_user_content", "pages_manage_metadata", "pages_messaging", "read_insights" ], "modes": ["oauth", "key"], "wiroapp": false, "tools": [ { "name": "list_pages", "title": "List Facebook Pages", "description": "Lists the Facebook Pages this connection can use ...", "readonly": true, "destructive": false, "category": "read", "defaults": { "chat": "allow", "autopilot": "allow" } }, { "name": "create_post", "title": "Create a Facebook Page post", "description": "Publishes a text post on a Page, optionally with a link ...", "readonly": false, "destructive": false, "category": "create", "defaults": { "chat": "ask", "autopilot": "allow" } } ], "docs": { "overview": "Publish posts, photos and videos to your Facebook Pages and read their engagement.", "revoke": "Remove the app's access in your Facebook Pages account's connected apps settings, then disconnect it here." }, "sortorder": 110, "updatedat": 1795390000, "runs": "agent", "hosts": { "api": ["graph.facebook.com", "rupload.facebook.com"], "site": false, "uploads": [] } } ] } ``` The example is shortened: real help texts and tool descriptions are longer, and `tools` lists every tool. | Field | Description | |-------|-------------| | `slug` | The connector's name in every call: 2 to 30 lower-case letters, digits or dashes, starting with a letter. It never changes. | | `title`, `description` | Display name and one-line summary. | | `category` | One lower-case word for grouping, or `null`. | | `iconurl`, `websiteurl` | The vendor's logo and site, or `null`. | | `authtype` | How it connects: `fields` (values on a Connect card), `provider-oauth` (the vendor's sign-in with your own app, and for some vendors a key instead), `headers` (values the vendor's own MCP server takes, such as an API key), `oauth` (the vendor's own MCP server's sign-in: no app of yours needed, or, when `credentialfields` lists your app's keys as HubSpot's does, an app of yours at that server) or `none` (nothing to enter). | | `transport` | Where its tools run: `local` (inside the agent), `streamable-http` or `sse` (the vendor's own MCP server). Nothing you send depends on it. | | `credentialfields` | The Connect card: one entry per value to ask for. See [Connect card fields](#connect-card-fields). A `headers` row lists its values in the same shape. Never a value. | | `accountpickers` | The account lists a connection chooses from after it connects, each `{ key, label, description, multiple }`. Empty when there is nothing to pick. See [Account Pickers](#account-pickers). | | `scopes` | The OAuth scopes the sign-in asks for (`oauth` and `provider-oauth` rows). | | `modes` | `provider-oauth` rows only: `["oauth"]` (sign-in only) or `["oauth", "key"]` (a sign-in, or a key or token instead). Empty for other rows. | | `wiroapp` | `true` when the vendor can also be signed in with Wiro's own app, which only Wiro's own panel uses. With your API key you always send your own app's keys. | | `tools` | The tools the agent gets, each `{ name, title, description, readonly, destructive, category, defaults }`. `name` is the tool's name before the slug prefix. `readonly` and `destructive` say what the tool does; for a vendor's own MCP server they are the vendor's hints, with Wiro's corrections where a hint is wrong. `category` (`read`, `create` or `change`) and `defaults` (`{ chat, autopilot }`, each `allow`, `ask` or `block`) are what an agent's [permissions](#permissions-and-approvals) start from. A connector on a vendor's own MCP server (TikTok Ads, HubSpot, DataForSEO, lemlist, GitBook, HackMD and Wiro AI Models) lists no tools until an agent first connects it, by sign-in, key or project: its `tools` is `[]` until then. | | `docs` | Optional public page copy: `{ overview, setup, revoke, limits }` (`setup` is a list of steps), or `null`. | | `sortorder`, `updatedat` | Display order and the row's last change (Unix seconds). | | `runs` | `agent` when the connector's tools run inside the agent, which sends their requests straight to the vendor, or `vendor` when they run on the vendor's own MCP server, which the agent sends each request to. | | `hosts` | Where its requests go: `{ api, site, uploads }`. `api` lists the vendor's hosts (for `vendor`, its MCP server's host), `site` is `true` when the connector also calls the site your customer connects (WordPress, WooCommerce, Shopify, Mastodon), and `uploads` lists the hosts it may upload files to. | ### **POST** /AgentConnector/Detail One connector by its `slug`, in the same shape as a `List` row. Public: no API key needed. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `slug` | string | Yes | The connector's slug. | ```bash curl -X POST "https://api.wiro.ai/v1/AgentConnector/Detail" \ -H "Content-Type: application/json" \ -d '{ "slug": "serper" }' ``` ##### Response ```json { "result": true, "errors": [], "agentconnectors": [ { "slug": "serper", "title": "Serper", "description": "Google search results through Serper: organic results, answer box and related questions.", "category": "data", "iconurl": "https://wiro.ai/images/icons/skills/serper.svg", "websiteurl": "https://serper.dev", "authtype": "fields", "transport": "local", "credentialfields": [ { "name": "apikey", "label": "Serper API Key", "description": "1. Sign up at [serper.dev](https://serper.dev). No credit card; new accounts get **2,500 free searches**.\n2. Open the dashboard and copy your **API key** from the **API Key** section.\n3. Paste it here.", "required": true, "secret": true, "format": "password", "placeholder": "your Serper.dev API key" } ], "accountpickers": [], "scopes": [], "modes": [], "wiroapp": false, "tools": [ { "name": "web_search", "title": "Search the web (Google results via Serper)", "description": "Searches Google through Serper and returns the organic results (title, link, snippet, position, date), plus the answer box, knowledge graph, related questions and related searches when Google shows them.", "readonly": true, "destructive": false, "category": "read", "defaults": { "chat": "allow", "autopilot": "allow" } } ], "docs": { "overview": "Google search results through Serper: organic results, answer box and related questions." }, "sortorder": 380, "updatedat": 1795390000, "runs": "agent", "hosts": { "api": ["google.serper.dev", "api.serper.dev"], "site": false, "uploads": [] } } ] } ``` The example is shortened: the help text and the tool's description are longer, `tools` lists all 13 Serper tools, and `docs` also has `revoke`. A slug that is not in the catalog, or a connector that is no longer offered, answers `result: false` with `Connector not found.` ### Connect card fields Build your Connect form from `credentialfields`, in their order: | Field | Description | |-------|-------------| | `name` | The key to send in `values`. | | `label` | The field's label. | | `description` | Step-by-step help in Markdown (links, `**bold**`, `` `code` ``, numbered lists), never HTML. Render it as Markdown. Where the help names the redirect URI to register in your own app, the address is already filled in. | | `required` | The connect is refused while it has no value, sent now or saved before. | | `secret` | Mask the input, and never show a saved value: answers only list the names of saved values. | | `format` | The input to show and the check Wiro runs: `text`, `password`, `email`, `url` (an https address, or a bare host such as `shop.example.com`), `textarea` (several lines), `json` (a JSON value, or its text: a service account file, a structured list) or `select` (one of `options`). | | `options` | `select` only: `[{ value, label }]`. Send the `value`. | | `placeholder`, `pattern`, `maxlength` | Optional input hints. Wiro checks `pattern` (a regular expression) and `maxlength` too. A value is at most 65,536 characters. A `headers` connector's values are at most 4,096 characters each, on one line. | | `serveronly` | `true` for your own OAuth app's keys (client id and secret): Wiro uses them for the sign-in and its token refreshes only, and they never reach the agent. | | `mode` | `provider-oauth` rows, and the app keys of an `oauth` row that takes them (HubSpot): `oauth` (a field of the sign-in way: your own app's keys, or another value the sign-in needs, such as Reddit's Developer Profile Username) or `key` (the key way in, such as a Meta System User token). A field without `mode` belongs to both ways. Show the two ways as two choices on the card. | | `source` | `wiro_project` on the project field of Wiro AI Models (`wiro`): show a picker of your Wiro projects instead of an input, and send the chosen project's id as `wiroprojectguid`, never in `values`. See [Wiro AI Models](#the-wiro-connector). | ## Connecting Every way goes through one call, `POST /UserAgent/ConnectorConnect`. The connector's `authtype` and `modes` from the catalog tell you which body to send. | `authtype` | Send | Answer | |------------|------|--------| | `fields`, `headers` | `values` for its `credentialfields` (never a `wiro_project` field) | `connected` | | `headers` with a `source: "wiro_project"` field (Wiro AI Models, `wiro`) | `wiroprojectguid`, the id of one of your projects (a request made with a project API key may leave it out: see [Wiro AI Models](#the-wiro-connector)) | `connected` | | `none` | nothing but `useragentguid` and `slug` | `connected` | | `provider-oauth` with `mode: "key"` | `values` of the `key` way | `connected` | | `provider-oauth` (`mode` `oauth`, the default) | the sign-in's fields in `values` (no `mode` or `mode: "oauth"`: your app's keys and any other, such as Shopify's Shop Domain or LinkedIn's Organization ID), and `redirecturl` | `pending` and `authorizeUrl` | | `oauth` | `redirecturl` | `pending` and `authorizeUrl` | | `oauth` whose `credentialfields` are your app's keys (HubSpot) | those keys in `values`, and `redirecturl` | `pending` and `authorizeUrl` | ### **POST** /UserAgent/ConnectorConnect | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `useragentguid` | string | Yes | The agent. | | `slug` | string | Yes | The connector. It must be in the catalog: otherwise `This connector is not available.` | | `values` | object | No | `{ : value }` from `credentialfields`. A field you leave out keeps its saved value; `""` or `null` clears it. Numbers and booleans are taken as text, and a `json` field also takes an object or array. | | `mode` | string | No | `provider-oauth` rows only: `oauth` (the default, a sign-in) or `key` (the key way in, when `modes` includes `key`). | | `redirecturl` | string | No | Sign-ins only: where the browser returns. See [The redirect URL](#the-redirect-url). | | `accounts` | object | No | A first account selection for a connector with [account pickers](#account-pickers), `{ : [ids] }`, such as `{ "pages": ["123"] }`. Only its shape is checked here; [ConnectorSetAccounts](#post-useragentconnectorsetaccounts) checks every id with the vendor once the connector is connected. | | `wiroprojectguid` | string | No | Wiro AI Models (`wiro`) only: the id of one of your projects, from [`POST /Project/List`](/docs/projects). It becomes the agent's own Wiro project, as [`CredentialProjectBind`](/docs/agent-overview#post-useragentcredentialprojectbind) binds it. See [Wiro AI Models](#the-wiro-connector). A connector whose tools run inside the agent refuses it; one on a vendor's own MCP server ignores it. | ### Connect with fields Send every required field in `values`. Serper takes one API key: ```bash curl -X POST "https://api.wiro.ai/v1/UserAgent/ConnectorConnect" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "useragentguid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "slug": "serper", "values": { "apikey": "YOUR_SERPER_API_KEY" } }' ``` ##### Response ```json { "result": true, "errors": [], "status": "connected", "applied": 1, "restart": "live", "useragentconnectors": [ { "slug": "serper", "title": "Serper", "iconurl": "https://wiro.ai/images/icons/skills/serper.svg", "category": "data", "authtype": "fields", "transport": "local", "authmode": null, "catalogstatus": "active", "status": "connected", "connectedat": 1795390000, "updatedat": 1795390000, "tokenexpiresat": null, "refreshtokenexpiresat": null, "scope": null, "accounts": {}, "wiroprojectid": null, "savedvariables": ["apikey"], "lasterror": null } ] } ``` | Field | Description | |-------|-------------| | `status` | `connected`. | | `applied` | `1` when something changed, `0` when you sent what was already saved: then nothing restarts. | | `restart` | `live` (the running agent got the change with no restart: it uses the connector from its next message), `scheduled` (it restarts to pick up the connector), `none` (it was not running, or nothing changed) or `failed` (the change is saved, but the restart could not be scheduled: restart the agent yourself). See [Live Changes and Restarts](#live-changes-and-restarts). | | `useragentconnectors` | The connection as [ConnectorList](#post-useragentconnectorlist) shows it. | **The credential check.** Where the connector has one, Wiro makes one read call to the vendor with the values before it saves them. When the vendor refuses them, nothing is saved and the answer carries the vendor's own sentence: ```json { "result": false, "errors": [{ "code": 0, "message": "" }] } ``` Show that sentence next to the form: it names the vendor only. **Changing a value later.** Send only the fields that change: the others keep their saved values. To replace a key, send the new one; to remove an optional value, send `""`. A `headers` connector (a vendor's own MCP server that takes a key or login: lemlist (`apikey`), DataForSEO (`login`, `password`), GitBook and HackMD (`token`)) connects the same way: its `credentialfields` are the values it takes, each named by its `name`. Their labels are made from those names, in Title Case (`API Key`, `Login`, `Password`, `Token`), and a secret value has `format: "password"`: DataForSEO's `login` is not a secret (`secret: false`, `format: "text"`); its `password` is. Its values are at most 4,096 characters each, on one line, and its refusals name the value by that `name` (`apikey is required.`). It has no credential check: the vendor's server answers the agent's first call. DataForSEO's fields on [Detail](#post-agentconnectordetail): ```json "credentialfields": [ { "name": "login", "label": "Login", "description": "Keyword, search and app store data from your own [DataForSEO](https://dataforseo.com) account. 1. Sign in to [DataForSEO](https://app.dataforseo.com) and open **API Access** ...", "required": true, "secret": false, "format": "text" }, { "name": "password", "label": "Password", "description": "The **API password** is not the password you sign in with: DataForSEO generates a separate one for the API. ...", "required": true, "secret": true, "format": "password" } ] ``` Send both in `values`: ```bash curl -X POST "https://api.wiro.ai/v1/UserAgent/ConnectorConnect" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "useragentguid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "slug": "dataforseo", "values": { "login": "YOUR_DATAFORSEO_API_LOGIN", "password": "YOUR_DATAFORSEO_API_PASSWORD" } }' ``` ```json { "result": true, "errors": [], "status": "connected", "applied": 1, "restart": "live", "useragentconnectors": [ { "slug": "dataforseo", "title": "DataForSEO", "iconurl": "https://wiro.ai/images/icons/skills/dataforseo.svg", "category": "data", "authtype": "headers", "transport": "streamable-http", "authmode": null, "catalogstatus": "active", "status": "connected", "connectedat": 1795390000, "updatedat": 1795390000, "tokenexpiresat": null, "refreshtokenexpiresat": null, "scope": null, "accounts": {}, "wiroprojectid": null, "savedvariables": ["login", "password"], "lasterror": null } ] } ``` ### Connect with a key instead of a sign-in Some vendors that sign in with your own app also take a key or token (`modes: ["oauth", "key"]`): a Meta Business Manager System User token for Facebook Pages, Instagram and Meta Ads, a Mailchimp API key, a Shopify custom app's client credentials. Send `mode: "key"` and the fields of that way (`mode: "key"` or no `mode`): ```json { "useragentguid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "slug": "facebook-pages", "mode": "key", "values": { "systemusertoken": "EAAB..." } } ``` ##### Response ```json { "result": true, "errors": [], "status": "connected", "applied": 1, "restart": "live", "useragentconnectors": [ { "slug": "facebook-pages", "title": "Facebook Pages", "iconurl": "https://wiro.ai/images/icons/skills/facebook.svg", "category": "social", "authtype": "provider-oauth", "transport": "local", "authmode": "key", "catalogstatus": "active", "status": "connected", "connectedat": 1795390000, "updatedat": 1795390000, "tokenexpiresat": null, "refreshtokenexpiresat": null, "scope": null, "accounts": {}, "wiroprojectid": null, "savedvariables": ["systemusertoken"], "lasterror": null } ] } ``` The answer has the fields of [Connect with fields](#connect-with-fields), with `authmode: "key"` on the connection. Fields of the other way are not kept: a connection holds either a sign-in or a key. A vendor that only signs in refuses `mode: "key"` with `This connector connects only by signing in.` Facebook Pages has account pickers: choose its Pages next, as in [Account Pickers](#account-pickers). ### Connect with a sign-in A sign-in takes four steps: start it, open the vendor's page, let the vendor send the browser back, and read the outcome on your page. **1. Start it.** For a `provider-oauth` connector, and for HubSpot, send your own app's keys (the `serveronly` fields with `mode: "oauth"`, or no `mode`) and any other field the sign-in needs, such as Shopify's shop domain. Keys saved by an earlier connect are used again when you leave them out. Register the redirect URI the field help names in your app first: `https://api.wiro.ai/v1/AgentConnector/OAuthCallback`. HubSpot signs in on its own MCP server, `https://mcp.hubspot.com`: its app is an MCP connector you create in your HubSpot account (**Development** → **MCP Connectors** → **Create MCP connector**), with a name, which HubSpot shows on its consent screen, and the redirect URI as its **Redirect URL**. After **Create**, the connector's details page has the **Client ID** and **Client Secret** to send. From Wiro's own panel, HubSpot can also sign in with Wiro's own HubSpot app, with nothing to type; a request made with your API key always takes your own app's keys. ```bash curl -X POST "https://api.wiro.ai/v1/UserAgent/ConnectorConnect" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "useragentguid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "slug": "facebook-pages", "values": { "appid": "1234567890", "appsecret": "YOUR_APP_SECRET" }, "redirecturl": "https://app.example.com/agents/42/connectors?slug=facebook-pages" }' ``` ##### Response ```json { "result": true, "errors": [], "status": "pending", "authorizeUrl": "https://www.facebook.com/v26.0/dialog/oauth?client_id=1234567890&redirect_uri=https%3A%2F%2Fapi.wiro.ai%2Fv1%2FAgentConnector%2FOAuthCallback&state=7f3c...&response_type=code&scope=pages_show_list%2Cpages_manage_posts" } ``` An `oauth` connector with no fields, a vendor's own MCP server with its own sign-in such as TikTok Ads, needs no app of yours: send `useragentguid`, `slug` and `redirecturl` only. Its consent screen names your organization. ```bash curl -X POST "https://api.wiro.ai/v1/UserAgent/ConnectorConnect" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "useragentguid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "slug": "tiktok-ads", "redirecturl": "https://app.example.com/agents/42/connectors?slug=tiktok-ads" }' ``` ```json { "result": true, "errors": [], "status": "pending", "authorizeUrl": "https://business-api.tiktok.com/portal/mcp-tt4b-authorize?response_type=code&client_id=...&redirect_uri=https%3A%2F%2Fapi.wiro.ai%2Fv1%2FAgentConnector%2FOAuthCallback&state=...&code_challenge=...&code_challenge_method=S256&resource=...&scope=mcp%3Att4b" } ``` TikTok Ads has an account picker: once it is connected, pick the advertisers it may act on, as in [TikTok Ads: sign in, then pick advertisers](#tiktok-ads-sign-in-then-pick-advertisers). The connection is now `pending`. A connection that was already `connected` stays connected while the new sign-in runs, and the new tokens replace the old ones when it finishes. **2. Open `authorizeUrl`** in your customer's browser: a new tab, a popup, or the same window. The address works for 10 minutes and once. Start a new sign-in to get a fresh one. **3. The vendor sends the browser back.** After your customer agrees, the vendor redirects to Wiro's callback, `GET /AgentConnector/OAuthCallback`. Wiro exchanges the code for tokens, stores them encrypted, marks the connection `connected`, gives the connector to a running agent, and redirects the browser to your `redirecturl`. **4. Read the outcome on your page.** See [The callback and your redirect URL](#the-callback-and-your-redirect-url). ### The callback and your redirect URL Wiro adds one parameter to your `redirecturl`, with `?`, or `&` when it already has a query: | Parameter | Meaning | |-----------|---------| | `connector_connected=true` | The connection is connected. A running agent has the connector from its next message, or once a restart it needed is done. | | `connector_error=` | The sign-in did not finish. A new connection is left `error` (or still `pending`); one that was connected before stays connected. | ``` https://app.example.com/agents/42/connectors?slug=facebook-pages&connector_connected=true https://app.example.com/agents/42/connectors?slug=facebook-pages&connector_error=authorization_denied ``` The return carries no slug or agent of its own, so put what your page needs in `redirecturl` itself, as `slug` above. Then confirm with [ConnectorList](#post-useragentconnectorlist) before you show the connector as connected, and open the [account pickers](#account-pickers) when it has any. | `connector_error` | What happened | What to show | |-------------------|---------------|--------------| | `authorization_denied` | Your customer declined on the vendor's page, or the vendor sent an error. | The sign-in was cancelled; offer to try again. | | `session_expired` | The sign-in took longer than 10 minutes. | Start the sign-in again. | | `token_exchange_failed` | The vendor did not issue tokens for the code: often your app's keys, its redirect URI, or a scope the app lacks. | Ask your customer to check the app's keys and redirect URI, then try again. | | `oauth_app_missing`, `oauth_app_changed` | The app keys the sign-in started with were removed or changed meanwhile. | Start the sign-in again with the current keys. | | `invalid_signature`, `invalid_shop` | The vendor's signed callback did not match (Shopify). | Start again from the same shop. | | `invalid_state` | The callback did not match its sign-in. | Start the sign-in again. | | `connector_unavailable` | The connector left the catalog meanwhile. | The connector is not available. | | `useragent_not_found` | The agent is gone, or whoever started the sign-in no longer manages it. | Reload the agent. | | `internal_error` | Something went wrong on Wiro's side. | Try again. | A callback whose sign-in is unknown (no `state`, or one Wiro never issued) ends on Wiro's own "sign-in not finished" page, because there is no `redirecturl` to return to. A repeated callback, such as a reload of the vendor's last page, follows the first one's redirect for an hour. ### The redirect URL - `redirecturl` must be an `https` address on any host, or `http` on `localhost` or `127.0.0.1` while you develop. Anything else is refused with `Invalid redirect URL`. - Send your own page with every sign-in, from a [setup card](/docs/agent-chat-integration#sign-in-hubspot) too. Without one, the browser comes back to Wiro's own connect-return page on wiro.ai. - It is used exactly as you send it, with your own query kept. ### Live Changes and Restarts A connect that changes something, a new account selection, a [permission change](#post-useragentconnectorsetpermissions) and a disconnect of a connected connector reach a running agent with no restart: `restart: "live"` in the answer, and for a sign-in, `connector_connected=true` on your page. The agent keeps running, a reply it is writing goes on, and its next message uses the change. When a change can't be applied that way, Wiro restarts the agent instead and the answer reads `restart: "scheduled"`: the agent's `status` on [`POST /UserAgent/Detail`](/docs/agent-overview#post-useragentdetail) then goes `1` (stopping), `2` (queued), `3` (starting) and back to `4` (running), in a minute or two, and a message sent meanwhile is refused with a sentence you can show. Connecting [Wiro AI Models](#the-wiro-connector) with another project restarts the agent too, as binding a project does. See [Live Changes and Restarts](/docs/agent-chat-integration#live-changes-and-restarts) for what to show. A stopped agent loads the change when it next starts. ## Connection State ### **POST** /UserAgent/ConnectorList Every connection of one agent, including sign-ins under way and ones that need attention. Names and states only, never a value or token. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `useragentguid` | string | Yes | The agent. | ```bash curl -X POST "https://api.wiro.ai/v1/UserAgent/ConnectorList" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "useragentguid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }' ``` ##### Response ```json { "result": true, "errors": [], "useragentconnectors": [ { "slug": "serper", "title": "Serper", "iconurl": "https://wiro.ai/images/icons/skills/serper.svg", "category": "data", "authtype": "fields", "transport": "local", "authmode": null, "catalogstatus": "active", "status": "connected", "connectedat": 1795390000, "updatedat": 1795390000, "tokenexpiresat": null, "refreshtokenexpiresat": null, "scope": null, "accounts": {}, "wiroprojectid": null, "savedvariables": ["apikey"], "lasterror": null }, { "slug": "facebook-pages", "title": "Facebook Pages", "iconurl": "https://wiro.ai/images/icons/skills/facebook.svg", "category": "social", "authtype": "provider-oauth", "transport": "local", "authmode": "own", "catalogstatus": "active", "status": "connected", "connectedat": 1795390400, "updatedat": 1795390460, "tokenexpiresat": 1800574400, "refreshtokenexpiresat": null, "scope": "pages_show_list pages_manage_posts publish_video pages_manage_engagement pages_read_engagement pages_read_user_content pages_manage_metadata pages_messaging read_insights", "accounts": { "pages": ["123456789012345"] }, "wiroprojectid": null, "savedvariables": ["appid", "appsecret"], "lasterror": null } ] } ``` | Field | Description | |-------|-------------| | `slug`, `title`, `iconurl`, `category`, `authtype`, `transport` | The connector, as the catalog shows it. | | `authmode` | `provider-oauth` rows and HubSpot: `own` (signed in with your app), `wiro` (signed in from Wiro's own panel) or, on `provider-oauth` rows, `key` (connected with a key or token). `null` for other rows, and on a HubSpot connection that has not signed in since HubSpot moved to its own MCP server. | | `catalogstatus` | `active` while the connector is offered. `hidden` or `retired` when it left the catalog: the agent no longer gets its tools, and only a disconnect is left. | | `status` | See the table below. | | `connectedat`, `updatedat` | When the connection last connected, and its last change (Unix seconds). | | `tokenexpiresat`, `refreshtokenexpiresat` | Sign-in connections: when the access token and the refresh token expire, or `null`. Wiro refreshes the access token on its own, except on a Facebook Pages or Meta Ads sign-in: Meta's token lasts about 60 days and cannot be refreshed, so when it runs out, the connector's next use (or an account listing) sets the connection to `reauth` with `lasterror: "token_not_refreshable"`, and your customer signs in again. A System User token (`mode: "key"`) set never to expire avoids this. | | `scope` | The scopes the vendor granted, as it sent them. When the vendor's token answer names none, as Facebook's does, the scopes Wiro asked for, separated by spaces. | | `accounts` | The account selection, `{ : [ids] }`. | | `wiroprojectid` | Wiro AI Models (`wiro`) only: the agent's own Wiro project, the one the connector acts with, as a string, or `null` when the agent has none. See [Wiro AI Models](#the-wiro-connector). | | `savedvariables` | The names of the values saved for this connection, sorted. Use them to mark fields as saved; their values are never shown. | | `lasterror` | A short code for the last failure, such as `authorization_denied`, or `null`. Never a secret. | | `status` | Meaning | What to show | |----------|---------|--------------| | `connected` | The agent has the connector's tools. | Connected, with Disconnect and, when it has pickers, the account choice. | | `pending` | A sign-in was started and has not come back yet, or the connection misses a required value. | Waiting for the sign-in, with a way to start it again; or the form, to send the missing value with ConnectorConnect. | | `reauth` | The sign-in expired or was revoked at the vendor: refreshing it failed (`lasterror` is a code: `token_not_refreshable` when a Facebook Pages or Meta Ads sign-in's 60-day token ran out), or the vendor's own MCP server refused it with HTTP 401 or 403 as Wiro listed the connection's accounts (`lasterror: "unauthorized"`; `"no_access_token"` when the connection held no token to send). Or the connection holds a way in the connector no longer takes (`lasterror: "auth_changed"`): a Gmail app password, a HubSpot sign-in made before HubSpot moved to its own MCP server, or a sign-in with Wiro's own app on a connector whose `wiroapp` is `false`; sign in again with an OAuth app of your own. Until the agent next restarts or gets a change, the connector's tools answer that it must be connected again; after that, the agent no longer has them. | Reconnect: start a new sign-in with ConnectorConnect. | | `error` | The last sign-in failed (`lasterror` says how). | Connect again. | A connector that was never connected, or was disconnected, has no row. ## Account Pickers Some connectors act on accounts inside the vendor: Adjust (apps), App Store Connect (apps), Blogger (blogs), Facebook Pages (Pages), Google Ads (accounts), Google Analytics 4 (properties), Google Business Profile (accounts and locations), Google Drive (folders), Google Merchant Center (accounts), Google Play Console (apps), Google Search Console (properties), Instagram (accounts), Meta Ads (ad accounts, and the Facebook Pages its ads use), Roasit (apps), TikTok Ads (advertisers), Tumblr (blogs) and YouTube (channels). Their catalog row lists `accountpickers`: build the pickers from that field, not from this list. After the connection is `connected`, list the candidates, let your customer choose, and save the choice. The connector's tools refuse any account outside the selection, and until something is picked they have no account to act on. Connectors of both kinds can have account pickers. Wiro lists the candidates with one of the connector's read tools and the connection's own credentials. For a connector whose tools run on the vendor's own MCP server, such as TikTok Ads, Wiro calls that tool on the vendor's server with the connection's sign-in: see [TikTok Ads: sign in, then pick advertisers](#tiktok-ads-sign-in-then-pick-advertisers). A connector with no pickers has an empty `accountpickers`. ### **POST** /UserAgent/ConnectorAccounts Lists each picker's candidates now, from the vendor, with the connection's own credentials (a sign-in due for a refresh is refreshed first), and the current selection. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `useragentguid` | string | Yes | The agent. | | `slug` | string | Yes | A connected connector. | ```bash curl -X POST "https://api.wiro.ai/v1/UserAgent/ConnectorAccounts" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "useragentguid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "slug": "facebook-pages" }' ``` ##### Response ```json { "result": true, "errors": [], "pickers": [ { "key": "pages", "label": "Facebook Pages", "description": "The Pages the agent may post to, comment on and read insights of.", "multiple": true, "candidates": [ { "id": "123456789012345", "name": "Acme Coffee" }, { "id": "234567890123456", "name": "Acme Coffee Berlin" } ], "selected": ["123456789012345"] } ] } ``` | Field | Description | |-------|-------------| | `key` | The picker's key in `accounts`. | | `label`, `description` | What to call the list. | | `multiple` | `true`: any number of candidates. `false`: at most one. | | `candidates` | What this connection can reach at the vendor right now, each `{ id, name }`. | | `selected` | The ids saved now. | A connector with no pickers answers `pickers: []` when its tools run inside the agent, and `This connector has no accounts to pick.` when they run on the vendor's own MCP server. ### **POST** /UserAgent/ConnectorSetAccounts Saves the accounts the connection may act on. Wiro lists the candidates again and refuses any id that is not among them. | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `useragentguid` | string | Yes | The agent. | | `slug` | string | Yes | A connected connector. | | `accounts` | object | Yes | `{ : [ids] }`. A picker you leave out keeps its selection; send `[]` to clear one. At most 10 keys and 500 ids per key, each id up to 200 characters. | ```bash curl -X POST "https://api.wiro.ai/v1/UserAgent/ConnectorSetAccounts" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "useragentguid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "slug": "facebook-pages", "accounts": { "pages": ["123456789012345", "234567890123456"] } }' ``` ##### Response ```json { "result": true, "errors": [], "accounts": { "pages": ["123456789012345", "234567890123456"] }, "applied": 1, "restart": "live", "useragentconnectors": [ { "slug": "facebook-pages", "title": "Facebook Pages", "iconurl": "https://wiro.ai/images/icons/skills/facebook.svg", "category": "social", "authtype": "provider-oauth", "transport": "local", "authmode": "own", "catalogstatus": "active", "status": "connected", "connectedat": 1795390400, "updatedat": 1795390520, "tokenexpiresat": 1800574400, "refreshtokenexpiresat": null, "scope": "pages_show_list pages_manage_posts publish_video pages_manage_engagement pages_read_engagement pages_read_user_content pages_manage_metadata pages_messaging read_insights", "accounts": { "pages": ["123456789012345", "234567890123456"] }, "wiroprojectid": null, "savedvariables": ["appid", "appsecret"], "lasterror": null } ] } ``` `accounts` is the whole selection after the change. `applied` is `0`, and nothing restarts, when the selection did not change. | Refusal | Why | |---------|-----| | `Unknown account picker: . This connector has: pages.` | A key the connector does not have. | | `