Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

tiny fixes

Sushmithamalleshdb550b1eef2d
diff --git a/fern/pages/src/triggers/using-triggers.mdx b/fern/pages/src/triggers/using-triggers.mdx
index af389214a..2e227dca6 100644
--- a/fern/pages/src/triggers/using-triggers.mdx
+++ b/fern/pages/src/triggers/using-triggers.mdx
@@ -105,15 +105,15 @@ Below are examples of webhook handlers for FastAPI and Next.js applications:
<SnippetCode
src="fern/snippets/triggers/python/trigger-webhook.py"
title="Python (FastAPI)"
- startLine={36}
- endLine={49}
+ startLine={34}
+ endLine={47}
/>
<SnippetCode
src="fern/snippets/triggers/typescript/trigger-webhook.ts"
title="TypeScript (Next.js)"
startLine={39}
- endLine={70}
+ endLine={57}
/>
</CodeGroup>
@@ -135,8 +135,8 @@ To enable verification:
<SnippetCode
src="fern/snippets/triggers/python/trigger-webhook.py"
title="Python"
- startLine={12}
- endLine={34}
+ startLine={10}
+ endLine={32}
/>
<SnippetCode
diff --git a/fern/snippets/triggers/python/trigger-webhook.py b/fern/snippets/triggers/python/trigger-webhook.py
index b4187baad..8e87dc265 100644
--- a/fern/snippets/triggers/python/trigger-webhook.py
+++ b/fern/snippets/triggers/python/trigger-webhook.py
@@ -7,8 +7,6 @@ import hashlib
import base64
import os
-app = FastAPI(title="Webhook Demo")
-
def verify_webhook_signature(request: Request, body: bytes) -> bool:
"""Verify Composio webhook signature"""
webhook_signature = request.headers.get("webhook-signature")
diff --git a/fern/snippets/triggers/typescript/trigger-webhook.ts b/fern/snippets/triggers/typescript/trigger-webhook.ts
index 8ba7a35da..fd41c1b9a 100644
--- a/fern/snippets/triggers/typescript/trigger-webhook.ts
+++ b/fern/snippets/triggers/typescript/trigger-webhook.ts
@@ -37,36 +37,21 @@ function verifyWebhookSignature(
}
export default async function webhookHandler(req: NextApiRequest, res: NextApiResponse) {
- if (req.method !== 'POST') {
- return res.status(405).json({
- status: 'error',
- message: 'Method not allowed'
- });
+ const payload = req.body;
+
+ if (payload.type === 'github_star_added_event') {
+ const event: TriggerEvent<GitHubStarEventData> = {
+ type: payload.type,
+ timestamp: payload.timestamp,
+ data: payload.data
+ };
+
+ console.log(`Repository ${event.data.repository_name} starred by ${event.data.starred_by}`);
+ // Add your business logic here
}
- try {
- const payload = req.body;
-
- if (payload.type === 'github_star_added_event') {
- const event: TriggerEvent<GitHubStarEventData> = {
- type: payload.type,
- timestamp: payload.timestamp,
- data: payload.data
- };
-
- console.log(`Repository ${event.data.repository_name} starred by ${event.data.starred_by}`);
- // Add your business logic here
- }
-
- res.status(200).json({
- status: 'success',
- message: 'Webhook processed'
- });
- } catch (error) {
- console.error('Error processing webhook:', error);
- res.status(500).json({
- status: 'error',
- message: 'Internal server error'
- });
- }
+ res.status(200).json({
+ status: 'success',
+ message: 'Webhook processed'
+ });
}