Mails API


ROQ Platform provides a unified way to send emails utilizing multiple providers like Sendgrid, Mandrill, Mailgun, and others. Please refer to the mails feature guide for more information and instructions.

Send mails

These APIs are only available from the server side of your application.


The sendMail() method can be used to send emails. It returns the number of emails sent.

import { roqServerClient } from "lib/roq/roq-server-client";
await roqServerClient.roqPlatform.asSuperAdmin().sendMail({
  mail: {
      key: 'onboarding',
      locale: 'en-US',
      emails: [''],
      data: [{ key: 'name', value: 'Francis84' }] },
keystringKey of mail type that you created in ROQ Console, e.g."WELCOME_NOTIFICATION"
localestringLocale (language) of the mail, eg "en-US"
emailsarrayList of email addresses
dataarrayArray with key/value pairs. You can use this data in the template


The sendUserResetPasswordMail() method can be used to send a reset password email to a user.

import { roqServerClient } from "lib/roq/roq-server-client";
await roqServerClient.roqPlatform.asSuperAdmin().sendUserResetPasswordMail({
  userId: "5f9b3b1b-3b1b-4b3b-9b3b-1b3b4b3b9b3b"

The returns value:

{"data": {"sendUserResetPasswordMail": true}}
userIdstringuser ID of the user that you want to send the reset password email to