---
name: "getMessageList"
mode: "kit"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.0.5" }
---

## getMessageList

> [VERSION] @tuya-miniapp/cloud-api >= 1.0.5

### Description

Query message list

### Parameters

`Params`

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `params` | `QueryGetMessageList` | Yes | - | Request body |

### Referenced Types

##### `type` QueryGetMessageList

| Property | Type | Description |
| --- | --- | --- |
| `sourceIds` | `string[]` | Device ID list |
| `limit` | `number` | Requested count |
| `offset` | `number` | Pagination offset |

##### `interface` VisionBoxMessage

| Property | Type | Description |
| --- | --- | --- |
| `msgTypeContent` | `string` | Message type content |
| `msgContent` | `string` | Message content |
| `time` | `number` | Timestamp |
| `msgTitle` | `string` | Message title |
| `dateTime` | `string` | Datetime string |
| `attachPics` | `string` | Attachment image |
| `id` | `number` | Message primary key ID |
| `idStr` | `string` | Message ID in string form |
| `homeId` | `number` | Home ID |
| `msgSrcId` | `string` | Message source ID |
| `businessKey` | `string` | Business secret key field |


### Examples

#### Request example

```typescript
import { getMessageList } from '@tuya-miniapp/cloud-api';

getMessageList({ sourceIds: ['vdevo1'], limit: 20, offset: 0 })
  .then((res) => console.log(res))
  .catch(console.error);
```

#### Response example

```json
{
  "pageNo": 1,
  "datas": [
    {
      "msgTypeContent": "4",
      "msgContent": "{}",
      "time": 1700000000000,
      "msgTitle": "Sample Message",
      "dateTime": "2024-01-01 12:00:00",
      "attachPics": "",
      "id": 1,
      "idStr": "1",
      "homeId": 194137,
      "msgSrcId": "src-1",
      "businessKey": "******"
    }
  ],
  "totalCount": 1,
  "class": "4"
}
```
