contacts.AddContact

class pyrogram.raw.functions.contacts.AddContact

Add an existing telegram user as contact.

Details:
  • Layer: 223

  • 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_exceptiontrue (optional)
├── idInputUser
│ ├── InputUserEmpty
│ ├── InputUserSelf
│ ├── InputUser
│ │ ├── user_idlong
│ │ └── access_hashlong
│ └── InputUserFromMessage
│ ├── peerInputPeer
│ │ ├── InputPeerEmpty
│ │ ├── InputPeerSelf
│ │ ├── InputPeerChat
│ │ ├── InputPeerUser
│ │ ├── InputPeerChannel
│ │ ├── InputPeerUserFromMessage
│ │ └── InputPeerChannelFromMessage
│ ├── msg_idint
│ └── user_idlong
├── first_namestring
├── last_namestring
├── phonestring
└── noteTextWithEntities (optional)
├── textstring
└── entitiesVector < MessageEntity >
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ ├── lengthint
│ └── languagestring
│ ├── offsetint
│ ├── lengthint
│ └── urlstring
│ ├── offsetint
│ ├── lengthint
│ └── user_idlong
│ ├── offsetint
│ ├── lengthint
│ └── user_idInputUser
│ ├── InputUserEmpty
│ ├── InputUserSelf
│ ├── InputUser
│ └── InputUserFromMessage
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ └── lengthint
│ ├── offsetint
│ ├── lengthint
│ └── document_idlong
│ ├── collapsedtrue (optional)
│ ├── offsetint
│ └── lengthint
├── relativetrue (optional)
├── short_timetrue (optional)
├── long_timetrue (optional)
├── short_datetrue (optional)
├── long_datetrue (optional)
├── day_of_weektrue (optional)
├── offsetint
├── lengthint
└── dateint

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
                    )
                ]
        ),
    )
)