Notifications to all app users

To send a notification to OK app users whose profiles match the specified criteria, use the OK API method notifications.sendMass.

For more information about working with the OK API, see Server-side API calls.

Limitations

  • Only users who have launched the app within the last 7 days will receive notifications.
  • Only one notification from an app can be displayed to a user, so a new notification will replace the previous one if it hasn't been closed yet.

Request parameters

When calling the OK API, you also need to pass the common request parameters.

Field
Type
Description
text
string
Required. Notification text. Maximum 100 characters. No more than 5 special characters or emojis are allowed.
expires
string
Required. Date and time until which the notification is active. Format: YYYY.MM.DD HH:mm. The value must be no more than 14 days later than the current date. Time zone: MSK (UTC+03:00).
status
string
Notification visibility. Possible values:    • PUBLIC or P — app users (default).    • ADMINS_ONLY or A — app developers.
gender
string
Recipient gender from the profile data. Possible values:    • MALE or M.    • FEMALE or F.
age_range
string
Recipient age range. Format: <min>-<max>, for example 20-25.
birthday_range
string
Recipient birthday date range. Format: MM.DD-MM.DD.
country
string
Country code in the user profile.
city
string
City code in the user profile.
custom_button_key
string
Action button key in the notification. Default: button_launch (Start playing).

Response parameters

Field
Type
Description
id
string
Campaign ID in the following format: t12345678912345000_123_m.

Example

Send a mass notification “Your friend needs help” to all users who match the criteria: male gender, age 20–25. The notification will be active until 12:00 on August 5, 2026. The notification will display the “More details” button.

If the request is successful, the response will contain the campaign ID in the t12345678912345000_123_m format.

CURL

Bash
curl 'https://api.ok.ru/fb.do' \ -X POST \ -F 'application_key=<PUBLIC_KEY>' \ -F 'method=notifications.sendMass' \ -F 'text=Your friend needs help' \ -F 'expires=2026.07.30 12:00' \ -F 'status=PUBLIC' \ -F 'custom_button_key=button_more' \ -F 'sig=<REQUEST_SIGNATURE>'

JavaScript (Node.js)

JavaScript
const params = { text: 'Your friend needs help', expires: '2026.08.05 12:00', status: 'PUBLIC', gender: 'M', age_range: '20-25', custom_button_key: 'button_more' }; callAPI('notifications.sendMass', params) .then(data => console.log(data));

An example of the callAPI function with request signature generation is described in Working with the OK API.

Stop sending

To cancel a notification campaign, use the notifications.stopSendMass method. In the id field, pass the campaign ID received in the response to notifications.sendMass:

Bash
curl 'https://api.ok.ru/fb.do' \ -X POST \ -F 'application_key=<PUBLIC_KEY>' \ -F 'method=notifications.stopSendMass' \ -F 'id=<CAMPAIGN_ID>' \ -F 'sig=<REQUEST_SIGNATURE>'

Action button in a notification

You can choose which text will be displayed on the action button in the notification:

  • button_join — Join.
  • button_accept — Accept.
  • button_attach_badge — Attach.
  • button_attend — I’m going.
  • button_close — Close.
  • button_confirmFriend — Confirm.
  • button_decline — Decline.
  • button_enable — Enable.
  • button_hide — Hide.
  • button_install — Install.
  • button_launch — Start playing.
  • button_launch_app — Launch.
  • button_more — More details.
  • button_open — View.
  • button_open_all — View all.
  • button_pay — Pay.
  • button_realProlong — Extend.
  • button_rejectRequest — Decline.
  • button_sendPresent — Gift.
  • button_show — Show.
  • button_subscribe — Subscribe.
  • button_unsubscribe_cancel — Cancel.
  • button_use_coupon — Use coupon.
  • button_view — See what’s inside.

Related materials