Skip to main content
Glama

mcp-google-sheets

new-company-created.ts1.76 kB
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework'; import { ZOHO_WEBHOOK_TOKEN } from '../common/constants'; import { biginAuth } from '../../index'; import { biginApiService } from '../common/request'; const CACHE_KEY = 'bigin_new_company_created_trigger'; export const newCompanyCreated = createTrigger({ auth: biginAuth, name: 'newCompanyCreated', displayName: 'New Company Created', description: 'Triggers when a new company record is created', props: {}, sampleData: {}, type: TriggerStrategy.WEBHOOK, async onEnable(context) { try { const channel_id = Date.now().toString(); const { api_domain } = context.auth as any; const webhookData = { watch: [ { channel_id, events: ['Accounts.create'], notify_url: context.webhookUrl, token: ZOHO_WEBHOOK_TOKEN, }, ], }; await biginApiService.createWebhook( context.auth.access_token, webhookData, api_domain ); await context.store.put(CACHE_KEY, channel_id); } catch (error) { console.error('Failed to enable Zoho webhook'); } }, async onDisable(context) { const channel_id = (await context.store.get(CACHE_KEY)) as string; if (!channel_id) return; const { api_domain } = context.auth as any; await biginApiService.deleteWebhook( context.auth.access_token, api_domain, channel_id ); await context.store.delete(CACHE_KEY); }, async run(context) { const { token } = context.payload.body as any; if (token !== ZOHO_WEBHOOK_TOKEN) { throw new Error('Invalid webhook token'); } return [context.payload.body]; }, });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/activepieces/activepieces'

If you have feedback or need assistance with the MCP directory API, please join our Discord server