Compare commits

...

6 Commits

Author SHA1 Message Date
Rıdvan Akca
c7e887dbfa feat(monday): add new users trigger 2024-05-09 15:23:26 +02:00
Rıdvan Akca
8c0a5a3bd3 feat(monday): add create column action 2024-05-09 14:48:20 +02:00
Rıdvan Akca
9b00cff2d9 feat(monday): add create item action 2024-05-09 14:02:47 +02:00
Rıdvan Akca
ff0dd0b415 feat(monday): add create board action 2024-05-08 12:14:32 +02:00
Rıdvan Akca
f0b5d85a7a feat(monday): add new boards trigger 2024-05-03 14:46:07 +02:00
Rıdvan Akca
2295507a2c feat(monday): add monday integration 2024-05-03 14:04:57 +02:00
22 changed files with 572 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create board',
key: 'createBoard',
description: 'Creates a new board.',
arguments: [
{
label: 'Board Name',
key: 'boardName',
type: 'string',
required: true,
description: 'Title for the board.',
variables: true,
},
{
label: 'Board Kind',
key: 'boardKind',
type: 'dropdown',
required: true,
description: '',
variables: true,
options: [
{
label: 'Main',
value: 'public',
},
{
label: 'Private',
value: 'private',
},
{
label: 'Shareable',
value: 'share',
},
],
},
{
label: 'Template ID',
key: 'templateId',
type: 'string',
required: false,
description:
"When you switch on developer mode, you'll spot the template IDs in your template store. Additionally, you have the option to utilize the Board ID from any board you've saved as a template.",
variables: true,
},
],
async run($) {
const { boardName, boardKind, templateId } = $.step.parameters;
const body = {
query: `mutation {
create_board (board_name: "${boardName}", board_kind: ${boardKind}${
templateId ? `, template_id: ${templateId}` : ''
}) {
id
name
board_kind
}
}`,
};
const { data } = await $.http.post('/', body);
$.setActionItem({
raw: data,
});
},
});

View File

@@ -0,0 +1,98 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create column',
key: 'createColumn',
description: 'Creates a new column in a board.',
arguments: [
{
label: 'Board',
key: 'boardId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listBoards',
},
],
},
},
{
label: 'Column Title',
key: 'columnTitle',
type: 'string',
required: true,
description: '',
variables: true,
},
{
label: 'Column Type',
key: 'columnType',
type: 'dropdown',
required: true,
description: '',
variables: true,
options: [
{ label: 'Button', value: 'button' },
{ label: 'Checkbox', value: 'checkbox' },
{ label: 'Color Picker', value: 'color_picker' },
{ label: 'Connect Boards', value: 'board_relation' },
{ label: 'Country', value: 'country' },
{ label: 'Creation Log', value: 'creation_log' },
{ label: 'Date', value: 'date' },
{ label: 'Dependency', value: 'dependency' },
{ label: 'Dropdown', value: 'dropdown' },
{ label: 'Email', value: 'email' },
{ label: 'Files', value: 'file' },
{ label: 'Formula', value: 'formula' },
{ label: 'Hour', value: 'hour' },
{ label: 'Item ID', value: 'item_id' },
{ label: 'Last Updated', value: 'last_updated' },
{ label: 'Link', value: 'link' },
{ label: 'Location', value: 'location' },
{ label: 'Long Text', value: 'long_text' },
{ label: 'Mirror', value: 'mirror' },
{ label: 'monday Doc', value: 'doc' },
{ label: 'Name', value: 'name' },
{ label: 'Numbers', value: 'numbers' },
{ label: 'People', value: 'people' },
{ label: 'Phone', value: 'phone' },
{ label: 'Rating', value: 'rating' },
{ label: 'Status', value: 'status' },
{ label: 'Tags', value: 'tags' },
{ label: 'Text', value: 'text' },
{ label: 'Timeline', value: 'timeline' },
{ label: 'Time Tracking', value: 'time_tracking' },
{ label: 'Vote', value: 'vote' },
{ label: 'Week', value: 'week' },
{ label: 'World Clock', value: 'world_clock' },
],
},
],
async run($) {
const { boardId, columnTitle, columnType } = $.step.parameters;
const body = {
query: `
mutation{
create_column (board_id: ${boardId}, title: "${columnTitle}", column_type: ${columnType}) {
id
title
}
}`,
};
const { data } = await $.http.post('/', body);
$.setActionItem({
raw: data,
});
},
});

View File

