0

I'm trying to handle the situation when my Slack app (built on top of BoltJS) is removed from a workspace, in order to remove its record from the database.

Here is the section that handles it:

app.event('app_uninstalled', async({team_id}) => {
    await db.removeTeam(team_id);
    await http.delete(`${constants.BASE_URL}?teamId=${team_id}`);
});

However, the team_id value that is supposed to come from Slack is undefined. I also checked the Slack docs and it seems I should be looking at the team_id parameter, which I do.

I would appreciate any help to see what I'm doing wrong :)

Farzan Badakhshan
  • 373
  • 1
  • 5
  • 19

1 Answers1

0

Ok, I found the solution. The team_id parameter should be accessed from the body object, therefore:

app.event('app_uninstalled', async({body}) => {
    await db.removeTeam(body.team_id);
    await http.delete(`${constants.BASE_URL}?teamId=${body.team_id}`);
});
Farzan Badakhshan
  • 373
  • 1
  • 5
  • 19