Skip to content

Commit 6995780

Browse files
committed
feat(org-detection): fix message routing
1 parent 223a5af commit 6995780

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/agents/org-detector/agent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ Output absolutely no text except for that final JSON.
348348
try {
349349
const parsed = JSON.parse(finalText);
350350
if (isObject(parsed?.matchedCompany)) {
351-
return parsed;
351+
return parsed.matchedCompany;
352352
} else {
353353
return noFoundFallback;
354354
}

src/support/slack/actions/approve-site-candidate.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ export default function approveSiteCandidate(lambdaContext) {
4444

4545
return async ({ ack, body, respond }) => {
4646
try {
47-
const { actions = [], message = {}, user } = body;
48-
const { blocks } = message;
47+
const {
48+
actions = [], channel, message = {}, user,
49+
} = body;
50+
const { blocks, ts: threadTs } = message;
4951

5052
log.info(JSON.stringify(body));
5153

@@ -106,7 +108,7 @@ export default function approveSiteCandidate(lambdaContext) {
106108

107109
await respond(reply);
108110

109-
const { channelId, threadId } = await announceSiteDiscovery(
111+
await announceSiteDiscovery(
110112
lambdaContext,
111113
baseURL,
112114
siteCandidate.getSource(),
@@ -126,8 +128,8 @@ export default function approveSiteCandidate(lambdaContext) {
126128
const { name, imsOrgId } = org;
127129

128130
const orgMsg = Message()
129-
.channel(channelId)
130-
.threadTs(threadId)
131+
.channel(channel.id)
132+
.threadTs(threadTs)
131133
.blocks(
132134
Blocks.Section()
133135
.text(`:agent_smith: Detected IMS organization \`${name}\` with IMS org ID \`${imsOrgId}\` for *<${baseURL}|${baseURL}>*. Would you approve? @${user.username}`),

0 commit comments

Comments
 (0)