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 newUsers from './new-users/index.js';
export default [newBoards];
export default [newBoards, newUsers];

View File

@@ -8,7 +8,7 @@ export default defineTrigger({
async run($) {
const body = {
query: 'query { boards { id, name } }',
query: 'query { boards { id, name, type } }',
};
const { data } = await $.http.post('/', body);
@@ -18,12 +18,14 @@ export default defineTrigger({
}
for (const board of data.data.boards) {
$.pushTriggerItem({
raw: board,
meta: {
internalId: board.id,
},
});
if (board.type === 'board') {
$.pushTriggerItem({
raw: board,
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",
"miro",
"mistral-ai",
"monday",
"notion",
"ntfy",
"odoo",

View File

@@ -345,8 +345,8 @@ export default defineConfig({
collapsible: true,
collapsed: true,
items: [
{ text: 'Actions', link: '/apps/monday/actions' },
{ text: 'Triggers', link: '/apps/monday/triggers' },
{ text: 'Actions', link: '/apps/monday/actions' },
{ text: 'Connection', link: '/apps/monday/connection' },
],
},

View File

@@ -3,6 +3,8 @@ favicon: /favicons/monday.svg
items:
- name: New board
desc: Triggers when a new board is created.
- name: New users
desc: Triggers when a new user joins your account.
---
<script setup>