Slack: support Block Kit blocks in editMessage

This commit is contained in:
Colin
2026-02-16 12:08:58 -05:00
committed by Peter Steinberger
parent c9684a2678
commit 08bc1dce6a
3 changed files with 62 additions and 7 deletions

View File

@@ -231,13 +231,18 @@ export async function handleSlackAction(
const messageId = readStringParam(params, "messageId", {
required: true,
});
const content = readStringParam(params, "content", {
required: true,
});
const content = readStringParam(params, "content", { allowEmpty: true });
const blocks = readSlackBlocksParam(params);
if (!content && !blocks) {
throw new Error("Slack editMessage requires content or blocks.");
}
if (writeOpts) {
await editSlackMessage(channelId, messageId, content, writeOpts);
await editSlackMessage(channelId, messageId, content ?? "", {
...writeOpts,
blocks,
});
} else {
await editSlackMessage(channelId, messageId, content);
await editSlackMessage(channelId, messageId, content ?? "", { blocks });
}
return jsonResult({ ok: true });
}