Sitecore + Microsoft Teams: Accelerating remote collaboration across your digital eco-system 

The global shift to remote working poses a wide variety of challenges, from inevitable delays in content deliveries, communication transparency, to traceability, quality, efficiency, etc. Sitecore + Teams Integration connects teams in the new virtual workspace with its rich instant notifications, actions & valuable insights.


This Integration includes Sitecore Connect+  Microsoft Teams App and Sitecore SPE Module that can be installed from the below links,
Sitecore+MicrosoftTeams(Sitecore-9.2+)-v2.0.zip
Sitecore+MicrosoftTeams(Sitecore-9.0-9.1)-v2.0.zip
subburamanathan/sitecore-microsoft-teams-integration:1.0.0.0-1809

This blog details the steps involved in setting up the Microsoft Teams App and Sitecore SPE Module for receiving workflow and publish notifications in Microsoft Teams Desktop/Web/Mobile Apps.

PREREQUISITE:
This module is built on top of Sitecore Powershell Extensions (SPE), please make sure SPE is installed before installing this module.

TEAMS APP SETUP:

  • Create a Teams Channel in the Microsoft Teams with the intended content authors/administrators
  • Update the Channel Notification Settings if required
  • Navigate to the ‘Apps’ tab of Microsoft Teams
  • Search for ‘Sitecore Connect+’ app and click on ‘Add to a Team’
  • Select the new Teams Channel and click on ‘Set up a Connector’
  • Copy the webhook URL from the Teams Configuration page launched
  • Click on the ‘Save’ button to set up the connector in the Teams Channel

SITECORE SPE MODULE INSTALLATION:

  • Install one of the above mentioned Sitecore packages in your Sitecore Instance depending on your Sitecore version
  • Alternatively, the Docker Asset Image can also be used

WORKFLOW/PUBLISH NOTIFICATION SETTINGS:

  • From the Sitecore Launchpad, select the ‘Microsoft Teams Integration’ tile to launch the Sitecore module configuration page
  • Click on ‘Add New Teams Endpoint’ and enter the webhook URL copied from the Teams  Configuration page
  • Click on the ‘Test’ link to ensure that the connector is set up successfully. A TEST notification will be received in the Teams Channel.
  • Select the Workflow commands for which you would like to receive notifications in Teams from the Workflow tab
  • Select the content locations for which you would like to receive notification in Teams if the item(or its subitem) or at least one of its/subitem’s referrers is published.
  • Click on the ‘Create’ button to complete the notification settings configuration for the Teams Channel

OPTIONAL SETTINGS:

  • Create PageSpeed Insights API Key using the below link and update the same in the Settings tab to receive insights on Performance, Accessibility, SEO, etc.,
    https://developers.google.com/speed/docs/insights/v5/get-started
  • Update the Sitemap or Sitemap Index Url in the Settings tab to enable ‘Request Google Indexing’ feature in publish notifications
  • Ensure to select your preferred content editors(Eg: Horizon, Content Editor etc.) in the Settings tab to render only the required actions in the notifications
  • Update the Background Image, Button Color, or Text Color in the Appearance tab to match your branding

IMPORTANT:

  • Use profile pictures that are 48×48 dimensions in Sitecore User Manager
  • Ensure TargetHostName & LanguageEmbedding properties are set for your Sitecore sites in site config
  • Create/Update the default notification templates if required from the below path,
    /sitecore/system/Modules/PowerShell/Script Library/Sitecore + Microsoft Teams Integration/Message Templates
  • Due to certain limitations, mobile app might not display certain features
  • Performance Scores might have little variations between each run (as the server response times for individual requests won’t be exactly the same every time)

KNOWN ISSUE:
There are chances that you might encounter the below ‘Stack Empty’ issue while configuring the notifications in Sitecore. Please try again after some time or remove the conflicting handlers mentioned in the below article to get rid of this issue,
https://github.com/SitecorePowerShell/Console/issues/1215

As a best practice, create individual endpoints/channels for different teams with only the intended workflow commands/publish content locations to reduce noise and improve work efficiency.

Source Code for this module is available in Github. This module is built for the Sitecore community and doesn’t require any license. This module doesn’t collect any of your information. Please check out and let me know if you have any feedback/issues/feature requests here. Thank you for using this module!

