import { WhatsAppIcon } from '@/components/icons'
import type { TriggerConfig } from '../types'
export const whatsappWebhookTrigger: TriggerConfig = {
id: 'whatsapp_webhook',
name: 'WhatsApp Webhook',
provider: 'whatsapp',
description: 'Trigger workflow from WhatsApp incoming messages and message status webhooks',
version: '1.0.0',
icon: WhatsAppIcon,
subBlocks: [
{
id: 'webhookUrlDisplay',
title: 'Webhook URL',
type: 'short-input',
readOnly: true,
showCopyButton: true,
useWebhookUrl: true,
placeholder: 'Webhook URL will be generated',
mode: 'trigger',
},
{
id: 'verificationToken',
title: 'Verification Token',
type: 'short-input',
placeholder: 'Generate or enter a verification token',
description:
"Enter any secure token here. You'll need to provide the same token in your WhatsApp Business Platform dashboard.",
password: true,
required: true,
mode: 'trigger',
},
{
id: 'appSecret',
title: 'App Secret',
type: 'short-input',
placeholder: 'Paste your Meta app secret',
description:
'Required for WhatsApp POST signature verification. Sim uses it to validate the X-Hub-Signature-256 header on every webhook delivery.',
password: true,
required: true,
mode: 'trigger',
},
{
id: 'triggerInstructions',
title: 'Setup Instructions',
hideFromPreview: true,
type: 'text',
defaultValue: [
'Go to your Meta App Dashboard and open the app connected to your WhatsApp Business Platform setup. If you used the WhatsApp use case flow, the configuration page may be under Use cases > Customize > Configuration instead of WhatsApp > Configuration.',
'If you do not already have an app, create one first and add the WhatsApp product before configuring webhooks.',
'Click "Save Configuration" above before verifying the callback URL so Sim has an active WhatsApp webhook config for this path. If this workflow is already deployed and you change the verification token or app secret, redeploy before re-verifying in Meta.',
'In WhatsApp > Configuration, find the Webhooks section and click Edit.',
'Paste the Webhook URL above into the "Callback URL" field.',
'Paste the Verification Token into the "Verify token" field.',
"Copy your app's App Secret from App Settings > Basic and paste it into the App Secret field above so Sim can validate POST signatures.",
'Click "Verify and save".',
'Click Manage next to webhook fields and subscribe to messages. That field covers incoming messages and outbound message status updates.',
]
.map(
(instruction, index) =>
`