> For the complete documentation index, see [llms.txt](https://painor.gitbook.io/gramjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://painor.gitbook.io/gramjs/working-with-dialogs/messages.getpeerdialogs.md).

# messages.getPeerDialogs

Get dialog info of specified peers

## Example

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

```javascript
const {Api, TelegramClient} = require('telegram');
const {StringSession} = require('telegram/sessions');

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result = await client.invoke(new Api.messages.getPeerDialogs({
        peers: [new Api.InputDialogPeer({...})],
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import {Api, TelegramClient} from 'telegram';
import {StringSession} from 'telegram/sessions';

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result: Api.messages.PeerDialogs = await client.invoke(new Api.messages.getPeerDialogs({
        peers: [new Api.InputDialogPeer({...})],
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}
{% endtabs %}

## TL schema

```
messages.peerDialogs#3371c354 dialogs:Vector<Dialog> messages:Vector<Message> chats:Vector<Chat> users:Vector<User> state:updates.State = messages.PeerDialogs;
---functions---
messages.getPeerDialogs#e470bcfd peers:Vector<InputDialogPeer> = messages.PeerDialogs;
```

## Parameters

|    Name   | Type                                                                                                                      | Description |
| :-------: | ------------------------------------------------------------------------------------------------------------------------- | ----------- |
| **peers** | [Vector](https://core.telegram.org/type/Vector%20t) < [InputDialogPeer](https://core.telegram.org/type/InputDialogPeer) > | Peers       |

## Result

[messages.PeerDialogs](https://core.telegram.org/type/messages.PeerDialogs)

## Possible errors

| Code | Type                             | Description                                |
| :--: | -------------------------------- | ------------------------------------------ |
|  400 | CHANNEL\_INVALID                 | The provided channel is invalid            |
|  400 | CHANNEL\_PRIVATE                 | You haven't joined this channel/supergroup |
|  400 | CONNECTION\_DEVICE\_MODEL\_EMPTY | Device model empty                         |
|  400 | MSG\_ID\_INVALID                 | Invalid message ID provided                |
|  400 | PEER\_ID\_INVALID                | The provided peer id is invalid            |

## Can bots use this methd ?

### yes

## Related pages
