1.0.18 • Published 3 years ago

monday-api-client v1.0.18

Weekly downloads
22
License
ISC
Repository
-
Last release
3 years ago

node-monday-api-client

Created by: https://www.enable.services/

Package allows you to easily

  • Retrieve a pulse with a boardId and a pulseId
  • Mutate a pulse with a boardId and a pulseId
  • Query a column with a boardId, columnId and a column value
  • Create a pulse with a boardId, group and an object of column values
  • Retrieve all the pulses and pulse data in a group with a boardId and groupId
  • Send a notification to monday with a userId and a boardId
  • Get basic user data with a userId
  • Get all users id, name and email

Installation

npm i monday-api-client

Usage

mondayApi = require('monday-api-client');

//You can either pass in the boardId and the pulseID manually
const data = {boardId : 123456, pulseId: 654321};

//Or

//You can use the event object within req.body, which come's from the monday.com webhook
const data = JSON.parse(req.body.event);

const token = 'My v2 api token';
//Returns a callback with the pulseData
mondayApi.pulse.getData(data, token, pulseData => {
     console.log(pulseData);
});
//The column object must contain the name of the column and the new value for that column under the pulseId provided
//For more info on the values, please goto https://monday.com/developers/v2#column-values-section-status
data.columnObj = {name: 'status', value: `"{\\"label\\":\\"Stuck\\"}"`};

//The data object requires a boardId, a pulseId and a column object
//Mutates an item column and returns the pulse id
mondayApi.pulse.mutate(data, token, pulseData => {
     console.log(pulseData);
});
const columnQueryData = {boardId, columnId, columnVal};
mondayApi.pulse.queryColumn(columnQueryData, token, pulseData => {
    console.log(pulseData);
});
//Send a notification to Monday with a userId, boardId, message and token
mondayApi.notification
    .sendProject(
        {userId: 16101106, boardId: 749698622},
        '"Message!"',
        token
    );
//You can grab all the pulse data under either just one or multiple groupIds
//GroupIds can either just take a string of one id or an array of group ids
mondayApi.group.getPulseData({boardId: "622641507", groupIds: ["group_title", "new_group"]}, token, pulseData => {
    console.log(JSON.stringify(pulseData));
});
userIds can be just a string of just one userId or an array of userIds
mondayApi.user.getBasicData(userIds, token, userData => {
    console.log(JSON.stringify(userData));
});
let mondayData ={
    "name" : "George",
    "person" : {"personsAndTeams":[{"id":13983951, "kind":"person"}]},
    "text": "Devloper",
};
const details = {boardId: 123456789, groupId: "group1"};
mondayApi.pulse.create(details, mondayData, token, users => {
    console.log(JSON.stringify(users));
});
mondayApi.user.getAll(token, users => {
    console.log(JSON.stringify(users));
});

Extra info

This package depends on esm and monday-sdk-js.

Make sure you install the latest version!

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago