bolt-js icon indicating copy to clipboard operation
bolt-js copied to clipboard

Automatically invoke the InstallationStore's deleteInstallation function for relevant events

Open misscoded opened this issue 3 years ago • 11 comments

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.

misscoded avatar Nov 08 '21 20:11 misscoded

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

seratch avatar Nov 08 '21 21:11 seratch

👋 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.

github-actions[bot] avatar Dec 13 '21 00:12 github-actions[bot]

Excited for this change for the js sdk!

TroutZen avatar Feb 24 '22 06:02 TroutZen

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 avatar Jun 15 '22 09:06 ElMatella

@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

seratch avatar Jun 15 '22 09:06 seratch

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?

ElMatella avatar Jun 16 '22 21:06 ElMatella

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.

seratch avatar Jun 16 '22 21:06 seratch

Is this still active or will be active in the future?

hiroshinishio avatar Dec 26 '22 14:12 hiroshinishio

Hey, can I check if this is already implemented on bolt-js?

clementlemon02 avatar Aug 14 '23 14:08 clementlemon02

👋 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.

github-actions[bot] avatar Apr 22 '24 00:04 github-actions[bot]