Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/bottender/src/slack/SlackConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ export default class SlackConnector

// For slack modal
if (rawEvent.view && rawEvent.view.privateMetadata) {
return JSON.parse(rawEvent.view.privateMetadata).channelId;
const channelId = JSON.parse(rawEvent.view.privateMetadata).channelId;
if (channelId) {
return channelId;
}
}

// For reaction_added format
Expand Down
2 changes: 1 addition & 1 deletion packages/bottender/src/slack/SlackContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export default class SlackContext extends Context<
...options.view,
privateMetadata: JSON.stringify({
original: options.view.privateMetadata,
channelId: (this._event.rawEvent as UIEvent).channel.id,
channelId: (this._event.rawEvent as UIEvent).channel?.id,
}),
},
});
Expand Down
2 changes: 1 addition & 1 deletion packages/bottender/src/slack/SlackTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export type UIEvent = {
id: string;
domain: string;
};
channel: {
channel?: {
id: string;
name: string;
};
Expand Down
Loading