Layer 224
method Users
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;

Parameters

Name Type Description
AddPhonePrivacyException flags.0?true Allow the other user to see our phone number?
Id InputUser Telegram ID of the other user
FirstName string First name
LastName string Last name
Phone string User's phone number, may be omitted to simply add the user to the contact list, without a phone number.
Note flags.1?TextWithEntities A private note for this contact, only visible to us; see here for more info on contact notes.

Returns

Updates

Gogram Example

// ContactsAddContact - using Params struct
result, err := client.ContactsAddContact(&tg.ContactsAddContactParams{
    Id: &tg.InputUserSelf{},
    FirstName: "Hello, World!",
    LastName: "Hello, World!",
    Phone: "Hello, World!",

    // Optional fields:
    // AddPhonePrivacyException: true,
    // Note: &tg.TextWithEntities{},
})
if err != nil {
    // handle error
}
// result is *tg.Updates

Possible Errors

Code Type Description
400 CHANNEL_PRIVATE You haven't joined this channel/supergroup.
400 CONTACT_ID_INVALID The provided contact ID is invalid.
400 CONTACT_NAME_EMPTY Contact name empty.
400 MSG_ID_INVALID Invalid message ID provided.