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
docs: update migration guide and add new trigger snippets
[email protected]b5eb33426b31
diff --git a/fern/pages/src/migration-guide.mdx b/fern/pages/src/migration-guide.mdxindex 9f3bc7229..541d7048c 100644--- a/fern/pages/src/migration-guide.mdx+++ b/fern/pages/src/migration-guide.mdx@@ -478,24 +478,19 @@ Composio continues to support listening to application events using triggers thrThe process for creating triggers and specifying their configuration has been redesigned for improved clarity and intuitiveness.-Some triggers require configuration, such as repository names for GitHub triggers or channel names for Slack triggers. You can view the configuration for a trigger as follows:+Some triggers require configuration, such as repository names for GitHub triggers or channel names for Slack triggers. The process usually follows the pattern of fetching the trigger type and then creating the trigger with the appropriate configuration.<CodeGroup><SnippetCode- src="fern/snippets/typescript/triggers.ts"+ src="fern/snippets/migration/new_triggers.py"startLine={1}- endLine={27}- title="TypeScript (current)"+ endLine={33}+ title="Python (current)"/>-</CodeGroup>--You can then create the trigger with the appropriate configuration:--<CodeGroup><SnippetCode- src="fern/snippets/typescript/triggers.ts"- startLine={28}- endLine={40}+ src="fern/snippets/migration/new_triggers.ts"+ startLine={1}+ endLine={35}title="TypeScript (current)"/></CodeGroup>@@ -507,12 +502,27 @@ You can enable or disable triggers through either the SDK or the dashboard. TheManaging triggers with the SDK:<CodeGroup>-<SnippetCode- src="fern/snippets/typescript/triggers.ts"- startLine={55}- endLine={56}- title="TypeScript (current)"-/>+ ```python Python maxLines=60 wordWrap+ # Disable a trigger instance+ disabled_instance = composio.triggers.disable(trigger_id="ti_abcd123")+ print(disabled_instance)+ ```+ ```typescript TypeScript maxLines=60 wordWrap+ await composio.triggers.disable("ti_abcd123");+ ```+</CodeGroup>++If needed, the trigger can be enabled again.++<CodeGroup>+ ```python Python maxLines=60 wordWrap+ # Enable a trigger instance+ enabled_instance = composio.triggers.enable(trigger_id="ti_abcd123")+ print(enabled_instance)+ ```+ ```typescript TypeScript maxLines=60 wordWrap+ await composio.triggers.enable("ti_abcd123");+ ```</CodeGroup>#### Listening to triggers@@ -523,12 +533,12 @@ For development, you can also [listen to triggers through the SDK](/docs/using-t<CodeGroup><SnippetCode- src="fern/snippets/typescript/trigger-webhook.ts"- title="app/api/webhook/route.ts (Next.js)"+ src="fern/snippets/triggers/python/trigger-webhook.py"+ title="app/route.py (FastAPI)"/><SnippetCode- src="fern/snippets/python/trigger-webhook.py"- title="app/route.py (FastAPI)"+ src="fern/snippets/triggers/typescript/trigger-webhook.ts"+ title="app/api/webhook/route.ts (Next.js)"/></CodeGroup>diff --git a/fern/snippets/migration/new_triggers.py b/fern/snippets/migration/new_triggers.pynew file mode 100644index 000000000..ac47a1df7--- /dev/null+++ b/fern/snippets/migration/new_triggers.py@@ -0,0 +1,36 @@+from composio import Composio++composio = Composio()++user_id = "[email protected]"+trigger_config = composio.triggers.get_type("GITHUB_COMMIT_EVENT")+print(trigger_config.config)+### Trigger Config+# {+# "properties": {+# "owner": {+# "description": "Owner of the repository",+# "title": "Owner",+# "type": "string"+# },+# "repo": {+# "description": "Repository name",+# "title": "Repo",+# "type": "string"+# }+# },+# "required": ["owner", "repo"],+# "title": "WebhookConfigSchema",+# "type": "object"++trigger = composio.triggers.create(+ slug="GITHUB_COMMIT_EVENT",+ user_id=user_id,+ trigger_config={"repo": "composiohq", "owner": "composio"},+)+print(trigger)+++# Managing triggers++composio.triggers.enable(id="ti_abcd123")\ No newline at end of filediff --git a/fern/snippets/migration/new_triggers.ts b/fern/snippets/migration/new_triggers.tsnew file mode 100644index 000000000..29afa5389--- /dev/null+++ b/fern/snippets/migration/new_triggers.ts@@ -0,0 +1,35 @@+import { Composio } from '@composio/core';++const composio = new Composio();++const userId = '[email protected]';+// Fetch the trigger details+const triggerType = await composio.triggers.getType('GITHUB_COMMIT_EVENT');+console.log(JSON.stringify(triggerType.config, null, 2));+/*--- Trigger config ---+{+ "properties": {+ "owner": {+ "description": "Owner of the repository",+ "title": "Owner",+ "type": "string"+ },+ "repo": {+ "description": "Repository name",+ "title": "Repo",+ "type": "string"+ }+ },+ "required": ["owner", "repo"],+ "title": "WebhookConfigSchema",+ "type": "object"+}+*/++const createResponse = await composio.triggers.create(userId, 'GITHUB_COMMIT_EVENT', {+ triggerConfig: {+ owner: 'composiohq',+ repo: 'composio',+ },+});+console.log(createResponse);\ No newline at end of filediff --git a/fern/snippets/triggers/python/triggers.py b/fern/snippets/triggers/python/triggers.pyindex cc24d6c92..cbabf1247 100644--- a/fern/snippets/triggers/python/triggers.py+++ b/fern/snippets/triggers/python/triggers.py@@ -29,5 +29,4 @@ print(trigger_config.config)# },# "required": ["owner", "repo"],# "title": "WebhookConfigSchema",-# "type": "object"-# }\ No newline at end of file+# "type": "object"\ No newline at end of file