# Custom Messaging

This guide explains how to send a custom message in the P2P network using Othentic Stack.

#### Read More

* [Custom Messaging](https://docs.othentic.xyz/main/user-guide/network-management/custom-messaging)

{% stepper %}
{% step %}

#### Enable **Custom Messaging**

To enable the custom P2P messaging feature, Update the Aggregator or Attester node with the following option:

<pre><code><strong>otnode run aggregator \
</strong>    --json-rpc \
    --json-rpc.custom-message-enabled
</code></pre>

```
otnode run attester \
    /ip4/127.0.0.1/tcp/9876/p2p/<BOOTSTRAP_NODE_ID> \
    --json-rpc \
    --json-rpc.custom-message-enabled
```

{% endstep %}

{% step %}

#### Trigger custom message

Submit the `data` to the p2p network using the `sendCustomMessage` RPC call. This is the format for the RPC call:

```json
{
  "jsonrpc": "2.0",
  "method": "sendCustomMessage",
  "params": [<data>] // Raw data in bytes
  "id": 1
}
```

Accepts raw data in `bytes` format.
{% endstep %}

{% step %}

#### Expose an API endpoint

Define an endpoint (`/p2p/message`) that allows Operator nodes to trigger the custom logic. This endpoint should accept `data` as parameters.

<mark style="color:green;">**`POST`**</mark>**&#x20;/p2p/message**

**Headers**

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |

**Body**

<table><thead><tr><th width="167">Parameter</th><th width="92">Type</th><th>Description</th></tr></thead><tbody><tr><td>data</td><td>string</td><td>Represents the data being sent</td></tr></tbody></table>
{% endstep %}
{% endstepper %}
