Merge pull request #1880 from automatisch/AUT-972

feat(monday): add new users trigger
This commit is contained in:
Ali BARIN
2025-02-05 17:52:41 +01:00
committed by GitHub
6 changed files with 44 additions and 9 deletions

View File

@@ -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];

View File

@@ -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,12 +18,14 @@ export default defineTrigger({
} }
for (const board of data.data.boards) { for (const board of data.data.boards) {
$.pushTriggerItem({ if (board.type === 'board') {
raw: board, $.pushTriggerItem({
meta: { raw: board,
internalId: board.id, meta: {
}, internalId: board.id,
}); },
});
}
} }
}, },
}); });

View 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,
},
});
}
},
});

View File

@@ -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",

View File

@@ -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' },
], ],
}, },

View File

@@ -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>