Hacker News Event Stream (to email, slack, sms, etc)
@demo
code:
data:publiclast updated:3 years ago
today
Generate events to trigger workflow code...
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
inactive
last updated:-last event:-
steps.
email_me
Customize and send an email to the email address you registered with Pipedream. The email will be sent by notifications@pipedream.com.
params
Subject
New relevant story on Hacker News...
string ·params.subject
Text
{{steps.trigger.event.title}} | {{steps.trigger.event.link}}
string ·params.text
Optional
code
async params => {
1
2
3
4
5
6
7
8
9
10
11
12
}
13
const options = {
  subject: params.subject,
  text: params.text,
}
if (params.html) {
  options.html = params.html
}
if (params.include_collaborators) {
  options.include_collaborators = params.include_collaborators
}
$send.email(options)
steps.
end
End execution at this step. Later steps in the workflow will not run.
params
Reason
{{steps.trigger.event.title}}
string ·params.reason
code
async params => {
1
2
}
3
$end(params.reason)
steps.
send_a_message
Send a message to a channel, group or user
auth
(auths.slack)
params
Text

Text of the message to send. See Slack's formatting docs for more information. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation.

{{steps.trigger.event.title}} - {{steps.trigger.event.link}}
string ·params.text
Channel

Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.

 
C1234567890
string ·params.channel
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
const { WebClient } = require('@slack/web-api')

const web = new WebClient(auths.slack.oauth_access_token)
return await web.chat.postMessage({
  attachments: params.attachments,
  unfurl_links: params.unfurl_links,
  text: params.text,
  unfurl_media: params.unfurl_media,
  parse: params.parse,
  as_user: params.as_user || false,
  mrkdwn: params.mrkdwn || true,
  channel: params.channel,
  username: params.username,
  blocks: params.blocks,
  icon_emoji: params.icon_emoji,
  link_names: params.link_names,
  reply_broadcast: params.reply_broadcast || false,
  thread_ts: params.thread_ts,
  icon_url: params.icon_url,
})
steps.
send_message
Send a message to the channel tied to your incoming webhook. At least one of message OR embeds is required.
auth
(auths.discord_webhook)
params
Message
{{steps.trigger.event.title}} - {{steps.trigger.event.link}}
string ·params.message
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 url = auths.discord_webhook.oauth_uid
let content = params.message
const { embeds, username, avatar_url } = params

if (!content && !embeds) {
  throw new Error("This action expects a message OR an embeds param. Please enter one or the other from the params menu above")
}

return await require("@pipedreamhq/platform").axios(this, {
  method: "POST",
  url,
  headers: {
    "Content-Type": "application/json"
  },
  data: {
    content,
    embeds,
    username,
    avatar_url,
  }
})
steps.
send_new_message
Sends a new SMS message
auth
(auths.twilio)
params
To

The destination phone number. Format with a '+' and country code e.g., +16175551212 (E.164 format).

 
string ·params.To
From

A Twilio phone number (in E.164 format) or alphanumeric sender ID enabled for the type of message you wish to send. Phone numbers or short codes purchased from Twilio work here. You cannot (for example) spoof messages from your own cell phone number.

 
string ·params.From
Body

The text of the message you want to send, limited to 1600 characters.

{{steps.trigger.event.title}} - {{steps.trigger.event.link}}
string ·params.Body
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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
}
38
// Read the Twilio docs at https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource
const phone = require('phone');

// Parse the given number into its E.164 equivalent
// The E.164 phone number will be included in the first element
// of the array, but the array will be empty if parsing fails.
// See https://www.npmjs.com/package/phone
const toParsed = phone(params.To)
if (!toParsed.length) {
  throw new Error(`Phone number ${params.To} couldn't be parsed as a valid number.`)
}
const fromParsed = phone(params.From)
if (!fromParsed.length) {
  throw new Error(`Phone number ${params.From} couldn't be parsed as a valid number.`)
}

const data = {
  To: toParsed[0],
  From: fromParsed[0],
  MessagingServiceSid: params.MessagingServiceSid,
  Body: params.Body,
  MediaUrl: params.MediaUrl,
}
const config = {
  method: "post",
  url: `https://api.twilio.com/2010-04-01/Accounts/${auths.twilio.AccountSid}/Messages.json`,
  headers: {
    "Content-Type": "application/x-www-form-urlencoded",
  },
  auth: {
    username: auths.twilio.Sid,
    password: auths.twilio.Secret,
  },
  data: require("qs").stringify(data),
}
return await require("@pipedreamhq/platform").axios(this, config)