type Slack = {
token: string;
};
type Base64 = string
export async function main(
slack: Slack,
channel: string,
screenshot: Base64,
app_path: string,
kind: 'pdf' | 'png',
) {
const formData = new FormData();
formData.append("token", slack.token);
formData.append("file", new Blob([Buffer.from(screenshot, "base64")], {
type: kind === "pdf" ? "application/pdf" : "image/png"
}), "report." + kind);
formData.append("channels", channel);
const fullAppPath = Bun.env["WM_BASE_URL"] + '/apps/get/' + app_path + '?workspace=' + Bun.env["WM_WORKSPACE"]
formData.append("initial_comment", "App report of " + " <" + fullAppPath + "|" + app_path + ">");
return await (
await fetch("https://slack.com/api/files.upload", {
method: "POST",
body: formData,
})
).json();
}
Submitted by hugo697 84 days ago
type Slack = {
token: string;
};
type Base64 = string
export async function main(
slack: Slack,
channel: string,
screenshot: Base64,
app_path: string,
kind: 'pdf' | 'png',
) {
const formData = new FormData();
formData.append("token", slack.token);
formData.append("file", new Blob([Buffer.from(screenshot, "base64")], {
type: kind === "pdf" ? "application/pdf" : "image/png"
}), "report." + kind);
formData.append("channels", channel);
const fullAppPath = Bun.env["WM_BASE_URL"] + '/apps/get/' + app_path + '?workspace=' + Bun.env["WM_WORKSPACE"]
formData.append("initial_comment", "App report of " + " <" + fullAppPath + "|" + app_path + ">");
return await (
await fetch("https://slack.com/api/files.upload", {
method: "POST",
body: formData,
})
).json();
}
Submitted by hugo697 275 days ago
type Slack = {
token: string;
};
export async function main(
slack: Slack,
channel: string,
pdf: string,
app_path: string
) {
const formData = new FormData();
formData.append("token", slack.token);
formData.append("file", new Blob([Buffer.from(pdf, "base64")]), "report.pdf");
formData.append("channels", channel);
formData.append("initial_comment", "App report of " + app_path);
return await (
await fetch("https://slack.com/api/files.upload", {
method: "POST",
body: formData,
})
).json();
}
Submitted by hugo697 275 days ago
type Slack = {
token: string;
};
type Base64 = string
export async function main(
slack: Slack,
channel: string,
screenshot: Base64,
app_path: string,
kind: 'pdf' | 'png',
) {
const formData = new FormData();
formData.append("token", slack.token);
formData.append("file", new Blob([Buffer.from(screenshot, "base64")], {
type: kind === "pdf" ? "application/pdf" : "image/png"
}), "report." + kind);
formData.append("channels", channel);
const fullAppPath = Bun.env["WM_BASE_URL"] + '/apps/get/' + app_path + '?workspace=' + Bun.env["WM_WORKSPACE"]
formData.append("initial_comment", "App report of " + " <" + fullAppPath + "|" + app_path + ">");
return await (
await fetch("https://slack.com/api/files.upload", {
method: "POST",
body: formData,
})
).json();
}
Submitted by hugo697 368 days ago
type Slack = {
token: string;
};
export async function main(
slack: Slack,
channel: string,
pdf: string,
app_path: string
) {
const formData = new FormData();
formData.append("token", slack.token);
formData.append("file", new Blob([Buffer.from(pdf, "base64")]), "report.pdf");
formData.append("channels", channel);
formData.append("initial_comment", "App report of " + app_path);
return await (
await fetch("https://slack.com/api/files.upload", {
method: "POST",
body: formData,
})
).json();
}
Submitted by hugo697 373 days ago