NatN
Windmill2y ago
1 reply
Nat

Get a image from an api

Hello, we download a image from an api. And we want to send this image in slack channel

The script below get our image, and another script send the image on slack. These two scripts are in a flow.
How to pass this image from a script to another script ? How we should process ? We tried to encode it in utf8 and then encore it in base64 to send it, but the image don't work. If we don't encode it in utf8, windmill throw an error saying it's bad unicode character for the database

const url = `https://creator.zoho.eu/api/v2.1/${account}/${application}/report/${report}/${recordId}/${field}/download`;

// REQUEST
const response = await fetch(url, {
  method: "GET",
  headers: { Authorization: "Zoho-oauthtoken " + token },
});

const blob = await response.blob();
const text = await blob.text();
const data = utf8.encode(text);

if (response.status >= 300) throw new Error(response.statusText);

return { success: true, data };
Was this page helpful?