The prompt I sent ChatGPT in 2025
The 1st attempt at the prompt, don't use this:
Don't use this one, it had mistakes on purpose to demonstrate. While AI gave a perfect result this time, it might not for you. I give a better prompt with the mistakes removed for you to use as your starting point later.
ITIQPro Reporting let's me write scripts to access data.
They give me this example:
const catsURL = "https://cat-fact.herokuapp.com/facts";
let cacheData;
return {
readRow: async(index) => {
if (index === 0) {
const request = await fetch(catsURL);
const jsonData = await request.json();
cacheData = jsonData.map((row) => {{ Column1: row.text, Column2: row.type]{{;
}
if (index > cacheData.length) return false;
return cacheData[index];
}
};
I'd like to call open-meteo to get the current temperature and wind speed, How would I do that following the pattern above?Now I want you to notice, I was copying from a screen shot and did some sloppy typing, admittedly on purpose for testing reasons. There are SEVERAL syntax errors above.
Note that it:
a) figured out it was JavaScript
b) FIXED my syntax errors in the output
c) Made some good guesses as to what I REALLY wanted
Oh ... and the code it created works.
The results (it works) I got back
Sure, I can help you with that! Here's how you can modify the script to call the Open-Meteo API to get the current temperature and wind speed:
javascript
const weatherURL = "https://api.open-meteo.com/v1/forecast?latitude=51.05&longitude=-114.07¤t_weather=true";
let cacheData;
return {
readRow: async(index) => {
if (index === 0) {
const request = await fetch(weatherURL);
const jsonData = await request.json();
const weatherData = jsonData.current_weather;
cacheData = [{ Column1: weatherData.temperature, Column2: weatherData.windspeed }];
}
if (index >= cacheData.length) return false;
return cacheData[index];
}
};
In this script:
- The `weatherURL` is set to the Open-Meteo API endpoint with latitude and longitude for Rocky View County, Alberta.
- The `readRow` function fetches the weather data when `index` is 0.
- The `cacheData` array stores the temperature and wind speed from the API response.
- The function returns the cached data for the given index.
Feel free to adjust the latitude and longitude values to match your specific location. Let me know if you need any more help!Note also that my computer was set to Rocky View County, Alberta. I'm actually not sure where it got that info from, but it was correct. But it might not have been, so my better example explicitly passes that info to the AI
After getting this, if you don't understand it, AI is good at explaining the code. You could ask it to explain the sample code (but probably more useful to have it explain the corrected code below - unless you want to see how to use AI to debug scripts), or you could ask it to explain the code it created.
A better attempt for you to use, errors corrected in the sample
ITIQPro Reporting let's me write scripts in JavaScript to access data.
They give me this example:
const catsURL = "https://catfact.ninja/facts";
let cacheData;
return {
readRow: async (index) => {
if (index === 0) {
const request = await fetch(catsURL);
const jsonData = await request.json();
const factsArray = Array.isArray(jsonData.data) ? jsonData.data : [];
cacheData = factsArray.map((row) => ({ Column1: row.fact, Column2: row.length }));
}
if (!cacheData || index >= cacheData.length) return false;
return cacheData[index];
}
};
I'd like to call open-meteo.com to get the current temperature and wind speed. I'm located in Rocky View County Alberta, Canada. How would I do that following the pattern above?Summary
I took an example about cat facts api. Passed AI a badly written, broken script.
Asked AI to give me the open-meteo equivalent.
AI;
- figured out what I REALLY wanted
- figured out what I needed
- found and threw in my location to get the best weather report.
But it might not always work with a bad prompt, so I then gave you a better prompt to start with for your own needs.
fwiw, the temp was -14.9C with a wind speed of 21.1km/hr right now.
const weatherURL = "https://api.open-meteo.com/v1/forecast?latitude=51.05&longitude=-114.07&hourly=temperature_2m,wind_speed_10m&daily=temperature_2m_max,temperature_2m_min,wind_speed_10m_max&timezone=auto";
let cacheData;
return {
readRow: async(index) => {
if (index === 0) {
const request = await fetch(weatherURL);
const jsonData = await request.json();
const hourlyData = jsonData.hourly;
const dailyData = jsonData.daily;
cacheData = [];
// Gather next 12 hours of data
for (let i = 0; i < 12; i++) {
cacheData.push({
Column1: `Hour ${i + 1}`,
Column2: `Temp: ${hourlyData.temperature_2m[i]}°C, Wind: ${hourlyData.wind_speed_10m[i]} km/h`
});
}
// Gather next 7 days of data
for (let i = 0; i < 7; i++) {
cacheData.push({
Column1: `Day ${i + 1}`,
Column2: `Max Temp: ${dailyData.temperature_2m_max[i]}°C, Min Temp: ${dailyData.temperature_2m_min[i]}°C, Max Wind: ${dailyData.wind_speed_10m_max[i]} km/h`
});
}
}
if (index >= cacheData.length) return false;
return cacheData[index];
}
};