@@ -0,0 +1,112 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create item',
key: 'createItem',
description: 'Creates a new item in a board.',
arguments: [
{
label: 'Board',
key: 'boardId',
type: 'dropdown',
required: true,
description: '',
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listBoards',
},
],
},
},
{
label: 'Group',
key: 'groupId',
type: 'dropdown',
required: false,
description: '',
dependsOn: ['parameters.boardId'],
variables: true,
source: {
type: 'query',
name: 'getDynamicData',
arguments: [
{
name: 'key',
value: 'listGroups',
},
{
name: 'parameters.boardId',
value: '{parameters.boardId}',
},
],
},
},
{
label: 'Item Name',
key: 'itemName',
type: 'string',
required: true,
description: '',
variables: true,
},
{
label: 'Subitem Names',
key: 'subitemNames',
type: 'dynamic',
required: false,
description: '',
fields: [
{
label: 'Subitem Name',
key: 'subitemName',
type: 'string',
required: false,
description: '',
variables: true,
},
],
},
],
async run($) {
const { boardId, groupId, itemName, subitemNames } = $.step.parameters;
const allSubitems = subitemNames.map((entry) => entry.subitemName);
const body = {
query: `
mutation {
create_item (board_id: ${boardId}${
groupId ? `, group_id: "${groupId}"` : ''
}, item_name: "${itemName}") {
id
}
}`,
};
const { data } = await $.http.post('/', body);
const itemId = data.data.create_item.id;
for (let subitemName of allSubitems) {
let body = {
query: `
mutation {
create_subitem (parent_item_id:${itemId}, item_name:"${subitemName}") {
id
}
}`,
};
await $.http.post('/', body);
}
$.setActionItem({
raw: data,
});
},
});

View File

@@ -0,0 +1,5 @@
import createBoard from './create-board/index.js';
import createColumn from './create-column/index.js';
import createItem from './create-item/index.js';
export default [createBoard, createColumn, createItem];

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="256px" height="156px" viewBox="0 0 256 156" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
<g>
<path d="M31.8458633,153.488694 C20.3244423,153.513586 9.68073708,147.337265 3.98575204,137.321731 C-1.62714067,127.367831 -1.29055839,115.129325 4.86093879,105.498969 L62.2342919,15.4033556 C68.2125882,5.54538256 79.032489,-0.333585033 90.5563073,0.0146553508 C102.071737,0.290611552 112.546041,6.74705604 117.96667,16.9106216 C123.315033,27.0238906 122.646488,39.1914174 116.240607,48.6847625 L58.9037201,138.780375 C52.9943022,147.988884 42.7873202,153.537154 31.8458633,153.488694 L31.8458633,153.488694 Z" fill="#F62B54"></path>
<path d="M130.25575,153.488484 C118.683837,153.488484 108.035731,147.301291 102.444261,137.358197 C96.8438154,127.431292 97.1804475,115.223704 103.319447,105.620522 L160.583402,15.7315506 C166.47539,5.73210989 177.327374,-0.284878136 188.929728,0.0146553508 C200.598885,0.269918151 211.174058,6.7973526 216.522421,17.0078646 C221.834319,27.2183766 221.056375,39.4588356 214.456008,48.9278699 L157.204209,138.816842 C151.313487,147.985468 141.153618,153.5168 130.25575,153.488484 Z" fill="#FFCC00"></path>
<ellipse fill="#00CA72" cx="226.465527" cy="125.324379" rx="29.5375538" ry="28.9176274"></ellipse>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,21 @@
import verifyCredentials from './verify-credentials.js';
import isStillVerified from './is-still-verified.js';
export default {
fields: [
{
key: 'apiToken',
label: 'API Token',
type: 'string',
required: true,
readOnly: false,
value: null,
placeholder: null,
description: 'Monday.com API token of your account.',
clickToCopy: false,
},
],
verifyCredentials,
isStillVerified,
};

View File

@@ -0,0 +1,8 @@
import verifyCredentials from './verify-credentials.js';
const isStillVerified = async ($) => {
await verifyCredentials($);
return true;
};
export default isStillVerified;

View File

@@ -0,0 +1,18 @@
const verifyCredentials = async ($) => {
const body = {
query: 'query { me { name, email } }',
};
const { data } = await $.http.post('/', body);
const screenName = [data.data.me.name, data.data.me.email]
.filter(Boolean)
.join(' @ ');
await $.auth.set({
screenName,
apiToken: $.auth.data.apiToken,
});
};
export default verifyCredentials;

View File

@@ -0,0 +1,9 @@
const addAuthHeader = ($, requestConfig) => {
if ($.auth.data?.apiToken) {
requestConfig.headers.Authorization = $.auth.data.apiToken;
}
return requestConfig;
};
export default addAuthHeader;

View File

@@ -0,0 +1,4 @@
import listBoards from './list-boards/index.js';
import listGroups from './list-groups/index.js';
export default [listBoards, listGroups];

