Requests

Let's consider several typical interaction scenarios for two users.

One user knows the other's number

User A knows phone number of B (for instance, A has B's number in the phone book). But B does not know А's number. User A sends message to B. Immediately prior to sending a message relevant check is executed at the server side and the link between A and B will change automatically: A's number becomes available for B (user A is then presented as constructor userRequest). The same happens if user B not having A's number sends a message to the latter. A's number also becomes available to B.

Users do not know numbers of each other

User A has found user B in a chat, geochat or any other way. For both of them phone numbers are not available (in API - constructor userForeign). A starts chat with B. When messaging A's number will not become available for B and vice versa. To provide B with A's number it is necessary to send him personal message with contact info (phone number should be transferred in constructor inputMediaContact using method messages.sendMedia). Now B having personal message with A's phone number can store it in his phone book and import it using method contacts.importContacts to have it in contacts. With all that, it is not mandatory for him to send his number: after any message later between them B's number will be available for A (see One user knows the other's number).

Both user know each other number

This is quite obvious: messaging does not change links since target state has been reached.

Technical features

Since when sending messages to a current user updates on changed links are not sent constructors containing updated links were added to resulting types of messaging methods:

messages.statedMessagesLinks messages:Vector<Message> chats:Vector<Chat> users:Vector<User> links:Vector<contacts.Link> pts:int seq:int = messages.StatedMessages;
messages.statedMessageLink message:Message chats:Vector<Chat> users:Vector<User> links:Vector<contacts.Link> pts:int seq:int = messages.StatedMessage;
messages.sentMessageLink id:int date:int pts:int seq:int links:Vector<contacts.Link> = messages.SentMessage;

To indicate for clients that these constructors are supported one should use 3rd layer.