# Can we create actions based on data of project?

**URL:** <https://community.auth0.com/t/can-we-create-actions-based-on-data-of-project/108933>\
**Category:** Get Help\
**Tags:** identifier-first, login-experience\
**Created:** [June 9, 2023, 5:59am UTC](https://community.auth0.com/t/can-we-create-actions-based-on-data-of-project/108933 "2023-06-09T05:59:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmdanish](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mmdanish/32/47292_2.png) [@mmdanish](https://community.auth0.com/u/mmdanish)\
**Post date:** [June 9, 2023, 5:59am UTC](https://community.auth0.com/t/can-we-create-actions-based-on-data-of-project/108933/1 "2023-06-09T05:59:56Z")

</div>

Is any possibility to create an action based on project data comming from database. bcz i am trying to assign user\_metadata to the logged in user based on his/her record present in the database i.e i want to assign the id to the loggedin user as his/herid on database .  
Thanks

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [June 9, 2023, 4:27pm UTC](https://community.auth0.com/t/can-we-create-actions-based-on-data-of-project/108933/2 "2023-06-09T16:27:57Z")

</div>

Hey there @mmdanish !

You should be able to call your own API from an action to get/set the metadata - The following may help:

> [@How do I call my API from an Action?](https://community.auth0.com/t/how-do-i-call-my-api-from-an-action/69041):
>
> Hey, So I’m in the process of trying to add a user to my database using an API call from a “Post User Registration” Action. I have followed this blog post here: and seem to have everything looking good. On top of that when I run the test it says the action was successful. The only problem is that my API is not being called at all even though I have triple checked that the URL is correct. Here is the code I’m working with: import axios from "axios"; exports.onExecutePostUserRegistration = …

---

<div class="post-metadata">

**Author:** ![mmdanish](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mmdanish/32/47292_2.png) [@mmdanish](https://community.auth0.com/u/mmdanish)\
**Post date:** [June 12, 2023, 5:36am UTC](https://community.auth0.com/t/can-we-create-actions-based-on-data-of-project/108933/4 "2023-06-12T05:36:37Z")

</div>

Hey! thanks for providing this , but i am not getting the complete road map i want to call this from actions bcz i need long term support ,as Auth0 is depricationg the rules and hook in 2024 . is any helping material there from where i can get it all .  
Thanks

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [June 24, 2023, 12:13am UTC](https://community.auth0.com/t/can-we-create-actions-based-on-data-of-project/108933/5 "2023-06-24T00:13:40Z")

</div>

Hey @mmdanish I apologize for the delayed response here.

I’m not sure I understand your question - There are a couple examples of what it might look to call an external API from an Action in the thread I shared. It’s more or less the same idea as calling an API from within a rule. The basics are:

- Make sure your API is [registered in Auth0](https://auth0.com/docs/get-started/auth0-overview/set-up-apis).
- Create a m2m app in Auth0 authorized to call your API.
- Use these credentials to get an access token in the Action.
- Use a library such as [axios](https://github.com/axios/axios) to interact with your API.
- Assign `user_metadata` using the Actions [API object](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/api-object) - `api.user.setUserMetadata(name, value) `

Hope this helps!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [July 8, 2023, 12:14am UTC](https://community.auth0.com/t/can-we-create-actions-based-on-data-of-project/108933/6 "2023-07-08T00:14:32Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
