Fetch Content from an external system
What you'll build
A Surface component workflow that fetches from an external API and displays the returned data.
1. Prerequisites
- You will need a Component Workflow in a Surface
2. Add a component
const : = async () => {
const = await ("https://meowfacts.herokuapp.com");
const { } = (await .()) as { ?: string[] };
const = ?.[0] ?? '';
return {
: {
: [
{
: "html",
: `<blockquote class="external-quote">"${}"</blockquote>`,
},
],
},
};
};
export default ;Result
The API response will be appended at the end of the HTML output.