Merge pull request #1880 from automatisch/AUT-972
feat(monday): add new users trigger
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
import newBoards from './new-boards/index.js';
|
import newBoards from './new-boards/index.js';
|
||||||
|
import newUsers from './new-users/index.js';
|
||||||
|
|
||||||
export default [newBoards];
|
export default [newBoards, newUsers];
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default defineTrigger({
|
|||||||
|
|
||||||
async run($) {
|
async run($) {
|
||||||
const body = {
|
const body = {
|
||||||
query: 'query { boards { id, name } }',
|
query: 'query { boards { id, name, type } }',
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data } = await $.http.post('/', body);
|
const { data } = await $.http.post('/', body);
|
||||||
@@ -18,6 +18,7 @@ export default defineTrigger({
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const board of data.data.boards) {
|
for (const board of data.data.boards) {
|
||||||
|
if (board.type === 'board') {
|
||||||
$.pushTriggerItem({
|
$.pushTriggerItem({
|
||||||
raw: board,
|
raw: board,
|
||||||
meta: {
|
meta: {
|
||||||
@@ -25,5 +26,6 @@ export default defineTrigger({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
29
packages/backend/src/apps/monday/triggers/new-users/index.js
Normal file
29
packages/backend/src/apps/monday/triggers/new-users/index.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import defineTrigger from '../../../../helpers/define-trigger.js';
|
||||||
|
|
||||||
|
export default defineTrigger({
|
||||||
|
name: 'New users',
|
||||||
|
key: 'newUsers',
|
||||||
|
pollInterval: 15,
|
||||||
|
description: 'Triggers when a new user joins your account.',
|
||||||
|
|
||||||
|
async run($) {
|
||||||
|
const body = {
|
||||||
|
query: 'query { users { id name } }',
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await $.http.post('/', body);
|
||||||
|
|
||||||
|
if (!data.data?.users?.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const user of data.data.users.reverse()) {
|
||||||
|
$.pushTriggerItem({
|
||||||
|
raw: user,
|
||||||
|
meta: {
|
||||||
|
internalId: user.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -40,6 +40,7 @@ exports[`App model > list should have list of applications keys 1`] = `
|
|||||||
"mattermost",
|
"mattermost",
|
||||||
"miro",
|
"miro",
|
||||||
"mistral-ai",
|
"mistral-ai",
|
||||||
|
"monday",
|
||||||
"notion",
|
"notion",
|
||||||
"ntfy",
|
"ntfy",
|
||||||
"odoo",
|
"odoo",
|
||||||
|
|||||||
@@ -345,8 +345,8 @@ export default defineConfig({
|
|||||||
collapsible: true,
|
collapsible: true,
|
||||||
collapsed: true,
|
collapsed: true,
|
||||||
items: [
|
items: [
|
||||||
{ text: 'Actions', link: '/apps/monday/actions' },
|
|
||||||
{ text: 'Triggers', link: '/apps/monday/triggers' },
|
{ text: 'Triggers', link: '/apps/monday/triggers' },
|
||||||
|
{ text: 'Actions', link: '/apps/monday/actions' },
|
||||||
{ text: 'Connection', link: '/apps/monday/connection' },
|
{ text: 'Connection', link: '/apps/monday/connection' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ favicon: /favicons/monday.svg
|
|||||||
items:
|
items:
|
||||||
- name: New board
|
- name: New board
|
||||||
desc: Triggers when a new board is created.
|
desc: Triggers when a new board is created.
|
||||||
|
- name: New users
|
||||||
|
desc: Triggers when a new user joins your account.
|
||||||
---
|
---
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|||||||
Reference in New Issue
Block a user