Help

Re: Combining Vega-Lite with Airtable scripts

1907 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Katherine_McLai
4 - Data Explorer
4 - Data Explorer

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!

3 Replies 3

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

Katherine_McLai
4 - Data Explorer
4 - Data Explorer

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!

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.