Jan 04, 2022 05:00 AM
Hi! Here is the general idea of the process that I am trying to implement in Airtable:
(1) a participant completes a survey and their results are entered into Airtable
(2) the results from that participant are automatically plotted using Vega-Lite
(3) the Vega-Lite plot is then automatically sent to the participant via email
Setting up the survey in (1) is clear to me.
For (2), I was thinking that this could somehow be implemented using AirTable scripts. I know that it is possible using AirTable automations to have the creation of a new record trigger a script to run. However, is it possible to have a script create a Vega-Lite plot using the data from the single record that was just created?
My idea for (3) was to generate a url for the Vega-Lite plot, update the record in AirTable with the url in a column and then use AirTable automations to send an email including the url. The only parts of this process that I am uncertain about is whether it is possible to:
-generate a url for a Vega-Lite plot using AirTable scripts?
-update the Airtable record with the url generated by the script?
Thanks in advance!
Jan 04, 2022 10:01 AM
hi @Katherine_McLain,
You are on the right track. I think the best approach would be to trigger an Airtable script to run through the automations. In the script you could use the await fetch() function to call the Vega-Lite api. Then wait for the API’s response and update the Airtable record with the url in the response. You could then send the email in the same automation through the Airtable Email action or set up a different automation to send the email from the record you updated.
Hope this helps!
Alessio
Website: alessiomonino.com
Email: alessio.monino@gmail.com
Jan 04, 2022 11:57 PM
Hi @Alessio_Monino,
Thanks for your response! How exactly would the script generate a url? Would the url just contain the Vega-Lite image or would it be for the entire base?
Thanks again!
Jan 05, 2022 02:09 AM
hi @Katherine_McLain,
I have just checked the API documentation briefly but yes, from my understanding you could send an API request to receive a url that you could then use to update your record.