Send a random Star Wars character name to a Discord channel (Discord Webhooks)
@dylburger
code:
data:privatelast updated:4 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
Cron Scheduler
Deploy to configure a custom schedule
This workflow runs on Pipedream's servers and is triggered on a custom schedule.
steps.
return_random_character_name
auth
(auths.swapi)
code
async (params, auths) => {
1
2
3
4
5
6
7
8
}
9
const sample = require("lodash.sample")

const people = await require("@pipedreamhq/platform").axios(this, {
  url: `https://swapi.dev/api/people/`,
})

return sample(people.results).name
steps.
send_message_1
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.return_random_character_name.$return_value}}
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
const url = auths.discord_webhook.oauth_uid
let content = params.message
const { embeds, username, avatar_url } = params

return await require("@pipedreamhq/platform").axios(this, {
  method: "POST",
  url,
  headers: {
    "Content-Type": "application/json"
  },
  data: {
    content,
    embeds,
    username,
    avatar_url,
  }
})