Layer 220
ContactsAddContact
Add an existing telegram user as contact.
method
Users
contacts.addContact#e8f463d0 flags:# add_phone_privacy_exception:flags.0?true id:InputUser first_name:string last_name:string phone:string = Updates;
Parameters
| Name | Type | Description |
|---|---|---|
| Flags | # | Flags, see TL conditional fields |
| 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. |
Returns
UpdatesPossible 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. |
Gogram Example
// ContactsAddContact - using Params struct result, err := client.ContactsAddContact(&tg.ContactsAddContactParams{ Id: &tg.InputUserSelf{}, FirstName: "...", LastName: "...", Phone: "...", // Optional fields: // AddPhonePrivacyException: true, }) if err != nil { // handle error } // result is *tg.Updates