API command help

So I have the ISS tracker website API ( http://open-notify.org/Open-Notify-API/ISS-Location-Now/ ) and I wanted to make a command “!tracker” and Nightbot would say "The ISS position now is … BUT I am not sure how to make that work… because I don’t get what that “timestamp” and “message” is on there… Anyone can help?

@C.A Copy and paste this into chat:

!addcom -cd=5 !tracker The ISS is now at $(eval a=JSON.parse(`$(urlfetch json http://api.open-notify.org/iss-now.json)`);a.iss_position.latitude+`, `+a.iss_position.longitude)

You don’t need to worry about the values of “message” and “timestamp”. The value of “timestamp” is just the unix time (number of seconds passed since midnight Jan 1 1970 UTC).

1 Like

yesss! thank you so much!

I have another doubt… do you think there is a way I could make Google maps to show the locations those latitude and longitude numbers are showing? Like: Nightbot paste the command you wrote above and next to it he would paste google maps link with the location from the lat and long… google.com/maps [ and here it would pull the location from the API ] ??? I have crazy ideas!

@C.A Delete the current !tracker command if you already added it, then copy and paste this into chat:

!addcom -cd=5 !tracker The ISS is now at $(eval a=JSON.parse(`$(urlfetch json http://api.open-notify.org/iss-now.json)`);b=a.iss_position.latitude;c=a.iss_position.longitude;b+`, `+c+` | Google Maps view: https://www.google.com/maps/place/`+b+`,`+c+`/@`+b+`,`+c+`,3z`)

There is just one problem…Nightbot won’t allow me more than 200 caracthers! Even on the dashboard, I can paste – The ISS is now at $(eval a=JSON.parse($(urlfetch json http://api.open-notify.org/iss-now.json));b=a.iss_position.latitude;c=a.iss_position.longitude;b+,+c+| Google Maps view: https://www.google --- the final ----.com/maps/place/+b+,+c+/@+b+,+c+,3z) won’t fit in! oh my!

@C.A YouTube has a 200 character response limit while Twitch has a 500 character limit. It’s a bit of a pain to deal with, but I managed to trim and compact a few bits here and there. You will have to add the command through the dashboard:

The ISS is at $(eval a=JSON.parse(`$(urlfetch http://api.open-notify.org/iss-now)`);b=a.iss_position.latitude+`,`+a.iss_position.longitude;b+` | Google Maps: google.com/maps/place/`+b+`/@`+b+`,3z`)

yessssssssss omg thank you so so much! you are the best!

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