monday-api-client
v1.0.18
Published
Easy to use client for talking to the Monday.com API.
Downloads
10
Maintainers
Readme
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!