Bot API

Bot API changes

Attention! This is a second version of Bot API. It should mostly work the as the previous version but some things may and do differ:

  • base API address has changed. Previously it was https://botapi.ok.ru, now it is https://api.ok.ru/graph;
  • access_token format has changed. If you already use a previously generated token it is highly recommended to renew it;
  • error response format has changed. New format follow traditional OK API error response format. More info about errors;
  • object IDs and object IDs format have changed. You need to update them after migrating to new Bot API version;
  • access token lifetime is restricted to 30 days but is renewed every time an API method is invoked using this token. It now works as a LONG_ACCESS_TOKEN.

Group messaging

Group messaging is a service for instant messages between OK group and it’s members developed on a base of Graph API.

Group messages are currently available for all our users on mobile and desktop version of OK. It is planned to add this feature in our native Android and iOS applications in nearest future.

Group moderators can communicate with group members on a desktop version of OK or by using Bot API.

Acquiring an access token

Specific access token must be acquired in order to use Bot API.

Acc

Для работы с Bot API от имени группы необходимо получить специальный ключ доступа.

Access token is a special string that is used when invoking API methods on group’s behalf. It should be passed in a access_token parameter when working with API.

Group administrator can get this token on settings page of a group.

Follow this step to get your access token:

  1. Open a «Settings» page of a group

  2. Open a «Management» section

  3. Press a key «Generate access key» and the bottom of the page

  4. Confirm your choice

  5. Get a token and use it while working with API

Available methods

Bot API is based on Graph API

With Bot API you can do the following things: