auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
const { text } = steps.trigger.event.body.event
if (!text) $end("No text in message, exiting")
if (steps.trigger.event.body.event?.thread_ts) $end("We don't run on messages in threads")
return text.replace(/<@U0245784PC3>\s*/, '')
The title of the issue.
Name of repository owner.
Name of repository.
Labels to associate with this issue. NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise.
async
(params, auths) => {
}
//See the API docs here: https://developer.github.com/v3/issues/#create-an-issue
const data = {
assignee: params.assignee,
body: params.body,
labels: params.labels,
milestone: params.milestone,
title: params.title,
}
const config = {
method: "post",
url: `https://api.github.com/repos/${params.owner}/${params.repo}/issues`,
headers: {
Authorization: `Bearer ${auths.github.oauth_access_token}`,
},
data,
}
return await require("@pipedreamhq/platform").axios(this, config)
import { WebClient } from '@slack/web-api'
export default defineComponent({
props: {
slack: {
type: "app",
app: "slack",
}
},
async run({ steps, $ }) {
const web = new WebClient(this.slack.$auth.oauth_access_token)
const { channel, ts, thread_ts } = steps.trigger.event.body.event
return await web.chat.postMessage({
text: `Added ticket to the backlog: ${steps.github_create_repo_issue.$return_value.html_url}`,
channel,
thread_ts: thread_ts ?? ts,
})
},
})