Skip to content

Commit

Permalink
update example (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
justrdk authored Oct 31, 2024
1 parent 022f181 commit 32fe49a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/composio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"dependencies": {
"@restackio/ai": "^0.0.80",
"@restackio/integrations-composio": "^0.0.3",
"@restackio/integrations-composio": "^0.0.4",
"@temporalio/workflow": "^1.11.2",
"dotenv": "^16.4.5"
},
Expand Down
18 changes: 9 additions & 9 deletions examples/composio/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion examples/composio/src/workflows/createCalendarEvent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { step } from "@restackio/ai/workflow";
import { step, log } from "@restackio/ai/workflow";
import * as composioFunctions from "@restackio/integrations-composio/functions";
import { composioTaskQueue } from "@restackio/integrations-composio/taskQueue";

Expand All @@ -9,6 +9,20 @@ export async function createCalendarEventWorkflow({
entityId: string;
calendarInstruction: string;
}) {
const connection = await step<typeof composioFunctions>({
taskQueue: composioTaskQueue,
}).initiateConnection({
entityId,
appName: "googlecalendar",
});

if (!connection.authenticated) {
log.info(
`Follow the link to authenticate with google calendar ${connection.redirectUrl}`
);
return connection;
}

await step<typeof composioFunctions>({
taskQueue: composioTaskQueue,
}).createCalendarEvent({
Expand Down

0 comments on commit 32fe49a

Please sign in to comment.