# New Message Sent — WhatsApp Business

> Emit new event when a new message is sent or received. A Webhook subscribed to field "messages" must be set up from the App Dashboard of your Facebook Developer Account. See documentation for more information about Webhook setup.

- Key: `whatsapp_business-new-message-sent`
- Type: Trigger (Instant)
- Version: 0.0.4
- App: WhatsApp Business (`whatsapp_business`) — https://pipedream.com/apps/whatsapp-business.md
- This page (HTML): https://pipedream.com/apps/whatsapp-business/triggers/new-message-sent
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/whatsapp_business/sources/new-message-sent/new-message-sent.mjs

## Description

Emit new event when a new message is sent or received. A Webhook subscribed to field "messages" must be set up from the App Dashboard of your [Facebook Developer Account](https://developers.facebook.com/). See [documentation](https://developers.facebook.com/docs/graph-api/webhooks/getting-started#configure-webhooks-product) for more information about Webhook setup.

## Returns

Events emitted by WhatsApp Business.

## Run it

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const deployed = await pd.triggers.deploy({
  id: "whatsapp_business-new-message-sent",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    whatsapp_business: { authProvisionId: "apn_xxxxxxx" },
  },
  webhookUrl: "https://example.com/webhooks/whatsapp-business",
})

console.log(deployed.id)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/triggers/deploy \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "whatsapp_business-new-message-sent",
    "webhook_url": "https://example.com/webhooks/whatsapp-business",
    "configured_props": {
      "whatsapp_business": { "authProvisionId": "apn_xxxxxxx" }
    }
  }'
```

**MCP**

MCP servers expose WhatsApp Business actions as on-demand tools.

New Message Sent is an event source, so your application deploys it with the Connect SDK or API and then either receives each event at a webhook URL or retrieves events on demand with the trigger events API.

## Event delivery

Every event is sent to the HTTP endpoint you choose when you deploy the source. Or: no webhook required — your app or agent can fetch recent events from the [trigger events API](https://pipedream.com/docs/connect/api-reference/list-trigger-events.md) instead.

---

- App: https://pipedream.com/apps/whatsapp-business.md · All apps: https://pipedream.com/apps
