Skip to content

Commit 4b778cb

Browse files
fix(SOL-418): stackone-connect - update stale docs links and hub guidance
- point to embed/account-linking, connect-session, auth-link, handle-account-events - add llms.txt + hub README fallback, web component - drop hub-reference.md (duplicated docs) - skill version 2.1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1011b56 commit 4b778cb

2 files changed

Lines changed: 51 additions & 101 deletions

File tree

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,46 @@
11
---
22
name: stackone-connect
3-
description: Implement account linking using StackOne Connect Sessions and the Hub React component. Use when user asks to "connect a provider", "embed the integration picker", "add BambooHR to my app", "create a connect session", "set up auth links", or "handle account webhooks". Covers the full flow from session creation to webhook handling. Do NOT use for making API calls after linking (use stackone-platform) or building AI agents (use stackone-agents).
3+
description: Implement account linking using StackOne Connect Sessions and the StackOne Hub. Use when user asks to "connect a provider", "embed the integration picker", "add BambooHR to my app", "create a connect session", "set up auth links", or "handle account webhooks". Covers the full flow from session creation to webhook handling. Do NOT use for making API calls after linking (use stackone-platform) or building AI agents (use stackone-agents).
44
license: MIT
55
compatibility: Requires network access to fetch live documentation from docs.stackone.com
66
metadata:
77
author: stackone
8-
version: "2.0"
8+
version: "2.1"
99
---
1010

1111
# StackOne Connect — Account Linking
1212

1313
## Important
1414

1515
Before writing code, fetch the latest documentation:
16-
1. Fetch `https://docs.stackone.com/guides/connect-tools-overview` for the current connection flow
17-
2. Fetch `https://www.npmjs.com/package/@stackone/hub` for the latest Hub component API
16+
1. Fetch `https://docs.stackone.com/embed/account-linking/overview.md` for the current linking flow and the ways to embed the Hub
17+
2. Fetch `https://docs.stackone.com/embed/account-linking/stackone-hub.md` for the current `<StackOneHub>` props and theming
1818

19-
The Hub component is in active beta — props and peer dependencies change between versions.
19+
The Hub component changes between versions. Take props, peer dependencies and link expiry from the docs, not from this skill.
20+
21+
When fetching any `docs.stackone.com` page, append `.md` to the URL to get it as markdown.
22+
23+
**If any URL in this skill returns 404, or a page doesn't cover what you need** (StackOne reorganizes its docs from time to time):
24+
- Fetch `https://docs.stackone.com/llms.txt`, which indexes every docs page by title and description. Search the "Embed" section for the page's topic (e.g. "Connect Session", "Account Linking", "Auth Link", "Handle Account Events") and use the URL listed there.
25+
- For the Hub package itself, the repository README is the fallback: `https://raw.githubusercontent.com/StackOneHQ/hub/main/README.md`.
2026

2127
## Instructions
2228

2329
### Step 1: Choose a connection method
2430

2531
| Method | When to use |
2632
|--------|-------------|
27-
| **Embedded Hub** | In-app integration picker — users stay in your app |
28-
| **Auth Link** | Email onboarding or external flows — standalone URL, valid 5 days |
29-
| **Dashboard** | Internal testing only — never for production |
33+
| **Embedded Hub** | In-app integration picker, users stay in your app. React apps use `@stackone/hub`; other frameworks use the `<stackone-hub>` web component |
34+
| **Auth Link** | Email onboarding, sales-led onboarding or demos. A StackOne-hosted page with the Hub already embedded, no frontend work |
35+
| **Dashboard** | Internal tools, or linking an account on a customer's behalf |
3036

3137
If unsure, recommend the Embedded Hub. It provides the best user experience.
3238

39+
The overview page compares the methods and links to each one's guide.
40+
3341
### Step 2: Create a Connect Session (backend)
3442

35-
Your backend creates a session token that the frontend uses to initialize the Hub:
43+
Your backend creates a session token that the frontend uses to initialize the Hub. Fetch `https://docs.stackone.com/embed/connect-session.md` for the required fields, filtering and connector profile targeting.
3644

3745
```bash
3846
curl -X POST https://api.stackone.com/connect_sessions \
@@ -46,26 +54,23 @@ curl -X POST https://api.stackone.com/connect_sessions \
4654

4755
The response includes a `token` field. Pass this to the frontend.
4856

49-
To filter which providers appear in the Hub:
50-
```json
51-
{
52-
"origin_owner_id": "customer-123",
53-
"origin_owner_name": "Acme Inc",
54-
"provider": "bamboohr",
55-
"categories": ["hris"]
56-
}
57-
```
57+
Always set `origin_owner_id` on the server. Never take it from a client request, or one customer could claim another customer's linked accounts.
58+
59+
To control which providers appear in the Hub, pass `provider` (opens that connector directly) or `categories` (e.g. `["hris"]`). The Connect Session page also covers `account_id`, `multiple` and `connector_profile_id`.
5860

59-
Fetch `https://docs.stackone.com/platform/api-reference/connect-sessions/create-connect-session` for the full request/response schema.
61+
Fetch `https://docs.stackone.com/platform/api-reference/connect-sessions/create-connect-session.md` for the full request/response schema.
6062

6163
### Step 3: Initialize the Hub (frontend)
6264

65+
For React, fetch `https://docs.stackone.com/embed/account-linking/stackone-hub.md` and follow its quick start:
66+
6367
```bash
6468
npm install @stackone/hub
6569
```
6670

6771
```tsx
6872
import { StackOneHub } from "@stackone/hub";
73+
import { useEffect, useState } from "react";
6974

7075
function ConnectorPage() {
7176
const [token, setToken] = useState<string>();
@@ -90,7 +95,11 @@ function ConnectorPage() {
9095
}
9196
```
9297

