Skip to content

Commit 4d8ed76

Browse files
committed
fix: update internal API request format
1 parent b84bd89 commit 4d8ed76

1 file changed

Lines changed: 14 additions & 26 deletions

File tree

  • services/apps/organizations_enrichment_worker/src/sources/internal-api

services/apps/organizations_enrichment_worker/src/sources/internal-api/service.ts

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -52,38 +52,26 @@ export default class EnrichmentServiceInternalAPI
5252
): Promise<IOrganizationEnrichmentDataInternalAPI | null> {
5353
let response: IOrganizationEnrichmentDataInternalAPIResponse | undefined
5454

55-
console.log(
56-
'[DEBUG] Internal API URL:',
57-
process.env['CROWD_ORGANIZATION_ENRICHMENT_INTERNAL_API_URL'],
58-
)
59-
60-
console.log(
61-
'[DEBUG] Internal API Key:',
62-
process.env['CROWD_ORGANIZATION_ENRICHMENT_INTERNAL_API_KEY'],
63-
)
64-
65-
console.log('[DEBUG] Input:', {
66-
name: input.displayName,
67-
urls: input.domains.map((domain) => cleanURL(domain.value)),
68-
})
69-
7055
try {
71-
const url = `${process.env['CROWD_ORGANIZATION_ENRICHMENT_INTERNAL_API_URL']}`
56+
const params = new URLSearchParams()
57+
params.append(
58+
'message',
59+
JSON.stringify({
60+
name: input.displayName,
61+
urls: input.domains.map((domain) => cleanURL(domain.value)),
62+
}),
63+
)
64+
params.append('stream', 'false')
65+
params.append('user_id', 'cdp-organization-enrichment')
66+
7267
const config = {
7368
method: 'post',
74-
url,
69+
url: process.env['CROWD_ORGANIZATION_ENRICHMENT_INTERNAL_API_URL'],
7570
headers: {
7671
Authorization: `Bearer ${process.env['CROWD_ORGANIZATION_ENRICHMENT_INTERNAL_API_KEY']}`,
77-
'Content-Type': 'application/json',
78-
},
79-
data: {
80-
message: {
81-
name: input.displayName,
82-
urls: input.domains.map((domain) => cleanURL(domain.value)),
83-
},
84-
stream: false,
85-
user_id: 'cdp-organization-enrichment',
72+
'Content-Type': 'application/x-www-form-urlencoded',
8673
},
74+
data: params.toString(),
8775
validateStatus: function (status: number) {
8876
return (status >= 200 && status < 300) || status === 404 || status === 422
8977
},

0 commit comments

Comments
 (0)