# SendGrid Email Sample

Demonstrates the SendGrid email connector (`SendGridEmailConnector`): sending transactional emails, schema validation, and event webhook processing.

## What it shows

* Building a `Message` with HTML or template content for email delivery
* Sending via `IMessagingClient` using the `sendgrid` channel name
* Validating messages against the SendGrid channel schema before sending
* Parsing inbound email webhook payloads and delivery event callbacks
* Viewing the channel schema, capabilities, and parameters
* Checking connector runtime status

## Run

```bash
cd samples/sendgrid-email
./run.sh -- sendgrid <command>
```

## Commands

| Command                              | Description                                                        |
| ------------------------------------ | ------------------------------------------------------------------ |
| `schema [name]`                      | Show the SendGrid channel schema                                   |
| `configure`                          | Prompt for API Key, sender/recipient addresses, and other settings |
| `send`                               | Build and send a live email interactively                          |
| `validate -k <kind>`                 | Validate a sample message (`html` or `template`)                   |
| `status`                             | Show connector runtime status                                      |
| `receive [-f file] [-m mode]`        | Parse a sample inbound webhook payload                             |
| `receive-status [-f file] [-m mode]` | Parse a sample delivery event callback                             |

## Example

```bash
./run.sh -- sendgrid configure
./run.sh -- sendgrid send
```

You will be prompted to select the message type (HTML or Template), enter sender/recipient, subject, and body.


---

# 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/sendgrid-email.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.