Happy Remote Working!

Launching Published Content Delivery Website URL for Page Items straight from Sitecore Content Editor

An efficient content authoring experience is crucial for the success of any Sitecore Implementation. Accelerating the authoring process by automating possible areas of authoring and publishing workflows, improves the efficiency of content authoring thereby helping content authors realize its exceptional value.

It is quite common that a content author will need to switch between CMS and Website to view/update content. Bridging the gap between CM and CD, allows seamless navigation and improves productivity.

Sitecore Powershell Extensions, makes this much easier with its Content Editor Integration Point and Invoke-JavaScript cmdlet. This blog covers the steps involved in setting up this Content Editor button.

STEPS TO CREATE POWERSHELL MODULE
Powershell Module(Eg: ‘Published Page Viewer’) can be created under /sitecore/system/Modules/PowerShell/Script Library using ‘Module Wizard’ Insert Option,

Ensure to select the ‘Content Editor’ Integration Point while creating the module,

Remove the items under Ribbon item except ‘Publish’. Build the following tree structure under ‘Published Page Viewer’ module item based on templates/insert-options indicated below,

  • Content Editor
    • Ribbon
      • Publish (PowerShell Script Library)
        • Publish (PowerShell Script Library)
          • View Published Page (PowerShell Script)

 

Below PowerShell Script shall be copied into the ‘Script body’ field of above created ‘PowerShell Script’ item,

IMPORTANT: Ensure that the Targethostname attribute of the site(s) in the site config (or Site Definition Item in case of SXA) holds the CD Domain, for this script to work as expected. If Targethostname doesn’t hold CD Domain, CD Domain can still be hard-coded in this script but not recommended. This script might need to be optimized if the default site resolving flow has been customized in the implementation.

Update the ‘Show Rule’ field in the Script Item to add ‘where the item has a layout’ rule, to ensure that the ‘View Published Page’ button appears only for page items.

Navigate to ‘PowerShell ISE’ from Sitecore LaunchPad. Select the ‘Settings’ tab and choose ‘Sync Library with Content Editor Ribbon’ from ‘Rebuild All’,

‘View Published Page’ option should now be available within the ‘Publish’ Chunk of the ‘Publish’ tab, using which Content Authors can navigate to respective CD URLs directly.

Happy Authoring!

Automating Sitemap Submissions to Google & Bing using Sitecore Powershell Extensions

Keeping Search Engines apprised of the content updates(additions/modifications/removals) is crucial for businesses to amplify user acquisition and to improve user experience. While Google’s scheduled recrawl may take up to weeks for scanning certain sites again, it is recommended to notify Google of essential content updates early to drive the needed traffic to gain maximum possible value.

NOTE: If the site holds short-lived content like live events, jobs, etc., you will also be able to benefit from Google Indexing API. This blog describes how to integrate Google Indexing API with Sitecore Publish.

With Sitecore Powershell Extensions, Sitemaps can be submitted to Search Engines’ Ping services quickly and flexibly.

STEPS TO CREATE POWERSHELL MODULE
Powershell Module(Eg: ‘SEO’) can be created under /sitecore/system/Modules/PowerShell/Script Library using ‘Module Wizard’ Insert Option,

Ensure to select the ‘Content Editor’, ‘Tasks’ and ‘Shared Functions’ Integration Points while creating the module,

Remove the items under Ribbon item. Build the following tree structure under SEO module item based on templates/insert-options indicated below,

  • Content Editor
    • Ribbon
      • SEO (PowerShell Script Library)
        • Sitemap (PowerShell Script Library)
          • Submit (PowerShell Script)
  • Functions
    • Invoke-PingService (PowerShell Script)
    • Submit-Sitemap (PowerShell Script)
  • Tasks
    • Submit Sitemap (PowerShell Script)

 

Below PowerShell Scripts shall be copied into the ‘Script body’ field of above created ‘PowerShell Script’ items,

Ensure to update the live site’s sitemap URL(s) within the above Submit-Sitemap function.
Navigate to ‘PowerShell ISE’ from Sitecore LaunchPad. Select the ‘Settings’ tab and choose ‘Sync Library with Content Editor Ribbon’ from ‘Rebuild All’,

