expenses_pipeline/expenses-pipeline-p_13CN51K/get_permalink/entry.js
2026-03-31 23:45:36 +00:00

26 lines
No EOL
663 B
JavaScript

import { axios } from "@pipedream/platform";
export default defineComponent({
props: {
slack: {
type: "app",
app: "slack_bot",
}
},
async run({ steps, $ }) {
const response = await axios($, {
method: "GET",
url: "https://slack.com/api/chat.getPermalink",
headers: {
Authorization: `Bearer ${this.slack.$auth.bot_token}`,
},
params: {
channel: steps.route_check.$return_value.fromChannel,
message_ts: steps.route_check.$return_value.messageTs,
},
});
if (!response.ok) throw new Error(response.error);
return {
permalink: response.permalink,
};
}
});