# Message

## Message

### Send Message

<mark class="gb-c-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 |

**201**

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

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

<mark class="gb-c-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 |

**201**

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

### Send File

<mark class="gb-c-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            |

**201**

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

### Send Message To Group

<mark class="gb-c-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                             |

**201**

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

### Send Picture To Group

<mark class="gb-c-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                                                                            |

**201**

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

### Send File To group

<mark class="gb-c-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             |

**201**

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