‘Submit’ option should now be available within the ‘Sitemap’ Chunk of the new ‘SEO’ tab, using which Content Authors can make on-demand Sitemap submissions to Google, Bing, Yahoo, and DuckDuckGo Search Engines.

STEPS TO CREATE POWERSHELL SCHEDULED TASK
A Powershell Scripted Task can be created under /sitecore/system/Tasks/Schedules from Insert Options to automate submissions at a scheduled frequency,

The schedule frequency can be anywhere between few hours to few days for the site depending on the frequency of content updates happening and how frequently Google crawls the site (can be identified from the Google Search Console). Ideally, the Google bot crawl rate shouldn’t affect the site performance. If needed crawl rate can be optimized as per this documentation.

Bing’s index covers Yahoo and DuckDuckGo search engines, hence they do not require dedicated sitemap submissions.

Ensure that the lastmod field for the URL(s) are up-to-date in Sitemap file, as Google uses this field to determine if an URL is modified and if it requires crawling. It may take few minutes to few hours for the Search Engine bots to crawl the site once the request is submitted. Once Search Engine starts crawling sitemap, ‘Last read’ value gets updated with the current date in the Google Search Console,

Happy Crawling!

In-Sitecore Alerts & Push Notifications: Effectively communicating Maintenance Activities to Authors & Marketers

Building a strong DevContentOps within the organization helps to keep the productivity of all teams at maximum. This module eliminates friction and enables seamless collaboration between Authors, Marketers, Developers, and Operations.

The module can be downloaded from the below links,
Sitecore Maintenance Notification-v1.0 – Sitecore Package
sitecore-maintenance-notification:1.0.0.0-1903 – Docker Image

Integrating the above image into CM/MSSQL Containers requires few changes to .env, docker-compose/override, and Dockerfiles of CM & MSSQL Containers, as indicated in this screenshot (build is required for the changes to reflect). Alternatively, Sitecore packages can also be installed in Docker as described here.

Key Benefits:
• Optimized delivery of maintenance alerts through in-sitecore alerts and push notifications(works even if browser is not open) with appropriate auto-expiration
• Introduces Opt-in/Opt-out flexibility for Maintenance Notifications from Sitecore Control Panel.
• Displays Maintenance Page during Maintenance to avoid confusion.
• Displays Maintenance Alerts in User’s Local Timezone.
• Enables smooth handling of any Schedule Changes and Cancellations.
• Sends reminders before outage & Completion Message immediately after warm-up to keep content freeze at a bare minimum.
• Permits modifying Scheduled Alert messages, Reminder & Completion messages, Reminder Duration, etc. quickly from Sitecore

NOTE:
This module is built on top of Sitecore Powershell Extensions (SPE), please ensure SPE(v5.0+) is installed. 

STEPS TO CONFIGURE THE MODULE:
After installing the module, navigate to ‘PowerShell ISE’ from Sitecore LaunchPad. Select the ‘Settings’ tab and choose ‘Sync Library with Control Panel’ from ‘Rebuild All’,

Below changes need to be introduced in web.config of CM instance. As a best practice, this transform file can be added to the solution. If there is any existing CM web.config transform, the below config can be appended to it.

  <location path="sitecore modules/Maintenance Notification/js/serviceworker.js">
    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <add name="Service-Worker-Allowed" value="/" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
  </location>

Module comes with default VAPID Keys but it is highly recommended to update the defaults for security reasons. New VAPID Keys can be created using web-push npm package. Below command can be executed to generate new Public/Private VAPID key pair,

npm install web-push -g
web-push generate-vapid-keys


Public Key needs to be updated in /sitecore/system/Modules/PowerShell/Script Library/Maintenance Notification/Notification Settings item. Private Key needs to be updated in the DevOps/Windows PowerShell scripts (described in the next section).

Module includes a default Sitecore API Key(works for 9.1+). But it is necessary to clone/create a new ‘OData Item API Key’ item(with same values) under /sitecore/system/Settings/Services/API Keys of master database for v9.1+ (make sure to publish to web). Item needs to be created under /sitecore/system/Settings/Services/API Keys of core database if v9.0.