93-
For the full props API and theming options, consult `references/hub-reference.md`.
98+
For the full props list and theming options, use the Properties and Theming sections of that page.
99+
100+
For other frameworks, fetch `https://docs.stackone.com/embed/account-linking/stackone-hub-web-component.md`.
101+
102+
For an Auth Link instead of an embedded Hub, fetch `https://docs.stackone.com/embed/account-linking/auth-link.md`. It covers generating the link from the dashboard or from the Connect Session response, and setting its expiry.
94103

95104
### Step 4: Set up webhook listeners
96105

@@ -99,21 +108,16 @@ Webhooks are required for Auth Links (no frontend callbacks) and recommended for
99108
| Event | When it fires |
100109
|-------|---------------|
101110
| `account.created` | New account linked |
102-
| `account.updated` | Credentials refreshed |
111+
| `account.updated` | Account changed, e.g. credentials refreshed |
103112
| `account.deleted` | Account disconnected |
104113

105-
Fetch `https://docs.stackone.com/guides/webhooks` for the webhook payload format and setup instructions.
114+
Fetch `https://docs.stackone.com/embed/handle-account-events.md` for subscribing to these events, verifying the signature and handling the payload. For webhook management in general (retries, secret rotation), fetch `https://docs.stackone.com/connect/webhooks.md`.
106115

107116
### Step 5: Verify the connection
108117

109-
After receiving `onSuccess` or the `account.created` webhook, make a test API call:
110-
111-
```bash
112-
curl https://api.stackone.com/accounts/{account_id} \
113-
-H "Authorization: Basic $(echo -n 'YOUR_API_KEY:' | base64)"
114-
```
118+
After receiving `onSuccess` or the `account.created` webhook, fetch the account and check its `status`. Fetch `https://docs.stackone.com/platform/api-reference/v2/accounts/get-an-account.md` for the endpoint and the status values.
115119

116-
A `200` response with `status: "active"` confirms the connection is working.
120+
An `active` status confirms the connection is working.
117121

118122
## Examples
119123

@@ -122,32 +126,34 @@ A `200` response with `status: "active"` confirms the connection is working.
122126
User says: "I want to let my customers connect their BambooHR account"
123127

124128
Actions:
125-
1. Create a backend endpoint that calls `POST /connect_sessions` with `provider: "bamboohr"`
126-
2. Return the session token to the frontend
127-
3. Install `@stackone/hub` and render `<StackOneHub token={token} />`
128-
4. Handle `onSuccess` to store the account ID
129-
5. Set up a webhook endpoint for `account.created` as a backup
129+
1. Fetch the Connect Session and StackOne Hub (React) pages
130+
2. Create a backend endpoint that calls `POST /connect_sessions` with `provider: "bamboohr"`
131+
3. Return the session token to the frontend
132+
4. Install `@stackone/hub` and render `<StackOneHub token={token} />`
133+
5. Handle `onSuccess` to store the account ID
134+
6. Set up a webhook endpoint for `account.created` as a backup
130135

131-
Result: Working integration picker that filters to BambooHR only.
136+
Result: Working integration picker that opens straight to BambooHR.
132137

133138
### Example 2: User wants to send connection links via email
134139

135140
User says: "I need to onboard customers by email, not in-app"
136141

137142
Actions:
138-
1. Create a Connect Session with `origin_owner_id` set to the customer
139-
2. Generate an auth link from the session (fetch auth link docs)
140-
3. Set up webhook listeners — auth links have no frontend callbacks
141-
4. Send the link via email (valid for 5 days)
143+
1. Fetch the Auth Link page
144+
2. Create a Connect Session with `origin_owner_id` set to the customer, and the expiry the page describes
145+
3. Read the auth link URL from the response, as the page describes
146+
4. Set up webhook listeners — auth links have no frontend callbacks
147+
5. Send the link via email
142148

143149
Result: Customer clicks link, authenticates, webhook fires with account details.
144150

145151
## Troubleshooting
146152

147153
### Hub component doesn't render
148-
**Cause**: Missing peer dependencies.
149-
- `@stackone/hub` requires: `react`, `react-dom`, `react-hook-form`, `@hookform/resolvers`, `zod`
150-
- Check that versions match — fetch the NPM page for exact version constraints
154+
**Cause**: Missing or mismatched peer dependencies.
155+
- Check the peer dependencies of the installed `@stackone/hub` version with `npm view @stackone/hub peerDependencies`
156+
- For "Invalid hook call" errors, check for a duplicate React copy. The Hub README has a section on it
151157
- Verify the session token is valid and not expired
152158

153159
### Connect Session token expired
@@ -157,12 +163,13 @@ Result: Customer clicks link, authenticates, webhook fires with account details.
157163

158164
### onSuccess fires but account status is "error"
159165
**Cause**: Provider-side authentication succeeded but StackOne couldn't sync data.
160-
- Check the account details in the dashboard for the specific error
166+
- Check the account's `status_reasons`, or the account details in the dashboard, for the specific error
161167
- Common cause: insufficient permissions on the provider side
162168
- The provider may require additional OAuth scopes
163169

164170
### Webhooks not arriving
165171
**Cause**: Webhook endpoint configuration issue.
166172
- Verify the endpoint URL is publicly accessible (not localhost)
173+
- Check the account events are selected on the webhook itself, not on a connector profile
167174
- Check the webhook signing secret matches
168-
- Fetch `https://docs.stackone.com/guides/webhooks` for the verification process
175+
- Fetch `https://docs.stackone.com/embed/handle-account-events.md` for the verification process

‎plugins/integrations/stackone-connect/skills/stackone-connect/references/hub-reference.md‎

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)