add_contact()

Client.add_contact()

Add an existing Telegram user as contact, even without a phone number.

Parameters
  • user_id (int | str) – Unique identifier (int) or username (str) of the target user.

  • first_name (str, optional) – User’s first name.

  • last_name (str, optional) – User’s last name.

  • phone_number (str, optional) – User’s phone number.

  • share_phone_number (bool, optional) – Whether or not to share the phone number with the user. Defaults to False.

Returns

User – On success the user is returned.

Example

app.add_contact(12345678, "Foo")
app.add_contact("username", "Bar")