Skip to main content
Glama

mcp-google-sheets

new-channel.ts1.67 kB
import { TriggerStrategy, createTrigger } from '@activepieces/pieces-framework'; import { slackAuth } from '../../'; import { WebClient } from '@slack/web-api'; const sampleData = { type: 'channel_created', channel: { id: 'C024BE91L', name: 'fun', created: 1360782804, creator: 'U024BE7LH', }, }; export const channelCreated = createTrigger({ auth: slackAuth, name: 'channel_created', displayName: 'Channel created', description: 'Triggers when a channel is created', props: {}, type: TriggerStrategy.APP_WEBHOOK, sampleData: sampleData, onEnable: async (context) => { // Older OAuth2 has team_id, newer has team.id const teamId = context.auth.data['team_id'] ?? context.auth.data['team']['id']; context.app.createListeners({ events: ['channel_created'], identifierValue: teamId, }); }, onDisable: async (context) => { // Ignored }, test: async (context) => { const client = new WebClient(context.auth.access_token); const response = await client.conversations.list({ exclude_archived: true, limit: 10, types: 'public_channel,private_channel', }); if (!response.channels) { return []; } return response.channels.map((channel) => { return { type: 'channel_created', channel: { id: channel.id, name: channel.name, created: channel.created, creator: channel.creator, }, }; }); }, run: async (context) => { const payloadBody = context.payload.body as PayloadBody; return [payloadBody.event]; }, }); type PayloadBody = { event: object; };

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