picked 0.0.1-dev.1794350107473 → 0.0.1-dev.1794447047683

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/docs/explanation/apps.md +4 -0
  3. package/docs/explanation/feature-flag-allocation.md +4 -4
  4. package/docs/how-to/add-a-tool-to-the-devtools.md +16 -14
  5. package/docs/how-to/apps/add-a-page-to-the-dashboard.md +10 -8
  6. package/docs/how-to/apps/connect-a-google-app.md +100 -0
  7. package/docs/how-to/apps/connect-a-third-party-service-with-oauth.md +19 -12
  8. package/docs/how-to/apps/connect-vercel.md +101 -0
  9. package/docs/how-to/apps/connect-zoho-crm.md +105 -0
  10. package/docs/how-to/apps/host-an-app-on-vercel.md +5 -2
  11. package/docs/how-to/apps/link-to-an-installation-from-your-site.md +57 -21
  12. package/docs/how-to/apps/read-project-data-from-an-app.md +4 -3
  13. package/docs/how-to/apps/run-code-when-a-workspace-publishes.md +2 -0
  14. package/docs/how-to/apps/use-an-app-tool-in-a-workflow.md +7 -0
  15. package/docs/how-to/install-the-gtm-template.md +9 -9
  16. package/docs/how-to/send-issues-to-your-tracker.md +5 -5
  17. package/docs/reference/apps/app-kit.md +144 -58
  18. package/docs/reference/apps/environment.md +48 -12
  19. package/docs/reference/apps/google.md +235 -0
  20. package/docs/reference/apps/protocol.md +24 -6
  21. package/docs/reference/apps/vercel.md +222 -0
  22. package/docs/reference/apps/zoho-crm.md +214 -0
  23. package/docs/reference/dashboard/features.mdx +1 -1
  24. package/docs/reference/dashboard/labels.md +4 -4
  25. package/docs/reference/dashboard/lead-search.md +20 -6
  26. package/docs/reference/glossary.md +22 -21
  27. package/docs/reference/management-api/schema/analytics-session.md +1 -1
  28. package/docs/reference/management-api/schema/experience.md +2 -1
  29. package/docs/reference/management-api/schema/feature.md +5 -2
  30. package/docs/reference/management-api/schema/feedback.md +4 -2
  31. package/docs/reference/management-api/schema/field.md +5 -3
  32. package/docs/reference/management-api/schema/index.md +5 -2
  33. package/docs/reference/management-api/schema/lead.md +270 -13
  34. package/docs/reference/management-api/schema/project.md +80 -9
  35. package/docs/reference/sdk/analytics-events.md +248 -235
  36. package/docs/reference/sdk/features.md +2 -2
  37. package/docs/reference/sdk/plugins/hotjar.md +3 -3
  38. package/docs/reference/sdk/plugins/sentry.md +1 -1
  39. package/docs/reference/sdk/plugins/shopify.md +4 -3
  40. package/docs/reference/tools/mcp.md +11 -7
  41. package/package.json +4 -4
@@ -122,6 +122,10 @@ Each organization that installs a public app gets its own installation, with its
122
122
  and its own data. The author of the app does not get access to a project until a person on
123
123
  that project installs the app.
124
124
 
125
+ Picked makes its own apps on the same platform. Examples are the
126
+ [Vercel app](/reference/apps/vercel), the [Zoho CRM app](/reference/apps/zoho-crm), and the
127
+ [Google apps](/reference/apps/google).
128
+
125
129
  ## Apps, external APIs and MCP connections
126
130
 
127
131
  A project can also connect to other services without an app.
@@ -54,14 +54,14 @@ inside `decide` delays what the visitor sees.
54
54
 
55
55
  For a feature flag you control from the dashboard the choice is deterministic. Picked
56
56
  gives each visitor a stable value for each feature flag. It derives that value from the
57
- visitor ID and from the ID of the feature flag, and it compares the value against the
57
+ Picked ID and from the ID of the feature flag, and it compares the value against the
58
58
  weight. Picked allocates the visitor when the value is below the weight.
59
59
 
60
60
  The same visitor gets the same result for one feature flag on every visit, while the
61
61
  weight stays the same.
62
62
 
63
63
  That is also why a feature flag you control from the dashboard cannot use the data of
64
- your application in its decision. The value comes from the visitor ID, the feature flag
64
+ your application in its decision. The value comes from the Picked ID, the feature flag
65
65
  ID, and the weight, and from nothing else. Define the feature flag in SDK code when the
