Introduction
In this article, we'll explore how to set up an Angular application with a NestJS backend. Then, we'll use Notifizz and its event driven campaign to send personalized notifications inside an in-app notification center
You can find the code used for this tutorial here: Tagada85/angular-nestjs-in-app-notifications
Setting up Angular and NestJS
First, let's install NestJS and Angular CLI if not already done
npm i -g @nestjs/cli @angular/cliLet's create our folder:
mkdir in-app-notif-angular-nest
cd in-app-notif-angular-nestThen create our NestJS backend with nest new backend. Answer the questions for the setup and run ng new frontend next. Again, answer the questions (the answers don't matter for our tutorial).
Now we can run cd backend && npm run start:dev and cd frontend && npm start -- --port 4210 to start our backend and our frontend.
And in our browser, we have our Angular app running!

After that, I've asked Claude to add some simple functionalities: an invoice creation form, a couple of customers, and their own client spaces. If you want the code, don't hesitate to check out the github repo!
Adding a simple form and users
For our tutorial purpose, we will have a form that creates an invoice. I've created a couple of users in my app that will serve as customers.
This form will be the starting point for launching our in-app notifications.
Signing up for Notifizz
For our notification center, we will use Notifizz. We can create an account for free here
We'll create our first campaign: New invoice.
In the workflow, we'll create a new event that we'll call invoice.created. We'll choose an in-app notification to be sent. Finally, we'll define the recipient as "Customer". This helps the dev team and AI helpers to know who should receive these notifications.
Once the campaign step is done, we can "Implement" and start setting up our code.
At this point, Notifizz gives us the tasks we need to do in order to complete our setup and launch this campaign. Let's tackle them!
Putting it all together.
Configuring our Notification Center
In Settings -> Channels -> Notification Center, we'll go into Authentication.
Here we can choose how we verify our users to make sure that each user gets only their notifications. For this tutorial, we'll choose the backend signed-token mode. Basically, our backend signs a token for each user, our frontend hands it to the notification center, and Notifizz checks it to make sure the right user gets the right notifications in their interface.
Then, we provide the path under which our users are identified. In our case, it will be clientId. This is used in the implementation section to send notifications to the right user.
Adding Notifizz to the front-end
In Settings -> Channels -> Notification Center -> Install, we have the code needed to add the notification center.
From your frontend folder, run:
npm install @notifizz/angularIn the client-space-page.ts, we'll import our component:
import { NotifizzAngularComponent } from '@notifizz/angular';
// Add it to the imports of the @Component
@Component({
selector: 'app-client-space-page',
imports: [CurrencyPipe, DatePipe, NotifizzAngularComponent],
templateUrl: './client-space-page.html'
})Then, in the html template, let's add the notifizz-bell. You can retrieve your sandbox API key from Settings -> Environments -> Sandbox -> Copy the Front API key.
We create a function in the client-space-page.ts to setup our options.
The token is our backend signed token, we'll talk about it later.
protected readonly bellOptions = computed<NotifizzOptions | null>(() => {
const session = this.session();
if (!session) return null;
return {
apiKey: environment.notifizzFrontApiKey,
authType: 'backendToken',
userId: session.client.id,
userEmail: session.client.email,
token: session.notifizzToken,
notificationCenterStyles: { marginTop: '20px' }
};
});In the html template:
<header class="topbar">
<a class="brand" href="/">Acme Invoicing</a>
@if (client(); as me) {
<span class="account">
<span>{{ me.name }} <span class="muted">· {{ me.company }}</span></span>
<!-- The bell reads its options once, when it mounts: it only mounts once the session gave the token. -->
@if (bellOptions(); as options) {
<notifizz-bell [options]="options"></notifizz-bell>
}
</span>
}
</header>And that's all you need on the front-end !
Adding Notifizz to the back-end
From your backend folder, run:
npm install @notifizz/nodejsWe'll create a notifizz.module.ts that we will use to inject the NotifizzClient in the backend. It takes two keys: an authSecretKey to verify users identity and an sdkSecretKey. Both of them are found in the Settings -> Environments.
@Module({
providers: [
{
provide: NotifizzClient,
useFactory: () => {
const { authSecretKey, sdkSecretKey } = notifizzKeys();
return new NotifizzClient(authSecretKey, sdkSecretKey);
},
},
],
exports: [NotifizzClient],
})
export class NotifizzModule {}Then we'll add the token signature function in the backend. Because we chose the mode "Backend-signed token", we are responsible for providing a signed token of our user id to prove who he is.
Simply put, we retrieve the signed token from our backend, and pass it to the notification center in our frontend.
For our demo purposes, we have our client info from the request. Obviously, in your application, you would use your own authentication service.
But the idea is simple, take your id, use the generateHashedToken from the Notifizz SDK to sign it and return it. Done!
// Demo only: anyone can open a client's space by sending their id.
// A real app takes the client from its own authentication, never from the request.
open(clientId: string): Session {
const client = this.clients.findById(clientId);
if (!client) throw new NotFoundException('Unknown client');
return { client, notifizzToken: this.notifizz.generateHashedToken(client.id) };
}Perfect! Now we have our setup completed and if we go to our app's client pages, we can see the notification center and we can open it!

Adding the event
When we set up our campaign, we defined an event to trigger it. Now is time to implement it to our code. In the Notifizz's orchestrator, the AI agent is asking you questions about how you wish to implement it. We're doing something simple for this tutorial so we'll go down the route of: everything is available in the original event's payload.
Once I've answered the AI's questions, the agent gives me a prompt if I wish to send it to my AI friend. In the end, code looks something like this:
// in invoices.service.ts
// inside the create function that creates a new invoice
this.notifizz
.track(
'invoice.created',
{
clientId: client.id,
clientName: client.name,
invoiceId: invoice.id,
invoiceNumber: invoice.number,
invoiceAmount: invoice.amountInCents / 100,
invoiceCurrency: invoice.currency,
dueDate: invoice.dueDate,
},
)
.catch((error: unknown) =>
this.logger.error(`invoice.created not sent for ${invoice.number}: ${String(error)}`),
);And that's it! That's all we need.
Triggering an event
Now, in my application, I will create an invoice to trigger the event.

Once that's done, I can see in Notifizz that the setup worked. In the SDK and Notification Center settings, I can see that Notifizz correctly detected that the sandbox environment triggered an event and installed the notification center. Awesome!


Now I can go back to our campaign, which is still in its implementation status. We have done all the tasks necessary to move forward and our developer job is done. The campaign can now be sent to "Review", the last step before sending it live.
Sending notifications
Let's send an invoice to our customer Bob Durand for 1250$

If I go to Bob's client space, I can now see that he has a new notification.

And that this notification has the information I provided.

If I click on the Pay now button, I correctly go to the little page I added where I have the invoice's information.

In Notifizz, the workflow's campaign recent executions show me the last runs that we did. And it correctly tracked that Bob clicked on the button, and therefore, because we chose to track the "Click" event in the objectives of this campaign, Notifizz considers that this campaign is a success for Bob. We could have tracked another event for this campaign's objective (say invoice.paid for example), no limits here.

Amazing!
Let's send a couple of invoices to the other customer, Alice, to make sure she gets them as well.
I have created two invoices for her. And we correctly have the two notifications in the notification center!


Now, you're up and running to implement a simple notification center in your application with Notifizz! All that's left for us to do is go Live with this campaign and replace our sandbox API keys with our production API keys.
Conclusion
In this tutorial, we made a little application that implemented Notifizz as a notification center. Upon triggering an invoice creation, we added an event listened by Notifizz which sends in-app notifications to the appropriate customers.
Next time, we will explore more possibilities with Notifizz. Stay tuned!

