Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

refactor: add diagnostics for slack integration error

Brad Barbin55f3b0c25ba3
diff --git a/packages/integrations/src/slack/lib/service.ts b/packages/integrations/src/slack/lib/service.ts
index f36437ffc6..ec61cd9fc2 100644
--- a/packages/integrations/src/slack/lib/service.ts
+++ b/packages/integrations/src/slack/lib/service.ts
@@ -55,61 +55,65 @@ export async function createIssueSlackThread(
const slackClient = createSlackWebClient({ token: auth?.slackToken });
- const threadMessage = await slackClient.chat.postMessage({
- channel: auth.channelId,
- unfurl_links: false,
- unfurl_media: false,
- blocks: [
- {
- type: "header",
- text: {
- type: "plain_text",
- text: `Issue ${data.nonConformanceId}`,
- },
+ const blocks = [
+ {
+ type: "header",
+ text: {
+ type: "plain_text",
+ text: `Issue ${data.nonConformanceId}`,
+ },
+ },
+ {
+ type: "section",
+ text: {
+ type: "mrkdwn",
+ text: `*${data.title}*\n${
+ data.description || "_No description provided_"
+ }`,
},
- {
- type: "section",
- text: {
+ fields: [
+ {
type: "mrkdwn",
- text: `*${data.title}*\n${
- data.description || "_No description provided_"
- }`,
+ text: `*Status:*\nRegistered`,
},
- fields: [
- {
- type: "mrkdwn",
- text: `*Status:*\nRegistered`,
- },
- {
- type: "mrkdwn",
- text: `*Severity:*\n${data.severity}`,
- },
- ],
- },
- {
- type: "context",
- elements: [
- {
- type: "mrkdwn",
- text: `Created by <@${auth.slackUserId}>`,
- },
- ],
- },
- {
- type: "actions",
- elements: [
- {
- type: "button",
- text: {
- type: "plain_text",
- text: "View in Carbon",
- },
- url: data.carbonUrl,
- action_id: "view_in_carbon",
+ {
+ type: "mrkdwn",
+ text: `*Severity:*\n${data.severity}`,
+ },
+ ],
+ },
+ {
+ type: "context",
+ elements: [
+ {
+ type: "mrkdwn",
+ text: `Created by <@${auth.slackUserId}>`,
+ },
+ ],
+ },
+ {
+ type: "actions",
+ elements: [
+ {
+ type: "button",
+ text: {
+ type: "plain_text",
+ text: "View in Carbon",
},
- ],
- },
- ],
+ url: data.carbonUrl,
+ action_id: "view_in_carbon",
+ },
+ ],
+ },
+ ];
+
+ console.log({ blocks, data });
+
+ const threadMessage = await slackClient.chat.postMessage({
+ channel: auth.channelId,
+ unfurl_links: false,
+ unfurl_media: false,
+ blocks,
});
if (threadMessage.ts) {