> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.apologist.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.apologist.ai/_mcp/server.

# WhatsApp Message Webhook

POST https://your-agent-domain.com/api/v1/channels/{id}/whatsapp
Content-Type: application/json

Receives WhatsApp Cloud API message events for the channel. Payload shape is defined by Meta. Signature verification via `x-hub-signature-256` is used when the channel has an App Secret configured; otherwise the webhook relies on URL secrecy and/or an `api_key` query parameter.

Reference: https://docs.apologist.ai/agent-api/api-reference/channels/receive-whats-app-message

## Request

### Path parameters

- `id` (string, required) — The channel id

### Headers

- `x-hub-signature-256` (string, optional) — Meta `sha256=<hex>` HMAC of the raw body keyed with the WhatsApp App Secret. Required when the channel has an App Secret configured and the webhook URL does not include an api\_key.

## Response

### 200

Event acknowledged

## Errors

### 403 Forbidden Error

Invalid webhook signature

- `any`

### 500 Internal Server Error

Internal Server Error

- `any`

### 503 Service Unavailable Error

Service Unavailable

- `any`

## Examples

**Request**

```json
{}
```

**Response**

```json
{}
```

**SDK Code**

```typescript
import { ApologistAgentClient } from "apologist";

async function main() {
    const client = new ApologistAgentClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.channels.receiveWhatsAppMessage({
        id: "id",
        body: {},
    });
}
main();

```

```python
from apologist import ApologistAgentClient

client = ApologistAgentClient(
    api_key="YOUR_API_KEY_HERE",
)

client.channels.receive_whats_app_message(
    id="id",
    request={},
)

```

```java
package com.example.usage;

import ai.apologist.AgentClient;
import ai.apologist.resources.channels.requests.ReceiveWhatsAppMessageRequest;
import java.util.HashMap;

public class Example {
    public static void main(String[] args) {
        AgentClient client = AgentClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.channels().receiveWhatsAppMessage(
            "id",
            ReceiveWhatsAppMessageRequest
                .builder()
                .body(
                    new HashMap<String, Object>()
                )
                .build()
        );
    }
}
```

```ruby
require "apologist"

client = Apologist::AgentClient.new(api_key: "YOUR_API_KEY_HERE")

client.channels.receive_whats_app_message(
  id: "id",
  body: {}
)

```

```csharp
using Apologist;
using System.Threading.Tasks;
using System.Collections.Generic;

public partial class Examples
{
    public async Task Example() {
        var client = new AgentClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.Channels.ReceiveWhatsAppMessageAsync(
            new ReceiveWhatsAppMessageRequest {
                Id = "id",
                Body = new Dictionary<string, object?>()
            }
        );
    }

}

```

```go
package example

import (
    context "context"

    apgsdkgo "github.com/apologist-project/apg-sdk-go"
    client "github.com/apologist-project/apg-sdk-go/client"
    option "github.com/apologist-project/apg-sdk-go/option"
)

func do() {
    client := client.NewApologistAgentClient(
        option.WithAPIKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    request := &apgsdkgo.ReceiveWhatsAppMessageRequest{
        ID: "id",
        Body: map[string]any{},
    }
    client.Channels.ReceiveWhatsAppMessage(
        context.TODO(),
        request,
    )
}

```

```php
<?php

namespace Example;

use Apologist\AgentClient;
use Apologist\Channels\Requests\ReceiveWhatsAppMessageRequest;

$client = new AgentClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->channels->receiveWhatsAppMessage(
    'id',
    new ReceiveWhatsAppMessageRequest([
        'body' => [],
    ]),
);

```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://your-agent-domain.com/api/v1/channels/id/whatsapp")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```