Requirements
To follow the steps in this quickstart, you’ll need:- A Novu account. Sign up for free if you don’t have one yet.
- A working Ruby development environment with at least version 2.6.0.
Install Novu Ruby SDK
The Ruby SDK provides a fluent and expressive interface for interacting with Novu’s API and managing notifications. You can install the client library via RubyGems:bundle install
.
Initialize & Configure the Novu Ruby SDK
To use the library, Create a new fileindex.rb
then initialize the client with your API token:
<NOVU_API_KEY>
argument with the authentic key from the API Key section of your Novu Dashboard.
Please do not hardcode your credentials in a file in production. Use environment variables instead.
index.rb
:
Set Up A Channel Provider
A channel provider is a service that provides one or more notification functionality such as sending an email, SMS, push notification etc. Our integration store includes four channels: Email, SMS, Chat, and Push. These channels have multiple providers associated with them.Channel | Providers |
---|---|
MailGun, Mandrill, MailJet, Amazon SES, Sendgrid, Postmark, Netcore | |
SMS | Twilio, Amazon SNS, Plivo, SMS, SMSCentral, Kannel, Infobip, Termii |
Chat | Mattermost, Slack, Microsoft Teams, Discord |
Push | FCM, APNS, Expo |
Create A Workflow
A workflow is a blueprint for the notifications that will be sent. It holds the entire flow of messages sent to the subscriber. This is where all the different channels are tied together under a single entity. The workflow includes the following:- Workflow name and Identifier
- Channel-tailored content:
Channel | Content Style | Custom Variables{{handlebars}} format |
---|---|---|
HTML | ✅ | |
Visual Editor | ✅ | |
SMS | Text | ✅ |
Chat | Text | ✅ |
In-App | Text | ✅ |
Push | Text | ✅ |
Proper authorization needs to be set for the Chat channel for subscribers.
- Click Workflows on the left sidebar of your Novu dashboard.
- Click the Create Workflow button on the top right.

Use the create workflow button to create a workflow
- The name of the new workflow is currently Untitled, rename it to a more suitable title.

Rename the workflow to a more suitable title
- Select Email as the channel you want to add, by dragging it from the right sidebar.

Select Email as the channel you want to add, by dragging it from the right sidebar.
- Click on the Email in the workflow and edit it as per this image. Don’t forget to add the fields in the editor which is supposed to be updated with dynamic values that will be sent when calling the API.

Add the fields in the email editor
- Also, add the variables in the Variables section in the test tab and try testing it by sending the email to your email address using the Send Test Email button at the bottom right.

Add the variables in the Variables section in the test tab
Create A Subscriber
The recipients of a triggered notification are called subscribers. Click Subscribers on the left sidebar of the Novu dashboard to see all subscribers. By default, the dashboard will display a subscriber, as you were added automatically during sign-up.
By default, the dashboard will display a subscriber, as you were added automatically during sign-up.
abc@gmail.com
is a random unlikely email your users will have. To update this to an alternative email, you can call the updateSubscriber
method like so:
phone
, avatar
, and data
. The data
field can accept an object of metadata that you want to attach to the subscriber.
To make all of your app users subscribers, you need to programmatically add them to Novu.
Trigger A Notification
Copy and paste the following code into your app to trigger a notification:- The value of
name
should be the workflow’s trigger ID/slug.

Make sure your workflow's trigger ID/slug matches the value you'd used
- The value of
payload
is an array of the data that you want to be dynamically injected into the workflow content. - The value of
subscriberId
is the id of the subscriber on Novu. Replace7789
with your subscriber ID.
Topics
Novu provides a simple API that offers an easy interface for triggering notifications to multiple subscribers at once. This API is called Topics and allows users to manage their bulk notifications without having to implement complex loops. A topic is identified by a custom key and this key will be the identifier used when triggering notifications. You can assign a name to a topic for descriptive purposes. This name does not need to be unique and can be changed programmatically.The topic key should be unique and can’t be changed once chosen. Novu also safeguards for key uniqueness behind the scenes.
Create a Topic
Copy and paste the following code into your app to create a topic:- When creating a
key
, ensure it is unique and accurately identifies the topic. Document naming conventions and communicate them to team members to avoid confusion and ensure a smooth workflow. - The value of
name
should be a descriptive topic name.
Add and Remove Subscribers to a Topic
Copy and paste the following code into your app to add subscribers to a topic:Sending a notification to a Topic
Thanks to the topics feature, it is possible to trigger a notification to all subscribers assigned to a topic. This helps avoid listing all subscriber identifiers in theto
field of the notification trigger.
To trigger a notification to all subscribers of a topic, copy and paste the code below:
The value of the
name
key in the payload should be the name of the notification created earlier.