This automation will send an email to a configured email address or Role with a list of Forum Thread URLs that are unanswered in the Community after x number of hours.
Version 12 download:
<automations>
<automations>
<automation name="NoResponse Threads Notifications" version="12.1.1.20160" description="This automation sends an email with a list of Forum Thread URLs that have not been answered after x number of hours." id="f624be8c283d479096e806444e857bb4" executeAsServiceUser="true" isSingleton="false" trigger="Job" schedule="00:01 Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday" lastModified="2022-04-21 17:45:32Z">
<executionScript language="JavaScript"><![CDATA[var pageIndex = 0;
var done = false;
var NoResponse = [];
var hours = core_v2_widget.GetStringValue('hours', '18');
var subject = core_v2_widget.GetStringValue('subject', core_v2_language.GetResource('Subject_Default'));
var fromEmail = core_v2_widget.GetStringValue('fromEmail', 'notset@local.com');
var toEmails = core_v2_widget.GetStringValue('toEmails', '');
var toRoleIds = core_v2_widget.GetStringValue('toRoleIds', '');
var group = core_v2_widget.GetStringValue('forumGroup', '');
core_v2_eventLog.Write("Group: " + group, { Category: "NoResponse Threads", EventId: 652384, EventType: "Warning" });
// Get Threads
while(!done){
var threads = core_v2_forumThread.List(
{
ForumThreadQueryType: 'NoResponse',
IncludeSubGroups: true,
IncludeDiscussions: false,
PageIndex: pageIndex,
PageSize: 100,
SortBy: 'Date',
SortOrder: 'Descending',
GroupId: core_v2_utility.ParseInt(group)
});
core_v2_eventLog.Write("ThreadCount: " + threads.Count, { Category: "NoResponse Threads", EventId: 652384, EventType: "Warning" });
for(var t = 0; t < threads.Count; t++)
{
var hoursDiff = (Math.round(((new Date()) - threads[t].Date) / (60*60*1000))).toString();
if(hoursDiff > hours)
{
NoResponse.push(threads[t].Url);
}
}
if(threads.TotalCount <= 100 * (pageIndex + 1))
{
done = true;
}
pageIndex++;
}
var hourText = '';
if(hours > 1)
{
hourText = core_v2_language.GetResource('Hours_Text');
}
else
{
hourText = core_v2_language.GetResource('Hour_Text');
}
var body = '<b>' + core_v2_language.GetResource('EmailBodyIntroText') + ' ' + hours + ' ' + hourText + ':</b>';
for(var u = 0; u < NoResponse.length; u++)
{
body += '<p><a href="' + NoResponse[u] + '">' + NoResponse[u] + '</a></p>';
}
// Get emails to send to
var splitEmails = toEmails.split(',');
var splitRoleIds = toRoleIds.split(',');
var allEmails = [];
for(var i = 0; i < splitRoleIds.length; i++)
{
core_v2_eventLog.Write("Role Users Found: ", { Category: "NoResponse Threads", EventId: 18789, EventType: "Warning" });
var roleUsersDone = false;
var roleUsersPageIndex = 0;
var roleId = core_v2_utility.ParseInt(splitRoleIds[i]);
while(!roleUsersDone)
{
var roleUsers = core_v2_user.List(
{
PageIndex: roleUsersPageIndex,
PageSize: 100,
RoleId: roleId
}
);
if(roleUsers.Count > 0)
{
core_v2_eventLog.Write("Role greater than 0: ", { Category: "NoResponse Threads", EventId: 187489, EventType: "Warning" });
for(var r = 0; r < roleUsers.Count; r++)
{
core_v2_eventLog.Write("RoleUserEmail: " + roleUsers[r].PrivateEmail, { Category: "NoResponse Threads", EventId: 18789, EventType: "Warning" });
allEmails.push(roleUsers[r].PrivateEmail);
}
}
if(roleUsers.TotalCount <= 100 * (roleUsersPageIndex + 1))
{
roleUsersDone = true;
}
roleUsersPageIndex++;
}
}
for(var e = 0; e < splitEmails.length; e++)
{
allEmails.push(splitEmails[e]);
}
if(allEmails.length > 0 && NoResponse.length > 0)
{
for(var te = 0; te < allEmails.length; te++)
{
core_v2_email.Send(subject, body, { FromEmail: fromEmail, ToEmail: allEmails[te] });
}
}]]></executionScript>
<configuration><![CDATA[<propertyGroup id="options" labelResourceName="Options">
<property id="hours" labelResourceName="Hours_Label" descriptionResourceName="Hours_Desc">
<propertyRule name="minmax" min="0" />
</property>
<property id="subject" labelResourceName="Subject_Label" descriptionResourceName="Subject_Desc"></property>
<property id="fromEmail" labelResourceName="FromEmail_Label" descriptionResourceName="FromEmail_Desc"></property>
<property id="toEmails" labelResourceName="ToEmail_Label" descriptionResourceName="ToEmail_Desc"></property>
<property id="toRoleIds" labelResourceName="ToRoles_Label" descriptionResourceName="ToRoles_Desc" dataType="Custom" template="core_v2_roleLookup" enableCurrent="false" maxSelections="10" format="csv" />
<property id="forumGroup" labelResourceName="ForumGroup_Label" descriptionResourceName="ForumGroup_Desc" defaultValue="Group=-1" dataType="Custom" template="core_v2_groupLookup" enableCurrent="false" format="csv" />
</propertyGroup>]]></configuration>
<languageResources><![CDATA[<language key="en-us">
<resource name="EmailBodyIntroText">Threads with no response after</resource>
<resource name="ForumGroup_Desc">Select a Group to restrict the threads with no response to. The automation will only look at Threads in this Group.</resource>
<resource name="ForumGroup_Label">Select a Group</resource>
<resource name="FromEmail_Desc">The default is notset@local.com</resource>
<resource name="FromEmail_Label">From Email Address</resource>
<resource name="Hour_Text">Hour</resource>
<resource name="Hours_Desc">If a Thread has no response after the defined number of hours an email will be sent.</resource>
<resource name="Hours_Label">Hours</resource>
<resource name="Hours_Text">Hours</resource>
<resource name="Subject_Default">Thread without a response</resource>
<resource name="Subject_Desc">Email subject for the Threads with no response email</resource>
<resource name="Subject_Label">Email Subject</resource>
<resource name="ToEmail_Desc">Enter a single email or multiple emails, multiple emails should be comma delimited (test@email.com,test2@email.com).</resource>
<resource name="ToEmail_Label">To Email</resource>
<resource name="ToRoles_Desc">Enter a single role or multiple roles, multiple roles should be comma delimited (adminstrators,Users).</resource>
<resource name="ToRoles_Label">To Roles</resource>
</language>]]></languageResources>
</automation>
</automations>
<configuredAutomations>
<configuredAutomation version="12.1.1.20160" id="d64b3757702540efa4584994ffb99890" automationId="f624be8c283d479096e806444e857bb4" name="Threads with No Response" description="<p>This automation will deliver an email with a list of threads without a response to an email or users in a role specified. The automation can be configured to specific groups or choose the site root group for all groups on your community.</p>" enabled="false" lastModified="2022-04-21 17:48:07Z">
<properties>
<property id="hours" dataType="String">
<value>10</value>
</property>
<property id="subject" dataType="String">
<value>There are Threads with no response in the Community!</value>
</property>
<property id="fromEmail" dataType="String">
<value>notset@local.com</value>
</property>
<property id="toEmails" dataType="String">
<value />
</property>
<property id="toRoleIds" dataType="Custom">
<value />
</property>
<property id="forumGroup" dataType="Custom">
<value />
</property>
</properties>
</configuredAutomation>
</configuredAutomations>
</automations>
Version 11 download:
<automations>
<automations>
<automation name="Unaswered Threads Notifications" version="11.1.8.16788" description="This sends an email with a list of thread urls that have not been answered after x number of hours." id="f624be8c283d479096e806444e857bb4" executeAsServiceUser="true" isSingleton="false" trigger="Job" schedule="5m" lastModified="2022-01-13 20:50:46Z">
<executionScript language="JavaScript"><![CDATA[var pageIndex = 0;
var done = false;
var NoResponse = [];
var hours = core_v2_widget.GetStringValue('hours', '18');
var subject = core_v2_widget.GetStringValue('subject', core_v2_language.GetResource('Subject_Default'));
var fromEmail = core_v2_widget.GetStringValue('fromEmail', 'notset@local.com');
var toEmails = core_v2_widget.GetStringValue('toEmails', '');
var toRoleIds = core_v2_widget.GetStringValue('toRoleIds', '');
var group = core_v2_widget.GetStringValue('forumGroup', '');
//core_v2_eventLog.Write("NoResponseThread: Group: " + group, { Category: "NoResponse Threads", EventId: 41116, EventType: "Warning" });
if(group.substring(6) !== "1"){
// Get Threads
while(!done){
var threads = core_v2_forumThread.List(
{
ForumThreadQueryType: 'NoResponse',
IncludeSubGroups: true,
IncludeDiscussions: false,
PageIndex: pageIndex,
PageSize: 100,
SortBy: 'Date',
SortOrder: 'Descending',
GroupId: core_v2_utility.ParseInt(group.substring(6))
});
for(var t = 0; t < threads.Count; t++){
var hoursDiff = (Math.round(((new Date()) - threads[t].Date) / (60*60*1000))).toString();
if(hoursDiff > hours){
NoResponse.push(threads[t].Url);
}
}
// core_v2_eventLog.Write("NoResponseThread: Threads: " + NoResponse.length, { Category: "NoResponse Threads", EventId: 41116, EventType: "Warning" });
if(threads.TotalCount <= 100 * (pageIndex + 1)){
done = true;
}
pageIndex++;
}
var hourText = '';
if(hours > 1){
hourText = core_v2_language.GetResource('Hours_Text');
}
else{
hourText = core_v2_language.GetResource('Hour_Text');
}
var body = '<b>NoResponse Threads after ' + hourText + '</b><br/>';
for(var u = 0; u < NoResponse.length; u++){
body += '<a href="' + NoResponse[u] + '">' + NoResponse[u] + '</a><br/>';
}
// core_v2_eventLog.Write("NoResponseThread: RoleIds: " + toRoleIds, { Category: "NoResponse Threads", EventId: 41116, EventType: "Warning" });
// Get emails to send to
var splitEmails = toEmails.split(',');
var splitRoles = toRoleIds.split('&');
var allEmails = [];
// core_v2_eventLog.Write("NoResponseThread: SplitRoles Count: " + splitRoles.length, { Category: "NoResponse Threads", EventId: 41116, EventType: "Warning" });
for(var i = 0; i < splitRoles.length; i++){
var roleUsersDone = false;
var roleUsersPageIndex = 0;
var roleIdSub = splitRoles[i].substring(5);
core_v2_eventLog.Write("NoResponseThread: RoleIdSub: " + roleIdSub, { Category: "NoResponse Threads", EventId: 41116, EventType: "Warning" });
var roleId = core_v2_utility.ParseInt(roleIdSub);
var role = core_v2_role.Get(roleId);
core_v2_eventLog.Write("NoResponseThread: RoleId: " + roleId, { Category: "NoResponse Threads", EventId: 41116, EventType: "Warning" });
core_v2_eventLog.Write("NoResponseThread: RoleName: " + role.Name, { Category: "NoResponse Threads", EventId: 41116, EventType: "Warning" });
if(role.Name === "Everyone" || role.Name === "Registered Users"){
core_v2_eventLog.Write("NoResponseThread: This role is not allowed: " + role.Name, { Category: "NoResponse Threads", EventId: 41116, EventType: "Warning" });
}
else{
while(!roleUsersDone){
var roleUsers = core_v2_user.List(
{
PageIndex: roleUsersPageIndex,
PageSize: 100,
RoleId: roleId
}
);
if(roleUsers.Count > 0){
for(var r = 0; r < roleUsers.Count; r++){
allEmails.push(roleUsers[r].PrivateEmail);
}
}
if(roleUsers.TotalCount <= 100 * (roleUsersPageIndex + 1)){
roleUsersDone = true;
}
roleUsersPageIndex++;
}
}
}
if(splitEmails.length > 0){
for(var e = 0; e < splitEmails.length; e++){
allEmails.push(splitEmails[e]);
}
}
if(allEmails.length > 0 && NoResponse.length > 0){
for(var te = 0; te < allEmails.length; te++){
core_v2_eventLog.Write("RoleUserEmailSent: " + allEmails[te], { Category: "NoResponse Threads", EventId: 41116, EventType: "Warning" });
core_v2_email.Send(subject, body, { FromEmail: fromEmail, ToEmail: allEmails[te] });
}
}
}
else{
core_v2_eventLog.Write("NoResponseThread: Configured Group set to the site root, automation stopping.", { Category: "NoResponse Threads", EventId: 41116, EventType: "Warning" });
}]]></executionScript>
<configuration><![CDATA[<propertyGroup id="options" labelResourceName="Options">
<property id="hours" labelResourceName="Hours_Label" descriptionResourceName="Hours_Desc">
<propertyRule name="minmax" min="0" />
</property>
<property id="subject" labelResourceName="Subject_Label" descriptionResourceName="Subject_Desc"></property>
<property id="fromEmail" labelResourceName="FromEmail_Label" descriptionResourceName="FromEmail_Desc"></property>
<property id="toEmails" labelResourceName="ToEmail_Label" descriptionResourceName="ToEmail_Desc"></property>
<property id="toRoleIds" labelResourceName="ToRoles_Label" descriptionResourceName="ToRoles_Desc" dataType="Custom" template="core_v2_roleLookup" enableCurrent="false" maxSelections="10" />
<property id="forumGroup" labelResourceName="ForumGroup_Label" descriptionResourceName="ForumGroup_Desc" defaultValue="Group=-1" dataType="Custom" template="core_v2_groupLookup" enableCurrent="false" />
</propertyGroup>]]></configuration>
<languageResources><![CDATA[<language key="en-us">
<resource name="ForumGroup_Desc">Select a group to restrict the threads with no response to.</resource>
<resource name="ForumGroup_Label">Select a Group</resource>
<resource name="FromEmail_Desc">The default is notset@local.com</resource>
<resource name="FromEmail_Label">From Email Address</resource>
<resource name="Hour_Text">Hour</resource>
<resource name="Hours_Desc">If a thread has no response after the defined number of hours an email will be sent.</resource>
<resource name="Hours_Label">Hours</resource>
<resource name="Hours_Text">Hours</resource>
<resource name="Subject_Default">Threads with no response</resource>
<resource name="Subject_Desc">Email subject for the for threads with no response email</resource>
<resource name="Subject_Label">Email Subject</resource>
<resource name="ToEmail_Desc">Enter a single email or multiple emails, multiple emails should be comma delimited(test@email.com,test2@email.com)</resource>
<resource name="ToEmail_Label">To Email</resource>
<resource name="ToRoles_Desc">Enter a single role or multiple roles, multiple roles should be comma delimited(adminstrators,Users)</resource>
<resource name="ToRoles_Label">To Roles</resource>
</language>]]></languageResources>
</automation>
</automations>
<configuredAutomations>
<configuredAutomation version="11.1.8.16788" id="3df8ffefb21f4400ae5c1fd0df971658" automationId="f624be8c283d479096e806444e857bb4" name="NoResponse Threads" description="" enabled="false" lastModified="2022-01-13 20:52:57Z">
<properties>
<property id="hours" dataType="String">
<value>2</value>
</property>
<property id="subject" dataType="String">
<value>NoResponse Questions are Waiting for Your Review</value>
</property>
<property id="fromEmail" dataType="String">
<value />
</property>
<property id="toEmails" dataType="String">
<value />
</property>
<property id="toRoleIds" dataType="Custom">
<value>Role=4&Role=9</value>
</property>
<property id="forumGroup" dataType="Custom">
<value>Group=2</value>
</property>
</properties>
</configuredAutomation>
</configuredAutomations>
</automations>
Installation Instructions
- To import this automation please follow the documentation listed here: https://community.telligent.com/community/11/w/user-documentation/62977/how-do-i-configure-automations-for-my-community
- You will then click on "Automations" above the Automation Studio tab and click "Add"
- For the "Type of Automation" drop down, select "Unanswered Threads Notification Email"
- Configure the automation as shown below, enable it, and click save!
Configuration Options
- Schedule
- How often the automation should run. The default is set to once per day, Monday through Friday, at 8:00am.
- Hours
- The number of hours a Forum Thread has been unanswered before it is included in the email report. The default is 24 hours.
- Email Subject
- The subject of the email.
- From Email Address
- The email address that the email notification will come from.
- To Email
- Either a single email address or comma separated list of email addresses that the email will be sent to.
- To Roles
- You can scope this automation to send an email notification to all users in a specific role.
- Select a Group
- You can scope the automation to only look for unanswered Threads in a specific Group.
Automation Configuration
Automation Studio Configuration