> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zavu.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Receive inbound messages from your customers via webhooks

Zavu delivers incoming messages to your application in real-time via webhooks. When a customer sends you a message via SMS or WhatsApp, we forward it to your configured endpoint within seconds.

## How It Works

```
Customer Message → Zavu → Your Webhook → Your Application
```

1. A customer sends a message to your Sender's phone number
2. Zavu receives the message from the carrier (SMS) or Meta (WhatsApp)
3. We forward the message to your registered webhook URL
4. Your application processes the message and responds if needed

## Quick Start

### 1. Set Up Your Endpoint

Create an endpoint that accepts POST requests. Here's a minimal example:

<CodeGroup>
  ```typescript TypeScript (Express) theme={null}
  app.post("/webhooks/zavu", (req, res) => {
    const event = req.body;

    if (event.type === "message.inbound") {
      console.log("New message from:", event.data.from);
      console.log("Message:", event.data.text);
    }

    res.status(200).send("OK");
  });
  ```

  ```python Python (Flask) theme={null}
  @app.route("/webhooks/zavu", methods=["POST"])
  def handle_webhook():
      event = request.json

      if event["type"] == "message.inbound":
          print(f"New message from: {event['data']['from']}")
          print(f"Message: {event['data']['text']}")

      return "OK", 200
  ```

  ```ruby Ruby (Sinatra) theme={null}
  post "/webhooks/zavu" do
    event = JSON.parse(request.body.read)

    if event["type"] == "message.inbound"
      puts "New message from: #{event['data']['from']}"
      puts "Message: #{event['data']['text']}"
    end

    status 200
    "OK"
  end
  ```

  ```go Go theme={null}
  func webhookHandler(w http.ResponseWriter, r *http.Request) {
  	var event map[string]interface{}
  	json.NewDecoder(r.Body).Decode(&event)

  	if event["type"] == "message.inbound" {
  		data := event["data"].(map[string]interface{})
  		fmt.Println("New message from:", data["from"])
  		fmt.Println("Message:", data["text"])
  	}

  	w.WriteHeader(http.StatusOK)
  	w.Write([]byte("OK"))
  }
  ```

  ```php PHP theme={null}
  <?php
  $event = json_decode(file_get_contents('php://input'), true);

  if ($event['type'] === 'message.inbound') {
      echo "New message from: " . $event['data']['from'] . "\n";
      echo "Message: " . $event['data']['text'] . "\n";
  }

  http_response_code(200);
  echo "OK";
  ```
</CodeGroup>

### 2. Register Your Webhook

Configure your webhook URL in the [Dashboard](https://dashboard.zavu.dev) under your Sender settings, or via the API.

### 3. Start Receiving Messages

Once configured, Zavu will send `message.inbound` events to your endpoint whenever a customer messages you.

## Webhook Events

| Event               | Description                                             | Use Case               |
| ------------------- | ------------------------------------------------------- | ---------------------- |
| `conversation.new`  | New conversation started (first message from a contact) | **New leads/contacts** |
| `message.inbound`   | Customer sent you a message                             | **Receiving messages** |
| `message.queued`    | Your message was queued for delivery                    | Outbound tracking      |
| `message.sent`      | Your message was sent to the carrier                    | Outbound tracking      |
| `message.delivered` | Your message was delivered                              | Outbound tracking      |
| `message.failed`    | Message delivery failed                                 | Outbound tracking      |

<Note>
  For receiving messages, subscribe to `message.inbound`. Add `conversation.new` if you want to be notified when a new contact messages you for the first time. The other events are for tracking outbound message delivery.
</Note>

<Tip>
  Webhooks are configured per Sender. If you have multiple Senders, you can route their events to different endpoints or use the `senderId` field to identify the source.
</Tip>

## Next Steps

* [Configure Webhooks](/guides/receiving-messages/webhooks) - Set up your webhook endpoints
* [Event Types](/guides/receiving-messages/events) - Detailed event payload documentation
* [Security](/guides/receiving-messages/security) - Verify webhook signatures
