Articles on: Custom Code & Design

🔧 Import JS code

Example link:

Importing your code allows you as developer to create your own Celestory block.

1.Create a ⬛ Run Javascript

This allows you to:

- create incoming trigger points

- create outgoing value points

2. Import your JS code

The editor of the block ⬛ Run Javascript contains a field to insert your JS code.

In this example of JS code using a ⛅ weather service:

const city = celestoryPoints.get('city', 'Paris');

const location = await fetch(${city});const
if (locationData && locationData0] && locationData[0].woeid) { const woeid = locationData[0].woeid; const weather = await fetch([${woeid}
if (weatherData && weatherData.consolidated_weather && weatherData.consolidated_weather.length > 0) { celestoryPoints.set('city', city); celestoryPoints.set('weather', weatherData.consolidated_weather0].weather_state_name); celestoryPoints.set('temperature', weatherData.consolidated_weather[0
return; }}
celestoryPoints.set('city', city);celestoryPoints.set('weather', 'NOT_FOUND');celestoryPoints.set('temperature', 'NOT_FOUND');

3. Connect your bloc

- the incoming trigger point "city" down at left can be linked to a text variable from a Text Input or a user choice. So if the value of this text variable corresponds to a city of the service, this one will be recognized and the corresponding values will be synchronized. This incoming point is not mandatory, and by default the city is assigned in the the code JS in Paris.

- the outgoing value points in the bottom right-hand corner "city", "weather", "temperature" allows you to go foreign service search targets information corresponding to the selected city to transform them into the value that it is then

possible to assign to a variable in the graph.\n\nTo send your datas to other services, see: Connect your data with 🔌 Zapier" class="csh-markdown csh-markdown-image">](<a href=;1mwvj81.png)\n\nTo send your datas to other services, see: Connect your data with 🔌 Zapier" loading="lazy"/> or [🔌 Integromat

Updated on: 29/03/2021

Was this article helpful?

Share your feedback


Thank you!