bolt-js
bolt-js copied to clipboard
Automatically invoke the InstallationStore's deleteInstallation function for relevant events
Description
Currently, deleteInstallation
of a developer-provided InstallationStore
must be invoked manually. It would be more intuitive behavior to have it invoked automatically when the app_uninstalled
and token_revoked
events are received.
Aside from a couple of community members raising questions around this (#1201, #1112), it's my understanding that the Java and Python implementations already support this.
What type of issue is this? (place an x
in one of the [ ]
)
- [ ] bug
- [x] enhancement (feature request)
- [ ] question
- [ ] documentation related
- [ ] example code related
- [ ] testing related
- [ ] discussion
Requirements (place an x
in each of the [ ]
)
- [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
- [x] I've read and agree to the Code of Conduct.
- [x] I've searched for any related issues and avoided creating a duplicate issue.
FYI, we've already implemented this in bolt-python and bolt-java this way:
- https://github.com/slackapi/bolt-python/releases/tag/v1.5.0
- https://github.com/slackapi/bolt-python/pull/289
- https://github.com/slackapi/java-slack-sdk/releases/tag/v1.7.0
- https://github.com/slackapi/java-slack-sdk/pull/703
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.
Excited for this change for the js sdk!
Hey, thank you for this issue. I have a question until this gets implemented, how am I suppose to call deleteInstallation
manually?
Currently, I use the app_uninstalled
event like this:
app.event('app_uninstalled', async ({ event, logger, context }) => {
try {
await database.doc(context.enterpriseId || context.teamId).delete()
}
catch (error) {
logger.error(error);
}
});
I don't use my installationStore.deleteInstallation
at all.. And I'm not sur that the code I made supports enterprise correctly. Could you give me a hand on that one?
Thank you very much
@ElMatella I would suggest implementing the deleteInstallation method for easier migration when the built-in handlers are released. You can check the type definitions related to the method signature below:
- https://github.com/slackapi/node-slack-sdk/blob/%40slack/oauth%402.5.2/packages/oauth/src/installation-query.ts
- https://github.com/slackapi/node-slack-sdk/blob/%40slack/oauth%402.5.2/packages/oauth/src/installation-stores/interface.ts#L13-L14
Hey, thank you for your response.
So, I was just wondering, how can I access the isEnterpriseInstall
from the app_uninstalled
event?
In bolt, I should be able to access the context.enterpriseId
and context.teamId
from the app_uninstalled
event handler. Does the fact that context.enterpriseId
is not null means that isEnterpriseInstall
is true?
If your app is removed from the entire enterprise grid organization, the event payload should have only enterprise_id. If the app is removed only from a specific workspace under an enterprise grid org, the payload should have both enterprise_id and team_id.
Is this still active or will be active in the future?
Hey, can I check if this is already implemented on bolt-js?
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.