Skip to content

Commit 5740682

Browse files
Adding two sided completion messages
1 parent 020a511 commit 5740682

1 file changed

Lines changed: 35 additions & 18 deletions

File tree

src/coffeeChats/coffeeChatActions.ts

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -130,26 +130,43 @@ export function registerCoffeeChatActions(slackbot: App) {
130130

131131
await confirmMeetup(pairingId);
132132

133-
await respond({
134-
text: `Thanks for confirming! 🎉`,
135-
blocks: [
136-
{
137-
type: "section",
138-
text: {
139-
type: "mrkdwn",
140-
text: `✅ Awesome! Thanks for confirming your meetup. We hope you had a great time! 🎉`,
141-
},
133+
const confirmedBlocks = [
134+
{
135+
type: "section",
136+
text: {
137+
type: "mrkdwn",
138+
text: `✅ Awesome! Thanks for confirming your meetup. We hope you had a great time! 🎉`,
142139
},
143-
{
144-
type: "section",
145-
text: {
146-
type: "mrkdwn",
147-
text: `📸 Don't forget to share any photos from your meetup in the channel to celebrate!`,
148-
},
140+
},
141+
{
142+
type: "section",
143+
text: {
144+
type: "mrkdwn",
145+
text: `📸 Don't forget to share any photos from your meetup in the channel to celebrate!`,
149146
},
150-
],
151-
replace_original: false,
152-
});
147+
},
148+
];
149+
150+
// Update the original message for everyone in the DM using chat.update,
151+
// so both (or all) participants see the buttons replaced with the confirmation.
152+
const channelId = body.channel?.id;
153+
const messageTs = body.message?.ts;
154+
155+
if (channelId && messageTs) {
156+
await slackbot.client.chat.update({
157+
channel: channelId,
158+
ts: messageTs,
159+
text: `Thanks for confirming! 🎉`,
160+
blocks: confirmedBlocks,
161+
});
162+
} else {
163+
// Fallback: reply only to the person who clicked
164+
await respond({
165+
text: `Thanks for confirming! 🎉`,
166+
blocks: confirmedBlocks,
167+
replace_original: false,
168+
});
169+
}
153170
} catch (error) {
154171
await respond({
155172
text: `❌ Error confirming meetup: ${error}`,

0 commit comments

Comments
 (0)