Template Content
About the template
About ScriptRunner Connect
What is ScriptRunner Connect?
Can I try it out for free?
Yes. ScriptRunner Connect comes with a forever free tier.
Can I customize the integration logic?
Absolutely. The main value proposition of ScriptRunner Connect is that you'll get full access to the code that is powering the integration, which means you can make any changes to the the integration logic yourself.
Can I change the integration to communicate with additional apps?
Yes. Since ScriptRunner Connect specializes in enabling complex integrations, you can easily change the integration logic to connect to as many additional apps as you need, no limitations.
What if I don't feel comfortable making changes to the code?
First you can try out our AI assistant which can help you understand what the code does, and also help you make changes to the code. Alternatively you can hire our professionals to make the changes you need or build new integrations from scratch.
Do I have to host it myself?
No. ScriptRunner Connect is a fully managed SaaS (Software-as-a-Service) product.
What about security?
ScriptRunner Connect is ISO 27001 and SOC 2 certified. Learn more about our security.
Template Content
This template demonstrates how to build an automation in monday.com to periodically notify configured users about the items that have changed in the board for previous period (configurable).
Follow these steps to configure the template with your board:
NUMBER_OF_DAYS_TO_SUMMARIZE
to match your schedule.Parameters
and and edit the following parameters:BOARD_ID
- Enter the board ID that you want to check.STATUS_COLUMN_ID
- Enter the ID of the Status column value to check updates for.USERS_TO_NOTIFY
- Enter the emails of users to notify. They should have board access.NUMBER_OF_DAYS_TO_SUMMARIZE
- The number of days you want to receive summaries for. This needs to be the same period as your trigger.Once configured and saved, a notification will be sent each week on Monday, listing all items that had a status change in the configured period.
This can also be used as a starter script to summarize information for a given time period. E.g. Summary of costs, efforts etc.
import Monday from "./api/monday";
export default async function(event: any, context: Context): Promise<void> {
const { BOARD_ID, STATUS_COLUMN_ID, USERS_TO_NOTIFY, NUMBER_OF_DAYS_TO_SUMMARIZE } = context.environment.vars;
const LIMIT = 100;
let pageNumber = 1;
const fromNumberOfDaysAgo = new Date();
fromNumberOfDaysAgo.setDate(fromNumberOfDaysAgo.getDate() - NUMBER_OF_DAYS_TO_SUMMARIZE);
let updates:any[] = [];
let hasMoreEntries = true;
const users = await Monday.User.getUsers({
args: {
emails: USERS_TO_NOTIFY
},
fields: {
id: true
}
});
const userIds = users.data.users.map((user: { id: number; }) => user.id);
while(hasMoreEntries) {
// Get the last updated items from activity logs as we don't have any other way of filtering items by update date yet from monday.com
const resp = await Monday.Board.getBoards({
args: {
ids: [BOARD_ID]
},
fields: {
activity_logs: {
args: {
column_ids: [STATUS_COLUMN_ID],
limit: LIMIT,
page: pageNumber,
from: fromNumberOfDaysAgo.toISOString()
},
fields: {
data: true,
created_at: true,
entity: true
}
}
}
});
pageNumber++;
let logs = resp.data.boards[0].activity_logs;
if (logs.length < LIMIT) {
hasMoreEntries = false;
}
updates.push(...logs);
}
// format the notification message
let notificationMessage = "<b>The status of following items was updated last week:</b> <br><br>";
updates.forEach(log => {
const logData = (JSON.parse(log.data) as UpdateLog);
// Filter by item updates as activity logs also has logs from updates to status column settings
if (log.entity === 'pulse') {
notificationMessage += "Item: " + logData.pulse_name + "<br>";
notificationMessage += "Status: " + logData.value.label.text + "<br>";
notificationMessage += "Updated at: " + new Date(Number(log.created_at)/1e4).toISOString() + "<br><br>";
}
})
// create the notification for all users
for(const userId of userIds) {
await Monday.Notification.createNotification({
args: {
user_id: userId,
target_id: BOARD_ID,
target_type: 'Project',
text: notificationMessage
},
fields: {
text: true
}
})
}
}
class UpdateLog {
pulse_id: number;
pulse_name: string;
value: StatusValue;
}
class StatusValue {
label: Label;
}
class Label {
text: string;
}