contacts.importContacts

Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info.

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.importContacts({
        contacts: [new Api.InputContact({...})],
        }));
    console.log(result); // prints the result
})();

TL schema

contacts.importedContacts#77d01c3b imported:Vector<ImportedContact> popular_invites:Vector<PopularContact> retry_contacts:Vector<long> users:Vector<User> = contacts.ImportedContacts;
---functions---
contacts.importContacts#2c800be5 contacts:Vector<InputContact> = contacts.ImportedContacts;

Parameters

Name

Type

Description

contacts

List of contacts to import

Result

contacts.ImportedContacts

Possible errors

Code

Type

Description

Can bots use this methd ?

yes

Add an existing telegram user as contact.

Last updated