/installed lifecycle in ACE

tl;dr: Is it safe to use post route to /installed in add-on based on atlassian-connect-express?

What i’m trying to achieve: i want a place where i can setup default configuration for client that installed add-on, i need different entries in db for different clients, so /installed looks like a place to go as well as /uninstalled, to clear db entries for that client.
The question is: is /installed a good place to do what i want and if not how can i achieve what i want? And also is it even safe to use /installed route since ACE handles it automatically, wouldn’t my definition of route override ACE’s?
If i try using /installed route and then delete this route and try to reinstall add-on for client that already has clientInfo saved in AddonSettings it fails with jwt authentication, so it seems like i’m overriding what ACE would usually do, but i’m not sure if i understand that right

Hi @alexter_pr,

it doesn’t look like this is documented at all, but atlassian-connect-express emits an event on successful installation: host_settings_saved. See lib/index.js.

2 Likes

Ye, that works for now, thanks @epehrson!
But if anyone knows better approach leave a comment :slight_smile:

For anyone who might use this, if you’re going to hit any Jira endpoints inside this event be ready for error, since sometimes add-on won’t have much time to end installation and your request will fail because of that. So you might want to consider creating some kind of retry if you really need to hit endpoint inside this event