What USER_PRIVACY_RESTRICTED means
Telegram's documentation describes this error as follows: the user's privacy settings do not allow you to do this. Each person decides who can add them to groups and channels, call them and write to them: everyone or only contacts, with separate exceptions.
The related code USER_NOT_MUTUAL_CONTACT means the action is open only to mutual contacts.
When it appears
- Adding to a group or channel is the most common case: the person allowed only contacts to add them.
- A call: calls are closed in their settings.
- A message: the person allowed only contacts, or only Premium users, to write to them.
What to do
- Do nothing with this person. Privacy settings cannot be bypassed.
- Instead of adding them to a group, send an invite link. Whether to join is up to the person.
- If your database has many such people, it is not suited for inviting.