Skip to content
Back

Users.*.create event not triggerring as expected

  • 0
  • Functions
  • Flutter
Prateek Jain
28 Apr, 2023, 08:33

I have a cloud function which should create a new user document as soon as user otp validation completes successfully. But when i create user from appwrite cloud , it seems to add that document and when i add a user from my app , the event doesnt trigger. Problem 1 = Function not executed as event not triggering Problem 2 = How to create a document only when user validates/verifies otp successfully.

TL;DR
Users are experiencing two problems: 1. The users.*.create event is not triggering as expected when adding a user from their own app. 2. They want to know how to create a document only when a user successfully validates/verifies their OTP. Solution: - To fix problem 1, they should use the users.*.verification.*update event to trigger the function when OTP validation completes successfully. - To solve problem 2, they can enable an option in the settings/cli or trigger the function on session creation, ensuring that it only executes once for each user.
anyuru
28 Apr, 2023, 09:17

Use users.*.verification.*update to trigger the function when the as soon as the user otp validation successfully completes. It's the last part in this section of the documentation https://appwrite.io/docs/events

Prateek Jain
28 Apr, 2023, 09:20

there is no users.*.verification.*update option in appwrite cloud

joeyouss
28 Apr, 2023, 11:47

Hi - are you using the private cloud beta? just to confirm

Prateek Jain
28 Apr, 2023, 13:23

yes

Drake
28 Apr, 2023, 17:29

How to create a document only when user validates/verifies otp successfully

Would you please clarify what you're looking for? Do you want the function to execute on https://appwrite.io/docs/client/account?sdk=web-default#accountUpdatePhoneSession or https://appwrite.io/docs/client/account?sdk=web-default#accountUpdatePhoneVerification?

Prateek Jain
6 May, 2023, 08:26

update phone verification

Prateek Jain
6 May, 2023, 08:27

basically i need to create an user document when the user successfully logs in first time in our application

Prateek Jain
6 May, 2023, 08:28

it should not trigger for sessions as it will be many times for a particular user.

Prateek Jain
6 May, 2023, 08:30

@Steven can u please let me know what is the best way to this simple step.

Drake
6 May, 2023, 14:14

I suggest triggering on session creation but you can do some logic to make sure the rest of your function only executes once for the user

Prateek Jain
6 May, 2023, 14:38

ok sir.. but this should be fixed as that would be regular requirement for all. Or basically we can provide (enable) a simple option in settings/cli to create a user document in a user named collection whenever a user is done verified in auth user.

Prateek Jain
6 May, 2023, 14:40

Thanks btw for saving my time again

Drake
6 May, 2023, 14:47

Happy to help!

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