Notifications API


ROQ's notifications enable you to notify your users or user groups on various channels.

To notify your users you can use the notify() API. It's important to use the same key which you set to the notification template.




This endpoint is only available from the server side of your application.

The notify() mutation enables you to notify:

  • A single user or multiple users
  • Users of one or multiple user groups
  • All of your users.

You can find the full API doc of this mutation here (opens in a new tab).

The API requires a key parameter that you need to configure in ROQ Console, see instructions here. There are two ways to notify users: with GraphQL query and Node.js SDK

The notified users are defined in the recipients property or variable as shown below:

await client.asSuperAdmin().notify({
  notification: {
    key: 'aaa',
    recipients: {
      userIds: ['abc123'],
      userGroups: { operator: 'AND', userGroupIds: ['xyz789'] },
      excludedUserIds: ['abc123'],
      allUsers: false,
      tenantIds: ['1netenant', 'zxy-ten01']
    data: [{ key: 'xyz789', value: 'xyz789' }],
keystringKey of notification-type that you created in the Console, eg."WELCOME_NOTIFICATION"
recipients:userIdsarrayArray of user IDs that are notified.
recipients:userGroupsobjectAn object that represents a list of user groups and an operator which can be set to "AND"(intersection of users) and "OR" (union of users).
recipients:excludedUserIdsarrayList of user IDs (of ROQ Platform) who shouldn't be notified. A typical use case is when a user performs an action and all users of the same user group should be notified, except for the acting user
recipients:allUsersboolIf set to true then all users will be notified.
recipients:tenantIdsarrayList of tenant IDs that will be notified.
dataarrayList of key/value pairs that you can use in the content section of the Notification template



We can fetch notifications by using the notifications() query. You can find the full API doc of this query here (opens in a new tab).

await client.asSuperAdmin().notifications();

Default Variables

In the ROQ Notification template system, default variables will always be passed to the template. These variables are:


This variable hold the first name of the recipient. If you don't set the first name in your profile, this variable will return empty.


This variable holds the last name of the recipient, and if you are not set this in the user profile, then this variable will return empty.


This variable will return the application URL for a particular environment.