Views: 1769 (Data available since 06.02.2017)

When installing and updating the application, 2 events are used: ONAPPINSTALL and ONAPPUPDATE. Both events has the same set of data, with only one different parameter - [PREVIOUS_VERSION] => 1, where old version of the app is specified.


ONAPPINSTALL event for installation of the application

[data] => Array(
  [LANGUAGE_ID] = com // Account basic language
  [VERSION] = 1 // Application version
)
[auth] => Array(
    [access_token] => lh8ze36o8ulgrljbyscr36c7ay5sinva // Key to send request to REST service
    [scope] => imbot // Permitted access levels 
    [domain] => b24.hazz // Bitrix24 domain account, on which the application is installed
    [application_token] => c917d38f6bdb84e9d9e0bfe9d585be73 // Application token will help you to "fend off" redundant requests to event handler; this field is available in all events

    [expires_in] => 3600 // Token expiration period, after which new token will have to be requested
    [member_id] => d41d8cd98f00b204e9800998ecf8427e // Unique account ID, required to extend authentication
    [refresh_token] => 5f1ih5tsnsb11sc5heg3kp4ywqnjhd09 // Key to extend authentication
)

ONAPPUPDATE event to update application

[data] => Array(
  [LANGUAGE_ID] = com // Account basic language
  [VERSION] = 2 // Application new version
  [PREVIOUS_VERSION] => 1 // Application old version
)
[auth] => Array(
    [access_token] => lh8ze36o8ulgrljbyscr36c7ay5sinva // Key to send request to REST service
    [scope] => imbot // Permitted access levels 
    [domain] => b24.hazz // Bitrix24 domain account, on which the application is installed
    [application_token] => c917d38f6bdb84e9d9e0bfe9d585be73 // Application token will help you to "end off" redundant requests to event handler; this field is available in all events

    [expires_in] => 3600 // Token expiration period, after which new token will have to be requested
    [member_id] => d41d8cd98f00b204e9800998ecf8427e // Unique account ID, required to extend authentication
    [refresh_token] => 5f1ih5tsnsb11sc5heg3kp4ywqnjhd09 // Key to extend authentication
)

Attention! Fields expires_in, member_id, refresh_token - are not required in the basic chatbot operation. But, if it's required for your application, then you can read how to work with them here. Extension option is included into the bot example.





Courses developed by «Bitrix», Inc.