Hello there community,
So, inspired by this post from @jg80 I went ahead and tried adding charts to emails sent from a retool workflow. This turned out to be incredibly simple so sharing my learnings here for whoever may need it in the future.
Create API key
- Go to https://chart-studio.plotly.com and create an account and an API key. Save your user name as you will need it for creating the resource
Create a Resource in Retool
- Base Url: https://api.plotly.com/v2/images
- Headers:
-- Content-Type: application/json
-- Plotly-Client-Platform: Lisp - Authentication: Basic Auth
-- Add the userName and password
That's it, you can now start making POST requests to get PNG files for generated charts.
I actually implemented this with an AI block that is generating the body for me based on raw data that is passed to the block, see below example:
After this, I now have the public url I can use to embed the chart in an email using HTML.
Hope this helps, happy building!