Skip to content

Commit

Permalink
fix: Include block and fallback text for approval (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith authored Dec 30, 2024
1 parent e73d437 commit f64838c
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions control-plane/src/modules/integrations/slack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,34 +163,41 @@ export const handleApprovalRequest = async ({

const client = new webApi.WebClient(token)

const text = `I need your approval to call \`${service}.${targetFn}\` on run <${env.APP_ORIGIN}/clusters/${clusterId}/runs/${runId}|${runId}>`

client?.chat.postMessage({
thread_ts: metadata[THREAD_META_KEY],
channel: metadata[CHANNEL_META_KEY],
mrkdwn: true,
text: `I need your approval to call \`${service}.${targetFn}\` on run <${env.APP_ORIGIN}/clusters/${clusterId}/runs/${runId}|${runId}>`,
text,
blocks: [
{
"type": "actions",
"elements": [
type: "section",
text: {
type: "mrkdwn",
text
}
},
{
type: "actions",
elements: [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Approve",
"emoji": true
type: "button",
text: {
type: "plain_text",
text: "Approve",
},
"value": callId,
"action_id": CALL_APPROVE_ACTION_ID
value: callId,
action_id: CALL_APPROVE_ACTION_ID
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": "Deny",
"emoji": true
type: "button",
text: {
type: "plain_text",
text: "Deny",
},
"value": callId,
"action_id": CALL_DENY_ACTION_ID
value: callId,
action_id: CALL_DENY_ACTION_ID
}
]
}
Expand Down

0 comments on commit f64838c

Please sign in to comment.