For Impersonation User, it is recommended to create a new user(Eg: sitecore\MaintenanceNotification) with just read access only to the items under /sitecore/system/Modules/PowerShell/Script Library/Maintenance Notification. Item ID of this newly created ‘OData Item API Key’ item will need to be updated in DevOps/Windows PowerShell scripts (described in the next section).

FOR RECEIVING ALERTS:
Content Authors and Marketers will have to just select ‘Subscribe to Scheduled Maintenance Notifications’ of ‘Preferences/My Settings’ section of Control Panel, from normal mode of browsers (not incognito/inprivate) to receive maintenance notifications

FOR SENDING ALERTS:
DevOps team will have two options to send notifications during deployments,
DevOps Integration(Automated):
Module comes with two Powershell scripts,

The scripts require four variables. Since $sitecoreHostUrl, $vapidPrivateKey and $sitecoreAPIKey will be consistent across releases, they can be created as pipeline variables. VAPID Private Key and Sitecore API Key Item ID obtained in the above section needs to be assigned to $vapidPrivateKey & $sitecoreAPIKey. $sitecoreHostUrl will be the CM Domain Url. $maintenanceStartDateTime will need to be supplied as input for every release (Format: yyyy/MM/dd HH:mm EST  Ex:2021/01/18 10:00 EST). Script can be tweaked to accept deployment start date/time in another timezone if needed.

This script works with all the DevOps tools that support Powershell tasks. The initial demo uses Azure DevOps self-hosted agent to deploy to a windows machine.

Windows PowerShell(Manual):
Module includes a Windows PowerShell script (SendMaintenanceNotification(Optimized for Manual Notification).ps1), which can be used for sending/clearing notifications anytime without using DevOps tool.
Script requires deployment start date/time as input for every release, to send notifications accordingly. Sitecore CM Domain Url and VAPID Private Key & Sitecore API Key Item ID (created in the above section), needs to be updated in this script directly for $sitecoreHostUrl, $vapidPrivateKey, $sitecoreAPIKey variables.
This Script will automatically send scheduled alerts, reminders, and completion messages based on the input date/time to all subscribed users. Script will send notifications based on the availability of the site, hence do not close this powershell window till end of maintenance, else reminders and completion messages might be skipped.

The module configuration is now complete!

BACKGROUND:
This module leverages the following popular libraries/modules,

  • Service Worker – will be installed in the browser with on click of Subscribe button for receiving notifications. Service Worker is supported in the recent versions of all latest browsers
  • Web-push NPM Package – used for sending optimized Push Notifications.
  • IDB-KeyVal library served via cdnjs – a tiny js imported by Service Worker into users’ browsers for easy storing/retrieving of values in/from Browser IndexedDB (helps to avoid loss of data upon browser/system restart)

This module also relies on the below Sitecore services to keep the details centralized and editable from Sitecore without impacting security,

  • Sitecore ItemService – for fetching Notification Settings and storing User Subscription information received from Service Worker
  • Sitecore OData Item Service – for reading the Subscriptions from Sitecore during DevOps/Windows PowerShell script execution

TIPS:

  • In the event of maintenance cancellation, running the Manual PowerShell script without specifying any input will automatically clear notifications for all subscribed users
  • If the maintenance time or details change, sending the updated time or details through Windows/DevOps PowerShell will overwrite the previously sent details for all users
  • There are chances that a user might have removed the service worker while clearing browser data. In such cases, PowerShell script will throw subscription expired error with failed user’s subscription endpoint url. This won’t affect notifications for other users, but it is recommended to manually remove the respective subscription json(along with date) from /sitecore/system/Modules/PowerShell/Script Library/Maintenance Notification/Push Subscriptions item.
  • If authors/marketers will need more lead time, adding Agentless jobs with Manual Intervention or Delay tasks will be helpful to communicate well in advance and will also free up agents for other tasks during the wait time. Alternatively, manual approach can be used just for initial communication.
  • Service Worker will require localhost or https. In case if the implementation doesn’t meet this requirement, Invoke-AddWebFeatureSSLTask powershell command might help to get a quick self-signed certificate.
  • Notification Settings can be updated if/as needed in /sitecore/system/Modules/PowerShell/Script Library/Maintenance Notification/Notification Settings,

Source Code for this module is available in Github.

Voila!