66
66
  decision needs a cart, a quote, or a profile.
67
67
 
@@ -87,7 +87,7 @@ variant moves because of it.
87
87
  A Boolean feature flag makes the same comparison it always has. A feature flag that you
88
88
  made before variants existed therefore keeps every visitor where it put them.
89
89
 
90
- Picked derives the stable value from the visitor ID and from the ID of the feature flag,
90
+ Picked derives the stable value from the Picked ID and from the ID of the feature flag,
91
91
  for both types. The two types are therefore independent of each other in the same way that
92
92
  two feature flags are.
93
93
 
@@ -104,7 +104,7 @@ keeps the old string until you increment the version.
104
104
 
105
105
  ## Each feature flag is independent
106
106
 
107
- Picked builds that value from the visitor ID together with the ID of the feature flag.
107
+ Picked builds that value from the Picked ID together with the ID of the feature flag.
108
108
  Each feature flag therefore gets its own value, and tests that run at the same time are
109
109
  independent of each other.
110
110
 
@@ -57,11 +57,13 @@ different place, set `placement`.
57
57
  | --- | --- |
58
58
  | Not set | An entry of its own in the main list, below the review tabs. |
59
59
  | `'review'` | A tab of its own in the main list, below the review tabs. |
60
- | `'personas'` | A section of **Personas & Scenarios**, below the personas. The label of the tool is the heading of the section. |
60
+ | `'responses'` | A section of **Responses**, below **Saved responses**. The label of the tool is the heading of the section. |
61
61
  | `'footer'` | An icon at the bottom of the menu, next to **Auto-hide button**. The label shows when the pointer is on the icon. |
62
62
 
63
- Add a `description` to show a short text above the tool. Add a `guide` to add a section with the
64
- label of the tool to **How to use**.
63
+ Add a `description` to show a short text above the tool. Add a `guide` to give steps for the tool.
64
+ The steps show when you click the information icon next to the title of the tool. For a
65
+ `'responses'` tool, the steps show when you click the information icon of **Responses**, below the
66
+ label of the tool.
65
67
 
66
68
  ```typescript
67
69
  {
@@ -94,16 +96,16 @@ const route = devtools?.session.routeStore.getState() ?? []
94
96
  The session record holds the screens that the visitor entered, the answers on each screen, and
95
97
  the route through the journey. If `devtools.posture.readOnly` is `true`, the tool must not write.
96
98
 
97
- ## 5. Save a persona
99
+ ## 5. Save responses
98
100
 
99
- A tool can save a persona. Do this when the code of your site sets the route, and the panel
100
- cannot build the persona. **Personas & Scenarios** shows the persona below **Saved in this
101
- browser**.
101
+ A tool can save a set of responses. Do this when the code of your site sets the route, and the
102
+ panel cannot build the responses. **Saved responses**, in the **Responses** tab, shows them below
103
+ **Saved in this browser**.
102
104
 
103
105
  ```typescript
104
106
  import { getDevtoolsSession } from '@picked/svelte/plugins/devtools'
105
107
 
