auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const axios = require("axios")
// Pull details on the best story on HN
const bestStories = (await axios.get("https://hacker-news.firebaseio.com/v0/beststories.json")).data
// Stories are returned ordered, so the top story appears first
const topStory = (await axios.get(`https://hacker-news.firebaseio.com/v0/item/${bestStories[0]}.json`)).data
// Then email yourself with the link to the story
// Email client that can render HTML will display that, text is a fallback
const text = `
${topStory.title} — ${topStory.url}
`
const html = `
<a href="${topStory.url}">${topStory.title}</a>
`
$send.email({
subject: "Best Story on Hacker News today",
text,
html,
})