AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { createAction, Property } from '@activepieces/pieces-framework';
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
import { whatsappAuth } from '../auth';
import { commonProps, WHATSAPP_API_BASE } from '../common/utils';
import { messageSendOutputSchema } from '../output-schemas';
export const sendMessage = createAction({
auth: whatsappAuth,
name: 'sendMessage',
outputSchema: messageSendOutputSchema,
classification: 'WRITE',
displayName: 'Send Message',
description: 'Send a text message through WhatsApp',
audience: 'both',
aiMetadata: { description: 'Sends a plain text WhatsApp message from a business phone number to a single recipient via the WhatsApp Cloud API. Choose this for free-form text replies or notifications when no media or pre-approved template is needed; for media use Send Media and for marketing/utility templates use Send Template Message. Requires the sender phone number ID and the recipient phone number in international format; outside the 24-hour customer service window only template messages are deliverable. Not idempotent — each call delivers a new message.', idempotent: false },
props: {
phone_number_id: commonProps.phone_number_id,
to: Property.ShortText({
displayName: 'To',
description: "Recipient's phone number in international format.",
placeholder: '15551234567',
required: true,
}),
text: Property.LongText({
displayName: 'Message',
description: 'Plain text, up to 4096 characters.',
required: true,
}),
},
async run(context) {
const { to, text, phone_number_id } = context.propsValue;
const { access_token } = context.auth.props;
const response = await httpClient.sendRequest({
method: HttpMethod.POST,
url: `${WHATSAPP_API_BASE}/${phone_number_id}/messages`,
headers: {
Authorization: 'Bearer ' + access_token,
},
body: {
messaging_product: 'whatsapp',
recipient_type: 'individual',
to,
type: 'text',
text: {
body: text,
},
},
});
return response.body;
},
});