Where is the International Space Station (ISS)?
@demo
code:
data:publiclast updated:3 years ago
today
Waiting to run first job...
This is a live workflow with public data.
Select an event to inspect the return values and logs for each step (learn more).
Sign up to customize, add steps, modify code and more.
Join 800,000+ developers using the Pipedream platform
steps.
trigger
Cron Scheduler
Every 5 minutes
Next Event:Dec 30, 2020, 6:17 PM
schedule
steps.
get_iss_position
Make an HTTP or webhook request and return the response as a step export.
params
URL
http://api.open-notify.org/iss-now.json
string ·params.url
Method
string ·params.method
Optional
code
async params => {
1
2
3
4
5
6
7
8
9
10
11
}
12
const config = {
  method: params.method,
  url: params.url,
  params: params.query,
  headers: params.headers,
  responseType: params.responseType,
  data: params.data,
}
if (params.auth) config.auth = params.auth
return await require("@pipedreamhq/platform").axios(this, config)
steps.
geocoder_request
Make a geocoder API request
auth
(auths.opencage)
params
Request format

The format component of the URL should be replaced with one of the following json, geojson, xml, map or google-v3-json.

string ·params.format
Query string

A latitude, longitude or a placename/address. The query should be URL encoded, so spaces should be a +, comma should be %2C, instead of, for example, non-ascii strings like München you should send us M%C3%BCnchen.

{{steps.get_iss_position.$return_value.iss_position.latitude}},{{steps.get_iss_position.$return_value.iss_position.longitude}}
string ·params.q
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
}
23
return await require("@pipedreamhq/platform").axios(this, {
  url: `https://api.opencagedata.com/geocode/v1/${params.format}`,
  params: {
    key: auths.opencage.api_key,
    q: params.q,
    abbrv: params.abbrv,
    add_request: params.add_request,
    bounds: params.bounds,
    countrycode: params.countrycode,
    jsonp: params.jsonp,
    language: params.language,
    limit: params.limit,
    min_confidence: params.min_confidence,
    no_annotations: params.no_annotations,
    no_dedupe: params.no_dedupe,
    no_record: params.no_record,
    pretty: params.pretty,
    proximity: params.proximity,
    roadinfo: params.roadinfo,
  },
})
steps.
generate_maps_url
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
}
3
return `http://www.google.com/maps/place/${steps.get_iss_position.$return_value.iss_position.latitude},${steps.get_iss_position.$return_value.iss_position.longitude}/@${steps.get_iss_position.$return_value.iss_position.latitude},${steps.get_iss_position.$return_value.iss_position.longitude},1z`
steps.
iss_summary
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
7
}
8
// To use npm packages like Moment.js, just require them
const moment = require('moment')

// Finally, we'll reference the data returned by the Open Notify 
// API in the previous step and output a human readable summary.
return `The International Space Station was passing over ${steps.geocoder_request.$return_value.results[0].formatted} on ${moment(steps.get_iss_position.$return_value.timestamp*1000)} ${steps.generate_maps_url.$return_value}`
steps.
post_tweet
Post a tweet.
auth
(auths.twitter)
params
Status
{{steps.iss_summary.$return_value}}
string ·params.status
Lat
{{steps.get_iss_position.$return_value.iss_position.latitude}}
string ·params.lat
Long
{{steps.get_iss_position.$return_value.iss_position.longitude}}
string ·params.long
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
}
23
const axios = require('axios')
const {status, in_reply_to_status_id, auto_populate_reply_metadata, exclude_reply_user_ids, attachment_url, media_ids, possibly_sensitive, lat, long, place_id, display_coordinates, trim_user, enable_dmcommands, fail_dmcommands, card_uri} = params
const body = {
  config: {
    url: `https://api.twitter.com/1.1/statuses/update.json`,
    method: 'POST',
    params,
  },
  token: {
    key: auths.twitter.oauth_access_token,
    secret: auths.twitter.oauth_refresh_token,
  },
}
const proxy = "https://api.pipedream.com/v1/oauth1/app_13GhY1"
const resp = await axios.post(proxy,body)

const {messages, data} = resp.data
for (const message of messages) {
  console.log(message)
}
return data