Back

How to get notified when user add data to appwrite database

  • 1
  • Databases
  • Web
bharath
17 Apr, 2023, 07:46

In my web app when user upload some files I should get notified. How can I do that ??????

TL;DR
User wants to know how to get notified when a user adds data to the Appwrite database. One solution suggested is to use the function feature of Appwrite. Another solution is to use the realtime event feature. The user is also directed to read the documentation on storage events and functions in Appwrite.
darShan
17 Apr, 2023, 08:01

You can trigger Function attached to a specific event. Here the event could be: buckets.[1].create where [1] is your bucket name.

In the function's body, you can send an email or a push notification to your device.

joeyouss
17 Apr, 2023, 15:00

Hi, you will need to create a function as mentioned in the above message but there are more ways to do this - for example getting URL of file and then triggering function (which I assume is what your app might be doing)?

push notifications example:https://github.com/open-runtimes/examples/tree/main/dart/send_push_notification

Take a look here for messaging API : https://github.com/appwrite/appwrite/issues/4968

bharath
17 Apr, 2023, 15:53

@Mosh Ontong and @Binyamin could you guys help me how to do that

bharath
17 Apr, 2023, 15:58

Thank you but I couldn't understand that

Binyamin
17 Apr, 2023, 16:01

First You'll need to do as @darShan and add event trigger to your function by bucket For that you can read:

Storage events - https://appwrite.io/docs/events#storage-events Function - https://appwrite.io/docs/functions

After that you can use @joeyouss example to send a push notification when your function is being triggered

Mosh Ontong
17 Apr, 2023, 16:04

It depends on the scenario I guess, you can utilize the functions or the realtime event. But if the needed is something like push notification, you can use the function feature of appwrite then. Or else if the needed is when the user is uploaded files and you need to notify your application to update the UI, then you can use the realtime

bharath
17 Apr, 2023, 23:21

the user doesnt need to get notified , It should notify me

bharath
18 Apr, 2023, 02:04

Can you provide the gist

bharath
18 Apr, 2023, 13:55

@Mosh Ontong please help me

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