106
- const result = getDevtoolsSession(client)?.personas.save({
108
+ const result = getDevtoolsSession(client)?.savedResponses.save({
107
109
  name: 'Mover with an account',
108
110
  responses: { purpose: 'moving' },
109
111
  entryUrl: '/moving-home',
@@ -112,15 +114,15 @@ const result = getDevtoolsSession(client)?.personas.save({
112
114
  ```
113
115
 
114
116
  If `result.ok` is `false`, `result.error` tells why. The `site` object holds data that your code
115
- reads when the persona loads. To read it, set `personaWalk.setup` on the plugin. If the panel
116
- cannot build a persona for your site, set `personaBuilder` to `false`. Then **Create** does not
117
- show the fields of each step.
117
+ reads when a walk-through starts. To read it, set `walkThrough.setup` on the plugin. If the panel
118
+ cannot build the responses for your site, set `buildFromFields` to `false`. Then **Save
119
+ responses** does not show the fields of each step.
118
120
 
119
121
  ```typescript
120
122
  svelteDevtoolsPlugin({
121
- personaBuilder: false,
122
- personaWalk: {
123
- setup: (persona, client) => useFixtureAccount(client, persona.site.account),
123
+ buildFromFields: false,
124
+ walkThrough: {
125
+ setup: (saved, client) => useFixtureAccount(client, saved.site.account),
124
126
  },
125
127
  })
126
128
  ```
@@ -55,9 +55,10 @@ Serve the page with `page` from `@picked/app-kit/server`. `page` sets the
55
55
  `content-security-policy` header to `frame-ancestors` with the origins that you give.
56
56
  Therefore, only the dashboard can show the page in an `iframe`.
57
57
 
58
- Give `page` the `frameAncestors` that `readAppEnvironment` returns. It reads them from
59
- `PICKED_DASHBOARD_ORIGINS`. With no origins, `page` sends `frame-ancestors 'none'`, and the
60
- dashboard cannot show the page.
58
+ Give `page` the origins that `dashboardOrigins()` from `readAppEnvironment` gives. They are
59
+ `PICKED_DASHBOARD_ORIGINS`, or, when it is not set, the origins in the
60
+ [app config of Picked](/reference/apps/environment#app-config-of-picked). With no origins,
61
+ `page` sends `frame-ancestors 'none'`, and the dashboard cannot show the page.
61
62
 
62
63
  ```ts [src/server.ts]
63
64
  import { readFile } from 'node:fs/promises'
@@ -65,7 +66,7 @@ import { createAppHandler, json, page, readAppEnvironment } from '@picked/app-ki
65
66
  import { frameScript, serve } from '@picked/app-kit/node'
66
67
 
67
68
  const port = process.env.APP_PORT ?? '4103'
68
- const { pickedKeys, frameAncestors } = readAppEnvironment(process.env, port)
69
+ const { pickedKeys, dashboardOrigins } = readAppEnvironment(process.env, port)
69
70
 
70
71
  const handler = createAppHandler({
71
72
  pickedKeys,
@@ -73,7 +74,7 @@ const handler = createAppHandler({
73
74
  const { pathname } = new URL(request.url)
74
75
  if (pathname === '/') {
75
76
  const html = await readFile(new URL('./home.html', import.meta.url), 'utf8')
76
- return page(html, { frameAncestors })
77
+ return page(html, { frameAncestors: await dashboardOrigins() })
77
78
  }
78
79
  if (pathname === '/app-kit/frame.js') return frameScript()
79
80
  return json({ error: 'not_found' }, 404)
@@ -197,8 +198,9 @@ no token, or when the token is not from Picked or is expired. Otherwise it retur
197
198
  fields of the token, for example `userId`, `installationId` and `projectId`.
198
199
  [Session tokens](/reference/apps/protocol#session-tokens) gives each field.
199
200
 
200
- A session token expires after 10 minutes. To get a new token, call `connect()` again. The
201
- dashboard sends a new token each time.
201
+ A session token expires after 10 minutes. On a page that stays open, use
202
+ [`keepConnected`](/reference/apps/app-kit#keepconnected): it gets a new token before the
203
+ old token expires.
202
204
 
203
205
  Do not use the IDs in the URL or in the body of a request from the page. Use the IDs in
204
206
  the session.
@@ -240,7 +242,7 @@ If the dashboard cannot show the page, it shows one of these messages:
240
242
  | `This app's page can't be shown: its address is not a valid URL.` | The `url` of the slot is not a valid URL. |
241
243
 
242
244
  If the `iframe` stays empty, look at the console of the browser. A `frame-ancestors` error
243
- tells you that `PICKED_DASHBOARD_ORIGINS` does not have the origin of the dashboard.
245
+ tells you that the dashboard origins of the app do not have the origin of the dashboard.
244
246
 
245
247
  ## Related
246
248
 
@@ -0,0 +1,100 @@
1
+ ---
2
+ type: how-to
3
+ layout: docs
4
+ ---
5
+
6
+ # How to connect Google Ads, Google Analytics or Google Tag Manager
7
+
8
+ This guide shows you how to connect a Picked project to a Google account. Three apps can make
9
+ this connection: Google Ads, Google Analytics and Google Tag Manager. The steps are the same
10
+ for the three apps. Only the setting in step 4 is different.
11
+
12
+ :::info
13
+ At this time, these apps only keep the connection and test it. They do not read data from
14
+ Google into Picked.
15
+ :::
16
+
17
+ These apps are not the Picked GTM template. To send ecommerce events from Google Tag Manager
18
+ to Picked, see [How to install the GTM template](/how-to/install-the-gtm-template).
19
+
20
+ Before you start, you need:
21
+
22
+ - A Picked project, and permission to install apps on it.
23
+ - A Google account that can open the Google Ads account, the Google Analytics property or
24
+ the Tag Manager container.
25
+ - The ID that the app asks for in step 4.
26
+
27
+ ## 1. Install the app
28
+
29
+ Install the app with the name **Google Ads**, **Google Analytics** or **Google Tag Manager**
30
+ on your project. The app asks for no access to the data of your project. See
31
+ [How to install an app](/how-to/apps/install-an-app).
32
+
33
+ ## 2. Open the app
34
+
35
+ 1. In the project, open **Apps**.
36
+ 2. Under **Installed**, click **Open** on the app.
37
+
38
+ The dashboard shows the page of the app. The page has the name of the app as its title.
39
+
40
+ ## 3. Connect the Google account
41
+
42
+ 1. Click the **Connect** button of the app, for example **Connect Google Ads**.
43
+ 2. In the new window, sign in to Google.
44
+ 3. Accept all of the access that the app asks for.
45
+
46
+ The new window closes. The status line shows `Connected <email>`. The page shows
47
+ `Connected as <email>`.
48
+
49
+ If the new window stays open, close it. The status line shows
50
+ `The connection window closed. If you finished connecting there, it shows here`, and the
51
+ page shows the connection.
52
+
53
+ If your browser stops the new window, the page shows `Allow pop-ups to connect`. Let the
54
+ dashboard open new windows. Then click the button again. For other messages, see
55
+ [Google apps](/reference/apps/google#sign-in-messages).
56
+
57
+ ## 4. Save the setting
58
+
59
+ The setting fields show after you connect. Enter the setting of your app:
60
+
61
+ - **Google Ads**: In **Customer ID**, enter the ID of the Google Ads account, for example
62
+ `123-456-7890`. If the Google account gets to this account through a manager account,
63
+ enter the ID of the manager account in **Manager account ID**.
64
+ - **Google Analytics**: In **Property ID**, enter the ID of the Google Analytics 4 property,
65
+ for example `250000001`. The property settings in Google Analytics show this ID.
66
+ - **Google Tag Manager**: In **Container ID**, enter the ID of the web container, for
67
+ example `GTM-XXXXXXX`.
68
+
69
+ Click **Save settings**. The page shows `Settings saved`.
70
+
71
+ If the value is not correct, the page shows the problem. See
72
+ [Google apps](/reference/apps/google#settings-messages).
73
+
74
+ ## 5. Test the connection
75
+
76
+ Click **Test connection**.
77
+
78
+ The status line shows `Connected to <name> (<ID>)`. Under the message, the page shows each
79
+ account, property or container that the Google account can open.
80
+
81
+ If the page shows a different message, see [Google apps](/reference/apps/google#test-messages).
82
+
83
+ ## Remove the connection
84
+
85
+ Click `Disconnect` on the app page.
86
+
87
+ The app tells Google to revoke its access. The status line shows `Disconnected`, and the
88
+ page shows the **Connect** button again. The saved setting stays. To connect again, follow
89
+ step 3.
90
+
91
+ When you remove the app from the project, the app also tells Google to revoke its access. See
92
+ [How to upgrade or uninstall an app](/how-to/apps/upgrade-or-uninstall-an-app).
93
+
94
+ ## Related
95
+
96
+ - [Google apps](/reference/apps/google): the Google scopes, the settings, the tool and the
97
+ messages of the three apps.
98
+ - [How to use an app tool in a workflow](/how-to/apps/use-an-app-tool-in-a-workflow): add the
99
+ `check_connection` tool of the app to a workflow.
100
+ - [About apps](/explanation/apps).
@@ -53,7 +53,7 @@ to [How to store data for an installation](/how-to/apps/store-data-for-an-instal
53
53
  ## 2. Add a button that opens the authorization window
54
54
 
55
55
  On the page, call `authorizeInPopup` from a `click` handler. Give it the session token from
56
- `connect`. To send a value to your server, such as a region that the person chose, give it
56
+ `keepConnected`. To send a value to your server, such as a region that the person chose, give it
57
57
  as `params`.
58
58
 
59
59
  ```html [src/home.html]
@@ -70,18 +70,17 @@ as `params`.
70
70
  <button id="connect" type="button">Connect CRM</button>
71
71
  <p id="status"></p>
72
72
  <script type="module">
73
- import { authorizeInPopup, autoResize, connect } from '/app-kit/frame.js'
73
+ import { authorizeInPopup, autoResize, keepConnected } from '/app-kit/frame.js'
74
74
 
75
- let context = await connect()
75
+ const connection = await keepConnected()
76
76
  autoResize()
77
77
 
78
78
  document.getElementById('connect').addEventListener('click', async () => {
79
79
  const result = await authorizeInPopup({
80
- sessionToken: context.sessionToken,
80
+ sessionToken: connection.context().sessionToken,
81
81
  params: { region: document.getElementById('region').value },
82
82
  })
83
83
  document.getElementById('status').textContent = result.message
84
- context = await connect()
85
84
  })
86
85
  </script>
87
86
  </body>
@@ -95,16 +94,22 @@ The session token does not go in an address.
95
94
  Do not put an `await` before `authorizeInPopup` in the handler. The browser can stop a new
96
95
  window that does not come directly from a click.
97
96
 
98
- A session token expires 10 minutes after Picked makes it. With an expired session token, the
99
- result is `Sign in again`. After each result, the handler calls `connect()` again. The
100
- dashboard then sends a new session token for the next click.
97
+ With an expired session token, the result is `Sign in again`.
98
+ [`keepConnected`](/reference/apps/app-kit#keepconnected) gets a new session
99
+ token before the token expires. The handler reads `connection.context()` when the person
100
+ clicks. The handler then has a session token that is not expired, and it does not wait for
101
+ the token.
101
102
 
102
- `connect()` works only in the `iframe` of the dashboard, so the page must open in Picked.
103
+ `keepConnected()` works only in the `iframe` of the dashboard, so the page must open in Picked.
103
104
 
104
105
  Some services separate the new window from your page. The window then stays open and
105
- shows the result. `authorizeInPopup` returns when the person comes back to your page. Read
106
- the connection from your server again after `authorizeInPopup` returns, and show it. The
107
- results of `authorizeInPopup` are in
106
+ shows the result. `authorizeInPopup` returns when the person comes back to your page.
107
+
108
+ Give
109
+ `authorizeInPopup` a `connected` function that reads the connection from your server. It
110
+ returns a message when the connection exists, or `null`. Then `authorizeInPopup` waits up to
111
+ 30 seconds for the connection that the window saves. Read the connection from your server
112
+ again after `authorizeInPopup` returns, and show it. The results of `authorizeInPopup` are in
108
113
  [`authorizeInPopup`](/reference/apps/app-kit#authorizeinpopup).
109
114
 
110
115
  ## 3. Return the authorization URL
@@ -305,3 +310,5 @@ set the label again.
305
310
  why the state carries the session token, and why a cookie binds the flow to one browser.
306
311
  - [How to store data for an installation](/how-to/apps/store-data-for-an-installation) —
307
312
  secret labels.
313
+ - [How to send leads to Zoho CRM](/how-to/apps/connect-zoho-crm) — an app that keeps the
314
+ OAuth client of each customer in labels of the installation.
@@ -0,0 +1,101 @@
1
+ ---
2
+ type: how-to
3
+ layout: docs
4
+ ---
5
+
6
+ # How to deploy to Vercel when you publish
7
+
8
+ This guide shows you how to connect a Picked project to your Vercel account. After you
9
+ connect, Picked deploys the Vercel projects that you choose each time the project publishes
10
+ a workspace.
11
+
12
+ Before you start, you need:
13
+
14
+ - A Picked project, and permission to install apps on it.
15
+ - A Vercel account or a Vercel team that holds the sites to deploy.
16
+
17
+ ## 1. Install the Vercel app
18
+
19
+ Install the app with the name **Vercel** on your project. The app asks for no access to the
20
+ data of your project. See [How to install an app](/how-to/apps/install-an-app).
21
+
22
+ ## 2. Open the app
23
+
24
+ On the apps page of the project, under **Installed**, click **Open** next to **Vercel**.
25
+
26
+ The dashboard shows the page of the app.
27
+
28
+ ## 3. Connect Vercel
29
+
30
+ 1. Click **Connect Vercel**.
31
+ 2. In the new window, sign in to Vercel if Vercel asks you.
32
+ 3. Choose the Vercel team or the personal account that holds your sites.
33
+ 4. Approve the Picked Vercel Integration.
34
+
35
+ The new window closes. The status line shows `Connected to Vercel`. The page shows
36
+ `Connected to Vercel team <team ID>`, or `Connected to Vercel personal account`, then the
37
+ integration configuration, for example `(configuration icfg_…)`.
38
+
39
+ If the new window stays open, close it. The status line shows
40
+ `The connection window closed. If you finished connecting there, it shows here`, and the
41
+ page shows the connection.
42
+
43
+ If the page shows
44
+ `Picked’s Vercel Integration is not configured on this deployment, so it cannot connect.`,
45
+ you cannot connect from this Picked environment.
46
+
47
+ ## 4. Choose the projects to deploy
48
+
49
+ 1. Under **Projects to deploy**, choose each Vercel project that Picked must deploy.
50
+ 2. Click **Save projects**.
51
+
52
+ The page shows `Saved the projects to deploy`. Under **Deploy now**, the page shows a
53
+ **Deploy &lt;project&gt;** button for each project that you chose.
54
+
55
+ Each time that a workspace in this project publishes, Picked deploys each project that you
56
+ chose one time. See
57
+ [Vercel app](/reference/apps/vercel#deployments) for what a deployment does.
58
+
59
+ ## 5. Deploy at a different time
60
+
61
+ To deploy a project from the app page:
62
+
63
+ 1. Under **Deploy now**, click **Deploy &lt;project&gt;**.
64
+ 2. Read the status line. It shows `<project>: deploying`, or the reason for a failure.
65
+
66
+ To deploy from the publish modal, publish a workspace. When the workspace is published, click
67
+ **Deploy &lt;project&gt;** in the `Deploy to Vercel` card of the modal. See
68
+ [How to publish a workspace](/how-to/publish-a-workspace).
69
+
70
+ To deploy from a workflow, add the `Vercel: Trigger Vercel deploy` tool to the workflow. See
71
+ [How to use an app tool in a workflow](/how-to/apps/use-an-app-tool-in-a-workflow).
72
+
73
+ ## 6. Check the deployments
74
+
75
+ The `Recent deploys` table on the app page shows the last deployments. The `Started by`
76
+ column shows `manual`, `publish` or `workflow`. The `Result` column shows `Deploying`, or
77
+ `Failed:` and the reason.
78
+
79
+ ## 7. Open Picked from Vercel
80
+
81
+ 1. In the Vercel dashboard, open **Integrations**.
82
+ 2. Open the configuration of the Picked integration.
83
+
84
+ Vercel sends you to the Vercel app page of the Picked project that holds this configuration.
85
+ If more than one project holds it, the dashboard asks you to choose the project.
86
+
87
+ ## 8. Remove the connection
88
+
89
+ 1. On the app page, click `Disconnect`.
90
+ 2. In the Vercel dashboard, open **Integrations**.
91
+ 3. Remove the Picked integration from the account or the team.
92
+
93
+ Step 1 removes the Vercel token, the team, the configuration and the chosen projects from
94
+ Picked. The integration stays on your Vercel account until you do steps 2 and 3.
95
+
96
+ ## Related
97
+
98
+ - [Vercel app](/reference/apps/vercel): the slots, the tool, the event, the limits and the
99
+ messages of the app.
100
+ - [How to upgrade or uninstall an app](/how-to/apps/upgrade-or-uninstall-an-app).
101
+ - [About apps](/explanation/apps).
@@ -0,0 +1,105 @@
1
+ ---
2
+ type: how-to
3
+ layout: docs
4
+ ---
5
+
6
+ # How to send leads to Zoho CRM
7
+
8
+ This guide shows you how to connect a Picked project to your Zoho CRM account. After you
9
+ connect, the workflows of the project can make leads in Zoho CRM.
10
+
11
+ The app uses an OAuth client that you make in Zoho. Picked does not give the client.
12
+
13
+ Before you start, you need:
14
+
15
+ - A Picked project, and permission to install apps on it.
16
+ - A Zoho CRM account, and permission to add a client in the Zoho API Console.
17
+ - The data center of your Zoho CRM account. See
18
+ [Data centers](/reference/apps/zoho-crm#data-centers).
19
+
20
+ ## 1. Install the Zoho CRM app
21
+
22
+ Install the app with the name **Zoho CRM** on your project. The app asks for no access to the
23
+ data of your project. See [How to install an app](/how-to/apps/install-an-app).
24
+
25
+ ## 2. Open the app
26
+
27
+ On the apps page of the project, under **Installed**, click **Open** next to **Zoho CRM**.
28
+
29
+ The dashboard shows the page of the app.
30
+
31
+ ## 3. Find the address for Zoho
32
+
33
+ On the app page, find the URL after `Redirect URI:`. It ends with `/oauth/callback`. Zoho
34
+ sends you back to this URL after you connect.
35
+
36
+ ## 4. Make an OAuth client in Zoho
37
+
38
+ 1. Open the Zoho API Console of your data center, for example `api-console.zoho.com`,
39
+ `api-console.zoho.eu` or `api-console.zoho.com.au`.
40
+ 2. Add a `Server-based Application`.
41
+ 3. Set the URL from step 3 as the authorized redirect address of the client.
42
+ 4. Record the client ID and the client secret that Zoho gives.
43
+
44
+ ## 5. Save the client in Picked
45
+
46
+ 1. On the app page, enter the client ID in **Client ID**.
47
+ 2. Enter the client secret in **Client secret**.
48
+ 3. Click **Save client**.
49
+
50
+ The page shows `Saved your Zoho OAuth client`, and
51
+ `Client ID <client ID>, client secret set`. The page does not show the secret again.
52
+
53
+ ## 6. Connect Zoho CRM
54
+
55
+ 1. In `Zoho data centre`, choose the data center of your Zoho account.
56
+ 2. Click **Connect Zoho CRM**.
57
+ 3. In the new window, sign in to Zoho if Zoho asks you.
58
+ 4. Accept the access that the app asks for.
59
+
60
+ The new window closes. The status line shows `Connected to <organization>`. The page shows
61
+ `Connected to <organization> through <accounts server>`.
62
+
63
+ If the new window stays open, close it. The status line shows
64
+ `The connection window closed. If you finished connecting there, it shows here`, and the
65
+ page shows the connection.
66
+
67
+ ## 7. Test the connection
68
+
69
+ Click **Test connection**.
70
+
71
+ The status line shows `Connected to <organization>`. If it shows a different message, see
72
+ [Zoho CRM app](/reference/apps/zoho-crm#messages).
73
+
74
+ ## 8. Add the tool to a workflow
75
+
76
+ Add the `Zoho CRM: Create Zoho lead` tool to a workflow. Set **Last name**. You can also set
77
+ **First name**, **Email** and **Company**. See
78
+ [How to use an app tool in a workflow](/how-to/apps/use-an-app-tool-in-a-workflow).
79
+
80
+ A test run of the workflow does not make a lead. The tool returns `test-run` as the Zoho lead
81
+ ID.
82
+
83
+ ## Replace the OAuth client
84
+
85
+ 1. On the app page, click **Replace client**.
86
+ 2. Enter the new client ID and client secret.
87
+ 3. Click **Save client**.
88
+ 4. Connect again, as in step 6.
89
+
90
+ The new client removes the connection. See
91
+ [New client](/reference/apps/zoho-crm#new-client).
92
+
93
+ ## Remove the connection
94
+
95
+ Click `Disconnect` on the app page.
96
+
97
+ The client stays in Picked. To connect again, go to step 6. See
98
+ [Removal of the connection](/reference/apps/zoho-crm#removal-of-the-connection).
99
+
100
+ ## Related
101
+
102
+ - [Zoho CRM app](/reference/apps/zoho-crm): the tools, the data centers, the Zoho scopes and
103
+ the messages of the app.
104
+ - [How to upgrade or uninstall an app](/how-to/apps/upgrade-or-uninstall-an-app).
105
+ - [About apps](/explanation/apps).
@@ -110,11 +110,14 @@ Make `vercel.json`:
110
110
  "framework": null,
111
111
  "buildCommand": "npm run build",
112
112
  "outputDirectory": "public",
113
- "rewrites": [{ "source": "/:path*", "destination": "/api?__path=/:path*" }]
113
+ "rewrites": [
114
+ { "source": "/", "destination": "/api?__path=/" },
115
+ { "source": "/:path*", "destination": "/api?__path=/:path*" }
116
+ ]
114
117
  }
115
118
  ```
116
119
 
117
- The rewrite sends each path to the function, with the path in `__path`.
120
+ The rewrites send each path to the function, with the path in `__path`. The `/:path*` rule does not match `/`, so the first rule sends `/`.
118
121
  `withRewrittenPath` puts the path back in the URL of the request. So the handler gets
119
122
  `/lifecycle`, `/tools/<name>` and the other paths of the
120
123
  [App protocol](/reference/apps/protocol).