Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
feat(ts): add trigger subscription example
jkomyno515147540f37
diff --git a/ts/examples/triggers/src/subscribe.ts b/ts/examples/triggers/src/subscribe.tsindex d1ee4645d..0d0db6822 100644--- a/ts/examples/triggers/src/subscribe.ts+++ b/ts/examples/triggers/src/subscribe.ts@@ -5,14 +5,19 @@ const composio = new Composio({apiKey: process.env.COMPOSIO_API_KEY,});+// create a trigger+const { triggerId } = await composio.triggers.create('default','GMAIL_NEW_GMAIL_MESSAGE', {+ connectedAccountId: 'ca_uQvmu9uZOhQo',+ triggerConfig: {},+});+// Subscribe to triggers with optional filters-// Replace 'ti_ollBPgfhgmMK' with your actual trigger IDconst sub = await composio.triggers.subscribe(metadata => {console.log('Received trigger event:');console.dir(metadata, { depth: 3 });},- { triggerId: 'ti_ollBPgfhgmMK' }+ { triggerId });console.log('Subscribed to triggers. Waiting for events...');