Quick Overview
This workflow exposes a webhook that fetches a random fun fact from uselessfacts.jsph.pl, uses Mistral Cloud to generate a self-contained HTML webpage themed around the fact, and returns the page directly as the webhook response, or a JSON error if something fails.
How it works
- Receives a request on a webhook endpoint.
- Calls the Useless Facts API to fetch a random English fun fact.
- Sends the fact, source, and source URL to Mistral Cloud to generate a complete standalone HTML page with inline styling.
- Returns the generated HTML as the webhook response with a text/html content type.
- If fetching the fact or generating the page fails, returns a 502 JSON error response instead.
Setup
- Add a Mistral Cloud credential for the Mistral chat model used to generate the HTML.
- Activate the workflow and copy the production webhook URL from the webhook trigger.
- Open the webhook URL in a browser (or call it from another app) to render the generated HTML page, and refresh to get a new fun-fact site each time.