> For the complete documentation index, see [llms.txt](https://docs.amitysolutions.com/ekoai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amitysolutions.com/ekoai/api-reference/botv1/message.md).

# Message

## Message

### Send Message

<mark style="color:green;">`POST`</mark> `https://eko-h1.dev.ekoapp.com/bot/v1/direct/message`

send message from bot to user's direct chat

**Headers**

| Name           | Type   | Description       |
| -------------- | ------ | ----------------- |
| Authentication | string | token from OAuth2 |

**Request Body**

| Name         | Type   | Description                   |
| ------------ | ------ | ----------------------------- |
| uid          | string | targeted userId               |
| message      | object | message's object              |
| message.type | string | text                          |
| message.data | string | message that you want to send |

{% tabs %}
{% tab title="201 " %}

```javascript
{
  "status": "success",
  "message": {
        "id": "5de48f26707e9f529a9c03ff",
        "type": "text",
        "groupId": "5de48f02707e9f529a9c03f8",
        "threadId": "5de48f02707e9f529a9c03f9"
  }
}
```

{% endtab %}
{% endtabs %}

```
// example
{
    uid: <userID>
    message: {
        type: "text",
        data: <any text>
    }
}
```

<mark style="color:green;">`POST`</mark> `https://eko-h1.dev.ekoapp.com/bot/v1/direct/picture`

send picture from bot to user's direct chat

**Headers**

| Name           | Type   | Description       |
| -------------- | ------ | ----------------- |
| Authentication | string | token from OAuth2 |

**Request Body**

| Name    | Type   | Description       |
| ------- | ------ | ----------------- |
| uid     | string | targeted userId   |
| file    | string | picture           |
| caption | string | picture's caption |

{% tabs %}
{% tab title="201 " %}

```javascript
{
  "status": "success",
  "message": {
        "id": "5de48ecd707e9f529a9c03f4",
        "type": "picture",
        "groupId": "5dd37cc68c69855b878f2f7c",
        "threadId": "5dd37cc68c69855b878f2f7d"
    }
}
```

{% endtab %}
{% endtabs %}

### Send File

<mark style="color:green;">`POST`</mark> `https://eko-h1.dev.ekoapp.com/bot/v1/direct/file`

send picture from bot to user's direct chat

**Headers**

| Name           | Type   | Description       |
| -------------- | ------ | ----------------- |
| Authentication | string | token from OAuth2 |

**Request Body**

| Name | Type   | Description     |
| ---- | ------ | --------------- |
| uid  | string | targeted userId |
| file | string | file            |

{% tabs %}
{% tab title="201 " %}

```javascript
{
  "status": "success",
  "message": {
        "id": "5de48ef0707e9f529a9c03f7",
        "type": "file",
        "groupId": "5dd37cc68c69855b878f2f7c",
        "threadId": "5dd37cc68c69855b878f2f7d"
    }
}
```

{% endtab %}
{% endtabs %}

### Send Message To Group

<mark style="color:green;">`POST`</mark> `https://eko-h1.dev.ekoapp.com/bot/v1/group/message`

send message from bot to user's direct chat

**Headers**

| Name           | Type   | Description       |
| -------------- | ------ | ----------------- |
| Authentication | string | token from OAuth2 |

**Request Body**

| Name         | Type   | Description                                               |
| ------------ | ------ | --------------------------------------------------------- |
| gid          | string | targeted group                                            |
| tid          | string | If you leave it empty, the message will send to main chat |
| message      | object | message's object                                          |
| message.type | string | text                                                      |
| message.data | string | message that you want to send                             |

{% tabs %}
{% tab title="201 " %}

```javascript
{
  "status": "success",
  "message": {
        "id": "5de48f26707e9f529a9c03ff",
        "type": "text",
        "groupId": "5de48f02707e9f529a9c03f8",
        "threadId": "5de48f02707e9f529a9c03f9"
    }
}
```

{% endtab %}
{% endtabs %}

### Send Picture To Group

<mark style="color:green;">`POST`</mark> `https://eko-h1.dev.ekoapp.com/bot/v1/group/picture`

send picture from bot to user's direct chat

**Headers**

| Name           | Type   | Description       |
| -------------- | ------ | ----------------- |
| Authentication | string | token from OAuth2 |

**Request Body**

| Name    | Type   | Description                                                                                  |
| ------- | ------ | -------------------------------------------------------------------------------------------- |
| gid     | string | targeted group                                                                               |
| tid     | string | <p>If you leave this one empty, bot will send the picture<br>into the main chat instead.</p> |
| file    | string | picture                                                                                      |
| caption | string | picture's caption                                                                            |

{% tabs %}
{% tab title="201 " %}

```javascript
{
  "status": "success",
  "message": {
        "id": "5de48f26707e9f529a9c03ff",
        "type": "picture",
        "groupId": "5de48f02707e9f529a9c03f8",
        "threadId": "5de48f02707e9f529a9c03f9"
    }
}
```

{% endtab %}
{% endtabs %}

### Send File To group

<mark style="color:green;">`POST`</mark> `https://eko-h1.dev.ekoapp.com/bot/v1/group/file`

send picture from bot to user's direct chat

**Headers**

| Name           | Type   | Description       |
| -------------- | ------ | ----------------- |
| Authentication | string | token from OAuth2 |

**Request Body**

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| gid  | string | targeted groupId |
| file | string | file             |

{% tabs %}
{% tab title="201 " %}

```javascript
{
  "status": "success",
  "message": {
        "id": "5de48f26707e9f529a9c03ff",
        "type": "file",
        "groupId": "5de48f02707e9f529a9c03f8",
        "threadId": "5de48f02707e9f529a9c03f9"
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.amitysolutions.com/ekoai/api-reference/botv1/message.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
