feat(monday): add new boards trigger

This commit is contained in:
Rıdvan Akca
2024-05-03 14:46:07 +02:00
parent 2295507a2c
commit f0b5d85a7a
6 changed files with 51 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import defineApp from '../../helpers/define-app.js';
import addAuthHeader from './common/add-auth-header.js';
import auth from './auth/index.js';
import triggers from './triggers/index.js';
export default defineApp({
name: 'Monday',
@@ -13,4 +14,5 @@ export default defineApp({
primaryColor: 'F62B54',
beforeRequest: [addAuthHeader],
auth,
triggers,
});

View File

@@ -0,0 +1,3 @@
import newBoards from './new-boards/index.js';
export default [newBoards];

View File

@@ -0,0 +1,29 @@
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New board',
key: 'newBoard',
pollInterval: 15,
description: 'Triggers when a new board is created.',
async run($) {
const body = {
query: 'query { boards { id, name } }',
};
const { data } = await $.http.post('/', body);
if (!data?.data?.boards?.length) {
return;
}
for (const board of data.data.boards) {
$.pushTriggerItem({
raw: board,
meta: {
internalId: board.id,
},
});
}
},
});

View File

@@ -228,7 +228,10 @@ export default defineConfig({
text: 'Monday',
collapsible: true,
collapsed: true,
items: [{ text: 'Connection', link: '/apps/monday/connection' }],
items: [
{ text: 'Triggers', link: '/apps/monday/triggers' },
{ text: 'Connection', link: '/apps/monday/connection' },
],
},
{
text: 'Notion',

View File

@@ -0,0 +1,12 @@
---
favicon: /favicons/monday.svg
items:
- name: New board
desc: Triggers when a new board is created.
---
<script setup>
import CustomListing from '../../components/CustomListing.vue'
</script>
<CustomListing />

View File

@@ -23,6 +23,7 @@ The following integrations are currently supported by Automatisch.
- [Invoice Ninja](/apps/invoice-ninja/triggers)
- [Mattermost](/apps/mattermost/actions)
- [Miro](/apps/miro/actions)
- [Monday](/apps/monday/triggers)
- [Notion](/apps/notion/triggers)
- [Ntfy](/apps/ntfy/actions)
- [Odoo](/apps/odoo/actions)