View File

@@ -0,0 +1,34 @@
export default {
name: 'List boards',
key: 'listBoards',
async run($) {
const boards = {
data: [],
};
const body = {
query: `
query {
boards {
id
name
}
}
`,
};
const { data } = await $.http.post('/', body);
if (data.data.boards?.length) {
for (const board of data.data.boards) {
boards.data.push({
value: board.id,
name: board.name,
});
}
}
return boards;
},
};

View File

@@ -0,0 +1,40 @@
export default {
name: 'List groups',
key: 'listGroups',
async run($) {
const groups = {
data: [],
};
const boardId = $.step.parameters.parameters.boardId;
if (!boardId) {
return groups;
}
const body = {
query: `query {
boards (ids: ${boardId}) {
groups {
title
id
}
}
}
`,
};
const { data } = await $.http.post('/', body);
if (data.data.boards[0].groups.length) {
for (const group of data.data.boards[0].groups) {
groups.data.push({
value: group.id,
name: group.title,
});
}
}
return groups;
},
};

View File

@@ -0,0 +1,22 @@
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';
import actions from './actions/index.js';
import dynamicData from './dynamic-data/index.js';
export default defineApp({
name: 'Monday',
key: 'monday',
iconUrl: '{BASE_URL}/apps/monday/assets/favicon.svg',
authDocUrl: '{DOCS_URL}/apps/monday/connection',
supportsConnections: true,
baseUrl: 'https://monday.com',
apiBaseUrl: 'https://api.monday.com/v2',
primaryColor: 'F62B54',
beforeRequest: [addAuthHeader],
auth,
triggers,
actions,
dynamicData,
});

View File

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

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

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

@@ -224,6 +224,16 @@ export default defineConfig({
{ text: 'Connection', link: '/apps/miro/connection' },
],
},
{
text: 'Monday',
collapsible: true,
collapsed: true,
items: [
{ text: 'Actions', link: '/apps/monday/actions' },
{ text: 'Triggers', link: '/apps/monday/triggers' },
{ text: 'Connection', link: '/apps/monday/connection' },
],
},
{
text: 'Notion',
collapsible: true,

View File

@@ -0,0 +1,16 @@
---
favicon: /favicons/monday.svg
items:
- name: Create board
desc: Creates a new board.
- name: Create column
desc: Creates a new column in a board.
- name: Create item
desc: Creates a new item in a board.
---
<script setup>
import CustomListing from '../../components/CustomListing.vue'
</script>
<CustomListing />

View File

@@ -0,0 +1,12 @@
# Monday
:::info
This page explains the steps you need to follow to set up the Monday
connection in Automatisch. If any of the steps are outdated, please let us know!
:::
1. Login to your Monday account: [https://monday.com](https://monday.com).
2. Click on the account logo and go to the **Developers** page.
3. Click on the **My access tokens** tab on the left.
4. Click on the **Show** button and copy the access token from the page to the `API Token` field on Automatisch.
5. Now, you can start using the Monday connection with Automatisch.

View File

@@ -0,0 +1,14 @@
---
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>
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)

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="256px" height="156px" viewBox="0 0 256 156" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
<g>
<path d="M31.8458633,153.488694 C20.3244423,153.513586 9.68073708,147.337265 3.98575204,137.321731 C-1.62714067,127.367831 -1.29055839,115.129325 4.86093879,105.498969 L62.2342919,15.4033556 C68.2125882,5.54538256 79.032489,-0.333585033 90.5563073,0.0146553508 C102.071737,0.290611552 112.546041,6.74705604 117.96667,16.9106216 C123.315033,27.0238906 122.646488,39.1914174 116.240607,48.6847625 L58.9037201,138.780375 C52.9943022,147.988884 42.7873202,153.537154 31.8458633,153.488694 L31.8458633,153.488694 Z" fill="#F62B54"></path>
<path d="M130.25575,153.488484 C118.683837,153.488484 108.035731,147.301291 102.444261,137.358197 C96.8438154,127.431292 97.1804475,115.223704 103.319447,105.620522 L160.583402,15.7315506 C166.47539,5.73210989 177.327374,-0.284878136 188.929728,0.0146553508 C200.598885,0.269918151 211.174058,6.7973526 216.522421,17.0078646 C221.834319,27.2183766 221.056375,39.4588356 214.456008,48.9278699 L157.204209,138.816842 C151.313487,147.985468 141.153618,153.5168 130.25575,153.488484 Z" fill="#FFCC00"></path>
<ellipse fill="#00CA72" cx="226.465527" cy="125.324379" rx="29.5375538" ry="28.9176274"></ellipse>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB