Skip to content

Commit

Permalink
feat(zendesk): add find user action
Browse files Browse the repository at this point in the history
  • Loading branch information
ridvanakca committed Nov 29, 2023
1 parent 1995b1a commit 43d741c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/backend/src/apps/zendesk/actions/find-user/index.ts
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] });
},
});
2 changes: 2 additions & 0 deletions packages/docs/pages/apps/zendesk/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ items:
desc: Deletes an existing ticket.
- name: Find ticket
desc: Finds an existing ticket.
- name: Find user
desc: Finds an existing user.
- name: Update ticket
desc: Modify the status of an existing ticket or append comments.
- name: Update user
Expand Down

0 comments on commit 43d741c

Please sign in to comment.