# Multi-Connector Sample

Demonstrates running multiple Ratatosk connectors simultaneously in a single ASP.NET Core web application, exposing each through REST API endpoints. Supports all six channel providers: Facebook Messenger, Firebase Cloud Messaging, SendGrid Email, Telegram Bot, Twilio SMS, and Twilio WhatsApp.

## What it shows

* Registering multiple connectors with distinct names in the same DI container
* Using `IMessagingClient` to route messages to different channels by name
* Exposing channel operations through REST endpoints
* Sending messages, receiving webhooks, and checking status over HTTP
* Handling all connector types in a single application with shared configuration

## Run

```bash
cd samples/multi-connector
./run.sh
```

The API server starts on `http://localhost:5000`.

## API endpoints

| Method | Path                        | Description                                     |
| ------ | --------------------------- | ----------------------------------------------- |
| `GET`  | `/schemas`                  | List all registered channel schemas             |
| `POST` | `/{channel}/message`        | Send a message through the specified channel    |
| `POST` | `/{channel}/receive`        | Submit a webhook payload for inbound processing |
| `POST` | `/{channel}/message/status` | Submit a delivery status update                 |
| `GET`  | `/{channel}/status`         | Get connector runtime status                    |

`{channel}` is one of: `facebook`, `firebase`, `sendgrid`, `telegram`, `sms`, `whatsapp`.

## Example

```http
POST /sendgrid/message
Content-Type: application/json

{
  "id": "msg-001",
  "sender": { "type": "email", "address": "sender@example.com" },
  "receiver": { "type": "email", "address": "recipient@example.com" },
  "content": { "type": "text", "text": "Hello from the API!" },
  "properties": {
    "subject": { "name": "Subject", "value": "API Test" }
  }
}
```

## Configuration

Configure credentials in `appsettings.json` or via environment variables. See the [`samples/multi-connector/README.md`](https://github.com/deveel/deveel.messaging/blob/main/samples/multi-connector/README.md) file in the repository for the full configuration reference.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ratatosk.deveel.org/samples/multi-connector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
