Help with API command

Hello. Can someone help me making a command so Nightbot can post the number of people in space right now? I have this link – – but I did not manage to make it work… I also wanted Nightbot to post the current speed and altitude of ISS but I could not find any links for it… if anyone could help me…


What you can make a command for is limited to what Open Notify has written in their API documentation. If the documentation does not contain information about the speed and altitude of the ISS, then no such Nightbot command to track that information is possible.

The following command response will output the current number of astronauts in space:

$(eval try{a=JSON.parse(`$(urlfetch json`);`There are ${a.number} people in space right now.`;}catch(e){`Data fetch error!`;})
1 Like

Do you think it’s possible to add the names of the astronauts like that link shows? The bad part is, it has to fit in 200 caracthers for YouTube…

This command response prints the number of astronauts and their names:

$(eval r=`$(urlfetch json`;$(urlfetch
1 Like

Thank you very much! Another question… do you think it’s possible for Nightbot to post only the current ISS speed and altitude? From this link ->

Satellite info endpoint:

The response below posts the ISS velocity and altitude in kilometers/hr

$(eval try{a=JSON.parse(`$(urlfetch json`);b=a.units;`ISS velocity: ${a.velocity} ${b}/hr | Altitude: ${a.altitude} ${b}`;}catch(e){`Err`;})

Response in miles/hr

$(eval try{a=JSON.parse(`$(urlfetch json`);b=a.units;`ISS velocity: ${a.velocity} ${b}/hr | Altitude: ${a.altitude} ${b}`;}catch(e){`Err`;})
1 Like

Thank you!!! You’re the best!!!

Roketto, hi again…so we found this page - – that shows the Voyager 1 and 2 distance from the sun. Do you think it is possibe for Nightbot to pull the info from there? The lines we need to use from that page is “let dist_1_v1” for Voyager1 and “let dist_1_v2” for Voyager2… The idea is for Nightbot to post the current distance for both Voyager. But we don’t know if it’s possibe for Nightbot…

Run the code in that URL as JS then output both Voyager distances:

$(eval try{$(urlfetch json;`Voyager 1 distance: ${dist_1_v1} | Voyager 2 distance: ${dist_1_v2}`;}catch(e){`Data fetch error!`;})
1 Like

Thank you!!! Again!!

Now the friend helping me to create this is asking if we can format the numbers using .toFixed? And if we can divide them by a billion, like, (dist_v1/1.0e9).toFixed(1)…

It’s just evaluating JavaScript, so toFixed should work.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.