Skip to content

An open-source, faster Devin alternative

TypeScript

docs(slack): document idempotent managed authorization

Igor Zalutski33c5b3ded5b0
diff --git a/docs/agent-sessions/api-reference.mdx b/docs/agent-sessions/api-reference.mdx
index ed938812..cb281133 100644
--- a/docs/agent-sessions/api-reference.mdx
+++ b/docs/agent-sessions/api-reference.mdx
@@ -622,8 +622,9 @@ that deploy auto-activates. Repo/path are server-anchored to the link. Deploymen
## Slack
Managed Slack uses the OpenComputer-operated app. Starting authorization
-returns a browser-safe Slack OAuth URL; the optional deployment id is validated
-return context, not a redirect URL. Status responses never contain credentials.
+returns a browser-safe Slack OAuth URL, or the current active connection when
+the agent is already connected. The optional deployment id is validated return
+context, not a redirect URL. Status responses never contain credentials.
<Tabs>
diff --git a/docs/agent-sessions/slack.mdx b/docs/agent-sessions/slack.mdx
index 8e5e074e..c544871c 100644
--- a/docs/agent-sessions/slack.mdx
+++ b/docs/agent-sessions/slack.mdx
@@ -36,8 +36,13 @@ const authorization = await oc.agents.authorizeManagedSlack(agentId, {
returnDeploymentId: deploymentId, // optional validated return context
});
-// Return authorizeUrl from your authenticated server route, then navigate the
-// user's browser to it. Never expose the OpenComputer org key to the browser.
+if ("authorizeUrl" in authorization) {
+ // Return this from your authenticated server route, then navigate the user's
+ // browser to it. Never expose the OpenComputer org key to the browser.
+ return authorization.authorizeUrl;
+}
+// Otherwise the agent was already connected; `authorization` is its current
+// public connection state.
const connection = await oc.agents.getManagedSlack(agentId);
// { mode: "managed", status: "active", workspace, app, openUrl, ... }