Social Squared Online Digest Email workflow details

This article provides details about the Power Automate workflow that enables Digest Emails

You can learn how to install and use the Digest Email feature for Social Squared Online in our Knowledge Base article about that topic. This current article is for the scenario where you would like to build the flow yourself (for example, if you're unable to install an Unmanaged Solution in your environment), or if you would like to customize it beyond just changing the frequency of notifications.

Please note that we do plan to enhance this feature ourselves in coming releases, so some of the customizations mentioned here may not be necessary in the future.

This article assumes you have some basic knowledge of working with Power Automate. If you do not, our sister company NLightning can help!

Power Automate flow as of Social Squared version 4.0.0.0

Overview

The general idea is the following: At the specified frequency, all items are retrieved from the SS_EmailDigest list, which contains all users who have subscribed to Digest Emails. For each of those subscribers, items within the specified timeframe are retrieved from the SS_Posts list, and a table of those posts is emailed to that subscriber.

Action details

Modifying the frequency (Recurrence trigger) was discussed in the main article.

Get items from SS_EmailDigest:

This action uses the SSSiteName and SSEmailDigestList environment variables specified during import of the Solution package. If you are using this within that solution, you should not change these tokens. If you are building this flow yourself, you would select the SharePoint site where you're using Social Squared, and then you should see the SS_EmailDigest list in the List Name dropdown - select that. The only thing stored in this list is each subscriber's email address.

The Get past time action was discussed in the main article. The subsequent Substring action just extracts the date part from that text.

The Apply to each loop is on each item (value) in the SS_EmailDigest list:

The rest of the actions are within the Apply to Each loop.

Get items from the SS_Posts list (the main content repository of Social Squared):

Again, this action by default uses the SSSiteName and SSPostsList environment variables, but if you're not using the Solution package, you can select your own relevant SharePoint site, and this time the SS_Posts list that's on that site. The Filter Query is an OData query that retrieves only posts that meet the following criteria: Visible (or where Visible = 0 but the option to approve without moderation is enabled), and not Deleted, and Modified since the last notification - and then posts are sorted by date, newest to oldest. If you are entering this yourself, be sure to include the single quote marks around the Substring Body token.

Create HTML table creates a table of the posts that met the above criteria:

Compose - Fix HTML tags uses the following expression to adjust some HTML tags that come out of the previous step.

replace(replace(replace(replace(body('Create_HTML_table'), '&lt;', '<'), '&gt;', '>'), '&quot;', '"'), '&amp;nbsp;', '<br/>')

Compose - Styling HTML table adds some styling to the HTML table, using the output of the previous Compose. The code is copied below. If you're familiar with CSS, you can style the email table however you wish.

<style>
table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 100%;
}
thead {
  color: #fff;
  background: #0F6CBD; 
}
td, th {
  border: 1px solid #dddddd;
  padding: 8px; 
  vertical-align: baseline;
}
</style>

 

Send an email sends the output of the previous action (the formatted table) to the user's email address in this current loop of the Apply to each Email Digest subscription. Note: You will probably want to modify the Subject to reflect the frequency you have set for your recurrence. You can simply type what you wish on the Subject line.

 

 

Published July 24, 2023