Skip to main content
Glama

mcp-google-sheets

new-unsubscriber.ts1.28 kB
import { createTrigger, TriggerStrategy } from '@activepieces/pieces-framework'; import { makeSenderRequest, senderAuth } from '../common/common'; import { HttpMethod } from '@activepieces/pieces-common'; export const newUnsubscriberTrigger = createTrigger({ auth: senderAuth, name: 'new_unsubscriber', displayName: 'New Unsubscriber', description: 'Fires when someone unsubscribes globally', type: TriggerStrategy.WEBHOOK, props: {}, async onEnable(context) { const webhookUrl = context.webhookUrl; const webhookData = { url: webhookUrl, topic: 'subscribers/unsubscribed', }; const response = await makeSenderRequest( context.auth, '/account/webhooks', HttpMethod.POST, webhookData ); await context.store.put('webhookId', response.body.data.id); }, async onDisable(context) { const webhookId = await context.store.get<string>('webhookId'); if (webhookId) { await makeSenderRequest( context.auth, `/account/webhooks/${webhookId}`, HttpMethod.DELETE ); } await context.store.delete('webhookId'); }, async run(context) { return [context.payload.body]; }, async test(context) { return []; }, sampleData: {}, });

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