Skip to content

Commit 171542f

Browse files
authored
update example (#22)
1 parent b7d5a52 commit 171542f

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

examples/composio/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"dependencies": {
2424
"@restackio/ai": "^0.0.80",
25-
"@restackio/integrations-composio": "^0.0.3",
25+
"@restackio/integrations-composio": "^0.0.4",
2626
"@temporalio/workflow": "^1.11.2",
2727
"dotenv": "^16.4.5"
2828
},

examples/composio/pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/composio/src/workflows/createCalendarEvent.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { step } from "@restackio/ai/workflow";
1+
import { step, log } from "@restackio/ai/workflow";
22
import * as composioFunctions from "@restackio/integrations-composio/functions";
33
import { composioTaskQueue } from "@restackio/integrations-composio/taskQueue";
44

@@ -9,6 +9,20 @@ export async function createCalendarEventWorkflow({
99
entityId: string;
1010
calendarInstruction: string;
1111
}) {
12+
const connection = await step<typeof composioFunctions>({
13+
taskQueue: composioTaskQueue,
14+
}).initiateConnection({
15+
entityId,
16+
appName: "googlecalendar",
17+
});
18+
19+
if (!connection.authenticated) {
20+
log.info(
21+
`Follow the link to authenticate with google calendar ${connection.redirectUrl}`
22+
);
23+
return connection;
24+
}
25+
1226
await step<typeof composioFunctions>({
1327
taskQueue: composioTaskQueue,
1428
}).createCalendarEvent({

0 commit comments

Comments
 (0)