contacts.getContacts

Returns the current user's contact list.

Example

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.contacts.getContacts({
        hash: 3457568,
        }));
    console.log(result); // prints the result
})();

TL schema

contacts.contactsNotModified#b74ba9d2 = contacts.Contacts;
contacts.contacts#eae87e42 contacts:Vector<Contact> saved_count:int users:Vector<User> = contacts.Contacts;
---functions---
contacts.getContacts#c023849f hash:int = contacts.Contacts;

Parameters

Name

Type

Description

hash

If there already is a full contact list on the client, a hash of a the list of contact IDs in ascending order may be passed in this parameter. If the contact set was not changed, (contacts.contactsNotModified) will be returned.

Result

contacts.Contacts

Possible errors

Code

Type

Description

Can bots use this methd ?

yes

How to fetch results from large lists of objects.

Contact list on the server is the same as the list on the client.

Last updated