Back

Deploy In-App notification system NextJS & Appwrite

  • 0
  • Self Hosted
  • Web
  • Realtime
D5
25 Jul, 2023, 17:07

Yes, but I recommend handling that with a funcion anyways

TL;DR
The user wants to know if there is a way to translate notifications in NextJS & Appwrite. A solution is mentioned that it is not currently possible but it is on the roadmap. The user also asks about adding the Novu library to the Appwrite function and setting the API key. There is confusion about the API key and it is suggested to set it for cloud usage. The user then shares their Novu code for NextJS and asks for help with an error in the console. A solution is mentioned that FCM tokens can be omitted and a link to an example using Firebase for notifications is shared. The user asks for a tutorial
loup
25 Jul, 2023, 17:42

do u know a tutorial or an example for that with appwrite ? Because ive no idea how to make communicate firebase and appwrite especially to target specific user for specific notification

D5
25 Jul, 2023, 18:04

Here you have an example: https://github.com/open-runtimes/examples/tree/main/dart/send_push_notification Just send a request to firebase to send the notification. No needed integrating anything with Appwrite

loup
25 Jul, 2023, 18:33

But if for example in the user setting there a notification panel where user can disable in-app notification, we have to make communicate user pref (in appwrite) with firebase right ?

D5
25 Jul, 2023, 18:53

You can ommit fcm tokens

loup
27 Jul, 2023, 14:53

@Guille im trying novu with nextjs and novu in cloud, but I got this error in console in my NextJS app :

loup
27 Jul, 2023, 14:53

My novu.tsx look like :

TypeScript
import { NovuProvider, PopoverNotificationCenter, NotificationBell } from "@novu/notification-center"

export default function Novu( { userId } : { userId: string }) {
    console.log(userId)
    return (
        <NovuProvider subscriberId={userId} applicationIdentifier={'on-boarding-notification'}>
            <PopoverNotificationCenter colorScheme={'dark'}>
                {({ unseenCount }) => <NotificationBell unseenCount={unseenCount} />}
            </PopoverNotificationCenter>
        </NovuProvider>
    )
}
loup
27 Jul, 2023, 14:55

that weird everything look correct

Guille
27 Jul, 2023, 14:57

did you set API key?

loup
27 Jul, 2023, 14:59

mhh my mistake is because I have to push to production (in Novu). And in NextJS i dont need API KEY right ?

loup
27 Jul, 2023, 14:59

because im gonna trigger notification from appwrite function

Guille
27 Jul, 2023, 15:03

If you are using cloud, you should set your api key

loup
27 Jul, 2023, 15:03

its working without :/

loup
27 Jul, 2023, 15:03

api key is only for the trigger right ?

Guille
27 Jul, 2023, 15:05

I'm not sure, but if it's working you shouldn't be worried

loup
27 Jul, 2023, 15:06

btw how do u add novu inside Appwrite function (NodeJS) ? just with that ?

TypeScript
import { Novu } from '@novu/node'; 
const novu = new Novu(req.variables['APPWRITE_FUNCTION_NOVU_API_KEY']);
loup
27 Jul, 2023, 15:17

well i guess not

loup
27 Jul, 2023, 15:17

ive try require but not working too

loup
27 Jul, 2023, 15:27

well I guess we have to install @novu/node inside Appwrite instance

loup
27 Jul, 2023, 15:42

Im dumb just have to add inside package.son (from the appwrite function) : "@novu/node": "^0.17.1"

Guille
27 Jul, 2023, 18:14

Yes, you have to add your dependencies in your clud function

loup
27 Jul, 2023, 18:17

that work so well

loup
27 Jul, 2023, 18:17

now I have to understand how make a custom notification center

loup
27 Jul, 2023, 18:19

Do u know if there is a way to translate notification ? The only way for me is to give inside payload the entire text directly and have no text directly in novu workflows

Guille
27 Jul, 2023, 19:37

What I have read, there is not way to translate notifications currently, but there is already in the roadmap

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more