+
${page.title}
+
${page.message}
+
You can close this tab and return to Slack.
+
+
+`;
+ return new Response(html, {
+ status: page.status,
+ headers: { "Content-Type": "text/html; charset=utf-8" },
+ });
+}
+
+function extractSlackText(text: string, files?: FileUpload[]): string {
+ const message = buildSlackOutputMessage(text, files);
+ if (
+ typeof message === "object" &&
+ message !== null &&
+ "markdown" in message &&
+ typeof message.markdown === "string"
+ ) {
+ return message.markdown;
+ }
+ if (
+ typeof message === "object" &&
+ message !== null &&
+ "raw" in message &&
+ typeof message.raw === "string"
+ ) {
+ return message.raw;
+ }
+ return text;
+}
+
+async function normalizeFileUploads(
+ files: FileUpload[],
+): Promise