-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1995b1a
commit 43d741c
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
packages/backend/src/apps/zendesk/actions/find-user/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import defineAction from '../../../../helpers/define-action'; | ||
|
||
export default defineAction({ | ||
name: 'Find user', | ||
key: 'findUser', | ||
description: 'Finds an existing user.', | ||
arguments: [ | ||
{ | ||
label: 'Query', | ||
key: 'query', | ||
type: 'string' as const, | ||
required: true, | ||
variables: true, | ||
description: | ||
'Write a search string that specifies the way we will search for the user in Zendesk.', | ||
}, | ||
], | ||
|
||
async run($) { | ||
const query = $.step.parameters.query; | ||
|
||
const params = { | ||
query, | ||
}; | ||
|
||
const response = await $.http.get('/api/v2/users/search', { params }); | ||
|
||
$.setActionItem({ raw: response.data.users[0] }); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters