Send Notification

🚨 Stay informed with notifications sent using specific settings.

This function sends a notification to the user when a certain event occurs within the system. You need to send the following parameter inside the function:

  • message: The main message content of the notification.
  • redirectUrl: The URL to which the recipient will be redirected when interacting with the notification.
  • topic: The general topic of the notification.
  • subTopic: A more specific topic related to the notification.
  • audience: The audience who will receive the notification.
🚧

Warning

Note:

topic, subTopic, and audience are mandatory fields.

async function script(C){
    const currentEntry = await C.getCurrentEntry();
    
    return C.sendNotification({
         payload: {
            message: `Version 1.0.0 is out now. 
\${currentEntry.recordValueId}`,
            metadata: {
                redirectUrl: `/app/records/\${currentEntry.recordId}/view/\${currentEntry.recordValueId}`,
            },
            topic: "COMMUNICATIONS",
            subTopic: "EMAIL_REPLY",
        },
        audience: "ALL_SYSTEM_USERS",
    })
}

Topic

Available topic values are COMMUNICATIONS & BULK_ACTIONS.

Subtopic

Available subtopic values are EMAIL_REPLY & CSV_IMPORT.

Audience

Available audience values are:

  • USER

Sends a notification to a particular employee that you set the value to. Put in an extra parameter as employeeId in the notification payload as shown below.

return C.sendNotification({  
         payload: {...},  
         audience: "USER",  
         employeeId: 123  
    })
📘

Note

Info:

employeeId refers to the entryId of the employee within the system.


  • ROLES

Sends notifications to users with roles specified by the roleIds parameter (accepts an array of strings).

return C.sendNotification({  
         payload: {...},  
         audience: "ROLES",  
         roleIds: [“191”,”201”]  
    })

  • CUSTOMER

Sends notifications to all employees within an instance.

return C.sendNotification({  
         payload: {...},  
         audience: "CUSTOMER”  
})

  • ALL_SYSTEM_USERS

Sends notifications to all users within the system.

return C.sendNotification({  
         payload: {...},  
         audience: "ALL_SYSTEM_USERS"  
    })

Output

This function will return a notification with a message to the specified audience.

📌 Need Help?


If you require assistance or encounter any issues, please don't hesitate to contact us for further support.