contacts.AddContact

class pyrogram.raw.functions.contacts.AddContact

Add an existing telegram user as contact.

Details:
  • Layer: 227

  • ID: D9BA2E54

Parameters:
  • id (InputUser) – Telegram ID of the other user

  • first_name (str) – First name

  • last_name (str) – Last name

  • phone (str) – User’s phone number, may be omitted to simply add the user to the contact list, without a phone number.

  • add_phone_privacy_exception (bool, optional) – Allow the other user to see our phone number?

  • note (TextWithEntities, optional)

Returns:

Updates

TL Schema

contacts.addContact#d9ba2e54
flags:#
add_phone_privacy_exception:flags.0?true
id:InputUser
first_name:string
last_name:string
phone:string
note:flags.1?TextWithEntities

= Updates

Parameter Tree

AddContact
├── add_phone_privacy_exception → true (optional)
├── id → InputUser
│ ├── InputUserEmpty
│ ├── InputUserSelf
│ ├── InputUser
│ │ ├── user_id → long
│ │ └── access_hash → long
│ └── InputUserFromMessage
│ ├── peer → InputPeer
│ │ ├── InputPeerEmpty
│ │ ├── InputPeerSelf
│ │ ├── InputPeerChat
│ │ ├── InputPeerUser
│ │ ├── InputPeerChannel
│ │ ├── InputPeerUserFromMessage
│ │ └── InputPeerChannelFromMessage
│ ├── msg_id → int
│ └── user_id → long
├── first_name → string
├── last_name → string
├── phone → string
└── note → TextWithEntities (optional)
├── text → string
└── entities → Vector < MessageEntity >
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ ├── length → int
│ └── language → string
│ ├── offset → int
│ ├── length → int
│ └── url → string
│ ├── offset → int
│ ├── length → int
│ └── user_id → long
│ ├── offset → int
│ ├── length → int
│ └── user_id → InputUser
│ ├── InputUserEmpty
│ ├── InputUserSelf
│ ├── InputUser
│ └── InputUserFromMessage
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ ├── length → int
│ └── document_id → long
│ ├── collapsed → true (optional)
│ ├── offset → int
│ └── length → int
│ ├── relative → true (optional)
│ ├── short_time → true (optional)
│ ├── long_time → true (optional)
│ ├── short_date → true (optional)
│ ├── long_date → true (optional)
│ ├── day_of_week → true (optional)
│ ├── offset → int
│ ├── length → int
│ └── date → int
│ ├── offset → int
│ └── length → int
│ ├── offset → int
│ ├── length → int
│ └── old_text → string
├── offset → int
└── length → int

Example

await app.invoke(
    AddContact(
        add_phone_privacy_exception=None,
        id=await app.resolve_user(chat_id),
        first_name="text",
        last_name="text",
        phone="+1234567890",
        note=TextWithEntities(
            text="Open",
            entities=[
                    MessageEntityUnknown(
                        offset=0,
                        length=0
                    )
                ]
        ),
    )
)