Skip to content

Commit 84a4ae0

Browse files
authored
fix: support ticket user lookup (#6772)
1 parent 5ee3a2e commit 84a4ae0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/services/api/src/modules/support/providers/support-manager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export class SupportManager {
218218

219219
// Before attempting to create the user we need to check whether an user with that email might already exist.
220220
let userZendeskId = await this.httpClient
221-
.get(`https://${this.config.subdomain}.zendesk.com/api/v2/users`, {
221+
.get(`https://${this.config.subdomain}.zendesk.com/api/v2/users/search`, {
222222
searchParams: {
223223
query: email,
224224
},
@@ -242,9 +242,9 @@ export class SupportManager {
242242
})
243243
.parse(res);
244244

245-
const user = data.users.at(0) ?? null;
245+
const user = data.users.find(u => u.email === email) ?? null;
246246

247-
if (user?.email === email) {
247+
if (user) {
248248
this.logger.info(
249249
'User found on Zendesk. (organizationID: %s, userId: %s)',
250250
input.organizationId,

0 commit comments

Comments
 (0)