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, so when a new person is added to the board, they will be sent a notification with pre-defined content.
As a sales manager, I want to send notifications to any of my sales team when I add them to an item on my board so that I can send them pre-defined instructions on how to proceed with the sale.
To configure this script to run against your selected board, complete the following steps below:
When a user is added/removed from the selected People column, the template script logs out all the user IDs and names. It will then send each user a custom notification.
Steps to trigger the script:
You could modify the script to send the user details to an external tool such as Google Sheets or Salesforce.
import { PeopleValueReturnType } from '@managed-api/monday-core/definitions/columnValueFragments/peopleValue';
import { UpdatePersonEvent } from '@sr-connect/monday/events';
import Monday from './api/monday';
export default async function(event: UpdatePersonEvent, context: Context): Promise<void> {
if (context.triggerType === 'MANUAL') {
console.error('This script is designed to be triggered externally or manually from the Event Listener. Please consider using Event Listener Test Event Payload if you need to trigger this script manually.');
return;
}
// Extract necessary parameters from the event
const { pulseId, columnId } = event.event;
// Check if the necessary parameters are present in the event
if (!pulseId) {
throw Error('Pulse ID not present in the event');
}
if (!columnId) {
throw Error('Column ID not present in the event');
}
// Fetch the column data for the item.
const itemsQueryResult = await Monday.Item.getItems({
args: {
ids: [pulseId]
},
fields: {
column_values: {
args: {
ids: [columnId]
},
fields: {
id: true
},
fragments: { // use fragments to define the sub-fields we want returned for the People columns value
PeopleValue: {
persons_and_teams: {
fields: {
id: true
}
}
}
}
}
}
});
// Convert the column value to the expected `PeopleValueReturnType` type for a People field.
// We simply request the first index of the `column_values` list here as that is the only column we requested in the above `getItems` API call.
const peopleValueReturnType = itemsQueryResult.data.items[0].column_values[0] as PeopleValueReturnType;
// get all the person ids selected in the People column
const personIds = peopleValueReturnType?.persons_and_teams?.map(persons => persons.id);
if (!personIds || personIds?.length === 0) {
console.log(`No person ids found for the People column with id ${columnId}`);
return;
}
// log out the person ids
console.log(personIds);
// Use the ids obtained above to get more data on the assigned persons via the Users API.
const personData = await Monday.User.getUsers({
args: {
ids: personIds
},
fields: {
id: true,
name: true
// Add more fields here as desired.
}
});
// log out the id and name of each person
console.log(personData.data);
// Send personalised notifications to each person
for (const person of personData.data.users) {
const notificationMessage = `Hi ${person.name}, please can you follow up with this sales lead before the end of the day`;
await Monday.Notification.createNotification({
args: {
user_id: person.id,
target_id: pulseId,
target_type: 'Project',
text: notificationMessage
},
fields: {
text: true
}
});
}
}