Rank 3: Container
rn its all in nextjs
Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 3: Container
rn its all in nextjs
Moderator
My suggestion is using functions. They're really easy to start with and basically you can trigger/call them from your app, so you could achieve what you're trying really easily, and even send an email or notification through it, if needed.
I don't have experience with JWT, so I can't give you too much guidance on that. Sorry for not being able to solve your main issue 🙏
Rank 3: Container
With functions you can easily get the user?
Rank 3: Container
and it can be called by a user
Moderator
Yeah
Rank 3: Container
hmm
Moderator
Yes, too
Rank 3: Container
That sounds pretty nice 🙂
Rank 3: Container
Cant find how to run them from the client in the docs
Rank 3: Container
copilot came up with this
Rank 3: Container
but I dont think it works
Moderator
It's
const promise = functions.createExecution('[FUNCTION_ID]');Moderator
Not function name
Rank 3: Container
Thanks
Moderator
If you want to send it payload (for example, in a form, the fields) that's how it should be:
It's
const promise = functions.createExecution('[FUNCTION_ID], [YOUR_PAYLOAD_HERE]');Moderator
By default, the server gets the current user who is executing the function, so you don't need to send anything related in the payload
Moderator
To get the user who triggered the user, you can get it this way:
const userID = req.variables.APPWRITE_FUNCTION_USER_ID;Rank 3: Container

Moderator
Congrats on deploying and triggering your first function 
Congrats!!
the best feeling tbh.
Moderator
Yeah, I got several errors first time I tried 😆
+1
Gonna close this thread for now, if you have more questions, feel free to open a new post and find us in #🚑│support ❤️ thanks @D5
[SOLVED] Get session jwt token