Send periodic report for monday.com board item status changes


Get Started

Not the template you're looking for? Browse more.

About the template


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). Get started to learn more.

About ScriptRunner Connect


What is ScriptRunner Connect?

ScriptRunner Connect is an AI assisted code-first (JavaScript/TypeScript) integration platform (iPaaS) for building complex integrations and automations.

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


README

Scripts

TypeScriptnotifySummaryOfItemsThatChangedStatusInAGivenWeek
Scheduled

README


๐Ÿ“‹ Overview

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).

๐Ÿ–Š๏ธ Setup

Follow these steps to configure the template with your board:

  1. Open the Send a weekly notification reporting status changes of items in a board template.
  2. Click Create a Workspace on the top right corner of the screen.
  3. Review the Workspace name, Description and Add to a team fields. You can change these if needed.
  4. Click Create.
  5. On the left side of the screen, under API Connections, select Complete API Connection Setup.
  6. Select your monday.com connector in the Uses connector field.
  7. Click Save.
  8. On the left side of the screen under Scheduled Triggers, select Create new Scheduled trigger.
  9. Configure the Scheduled Trigger section based on your need. You can choose any interval and update NUMBER_OF_DAYS_TO_SUMMARIZE to match your schedule.
  10. Select the notifySummaryOfItemsThatChangedStatusInAGivenWeek from the script to run dropdown.
  11. Click Save.
  12. Navigate to 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.
  13. Click Save.

๐Ÿš€ Usage

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.

Remarks

This can also be used as a starter script to summarize information for a given time period. E.g. Summary of costs, efforts etc.

API Connections


TypeScriptnotifySummaryOfItemsThatChangedStatusInAGivenWeek

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;
}
Documentation ยท Support ยท Suggestions & feature requests