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

# Gateway Message • Rust AI Agent SDK

> GatewayMessage: A message sent through the gateway.

# GatewayMessage

> Defined in the [**gateway**](../modules/gateway) module.

<Badge color="orange">Rust AI Agent SDK</Badge>

A message sent through the gateway.

## Fields

| Name         | Type                   | Description                               |
| ------------ | ---------------------- | ----------------------------------------- |
| `content`    | `serde_json::Value`    | Message content (text or structured data) |
| `sender_id`  | `String`               | Sender identifier                         |
| `session_id` | `String`               | Session this message belongs to           |
| `message_id` | `String`               | Unique message identifier                 |
| `timestamp`  | `f64`                  | Message creation time (Unix timestamp)    |
| `metadata`   | `HashMap&lt;String`    | Additional message metadata               |
| `serde_json` | `:Value&gt;`           | Additional message metadata               |
| `reply_to`   | `Option&lt;String&gt;` | ID of message being replied to (optional) |

## Methods

### `new`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn new(
        content: impl Into<serde_json::Value>,
        sender_id: impl Into<String>,
        session_id: impl Into<String>,
    ) -> Self
```

Create a new gateway message.

**Parameters:**

| Name         | Type                                 |
| ------------ | ------------------------------------ |
| `content`    | `impl Into&lt;serde_json::Value&gt;` |
| `sender_id`  | `impl Into&lt;String&gt;`            |
| `session_id` | `impl Into&lt;String&gt;`            |

### `text`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn text(
        text: impl Into<String>,
        sender_id: impl Into<String>,
        session_id: impl Into<String>,
    ) -> Self
```

Create a text message.

**Parameters:**

| Name         | Type                      |
| ------------ | ------------------------- |
| `text`       | `impl Into&lt;String&gt;` |
| `sender_id`  | `impl Into&lt;String&gt;` |
| `session_id` | `impl Into&lt;String&gt;` |

### `reply_to`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn reply_to(mut self, message_id: impl Into<String>) -> Self
```

Set reply\_to message ID.

**Parameters:**

| Name         | Type                      |
| ------------ | ------------------------- |
| `message_id` | `impl Into&lt;String&gt;` |

### `metadata`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn metadata(mut self, key: impl Into<String>, value: serde_json::Value) -> Self
```

Add metadata.

**Parameters:**

| Name    | Type                      |
| ------- | ------------------------- |
| `key`   | `impl Into&lt;String&gt;` |
| `value` | `serde_json::Value`       |

### `text_content`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn text_content(&self) -> Option<&str>
```

Get text content if available.

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/gateway/mod.rs#L190">
  `praisonai/src/gateway/mod.rs` at line 190
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Gateway" icon="tower-broadcast" href="/docs/rust/gateway" />
</CardGroup>
