v.5 by Sergey Chernov
2018-10-27 09:10

Unichat invite codes

The invite codes allow users to be invited to some groups explicitely, diring the registration/login procedure. There are different types of invite codes, but all of them are treated equally by the client application.

The code preocessing flow:

  1. Obtain the code from api, say, with create_group_invite_code(snId).
  2. Form an URL with application-specific parts (domain, protocol), incorporating the code into it. For example code could be added to the query part or to the path.
  3. Deliver the code. It depends on the code and can be done in diferent way. For example:
    • The URL could be published with a group so participants could copy and paste it to others
    • Client application could send the URL with email
    • Client application could use plateform-depending sharing mechanism to deliver the URL
  4. User receives the URL and opens it with any browser
  5. The URL opints to the client web-application or native application so it is activated by opening the URL
  6. Client application parses URL and extracts the invite code.
  7. Clietn application ensures the user is logged in. If not, it should remember the code and perform registration/logging in procedures.
  8. Client application calls use_invite_code(code: <code_string>) and the service do whatever this code should, usuallym subscribe user to some group. Client application will then receive notifications about subscription creation as usual and will get new subscription it its list.

Note that all codes are processed with the same use_invite_code(code: <code_string>) in the excatly same way. See unichat API groups.

Code could be deleted with delete_group_invite_code(snId). See unichat API administration.

Group invite code

This code allow user to enter the group without being invited by another participant. It is being created and resined with create_group_invite_code(snId) and delete_group_invite_code(snId) respectively. See unichat API administration.

Important note. When group invite code is used, the system does not send unichat system message with xtag:"invite", because there is not inviting party. Instead, system posts message on behalf of a new user with xtag:"joined". See unichat system messages.

Personal invite code

In development. Creates and ubsribes p2p chat with some person.