OrderCloud + Microsoft Teams: Meet and Beat your Business Targets by building a better Digital Workspace

Building a digital storefront with enduring value in the new normal relies on an effective eCommerce process that streamlines reminders and notifications, including escalations to the right people on time, as delayed responses & missed actions directly impact business targets. The new OrderCloud Teams App notifies your teams of the updates on Orders, Products, Inventory, Promotions, etc, instantaneously with desired actions and insights that accelerate productivity & efficiency.

This Integration automates communications to Buyers, Sellers & Suppliers for,

  • Order Submissions
  • Order Status Changes
  • Order Approvals/Rejections
  • Product Creation/Modification/Deletion
  • Pricing Schedule changes
  • User Creation/Modification/Deletion
  • Inventory Updates – Low Stock Reminders
  • Promotions Expiry Reminders
  • Awaiting Approval Reminders

This blog details the steps involved in setting up the TeamConnect for OrderCloud Microsoft Teams App, the associated OrderCloud Webhooks, and Azure Function App to configure notifications to Teams Web/Desktop/Mobile Apps.

PREREQUISITE:
This Integration requires an active Azure Subscription where an Azure Function App can be created, which will be invoked by the OrderCloud Webhooks. The Function App prepares and sends notifications to the Teams Channel.

TEAMS APP SETUP:

  • Create Teams Channel(s) in Microsoft Teams with the intended buyers/sellers/suppliers
  • Update the Channel Notification Settings if required
  • Repeat the below steps for all the Teams Channels
    • Navigate to the ‘Apps’ tab of Microsoft Teams
    • Search for ‘TeamConnect for OrderCloud’ 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 (this TeamsWebhook URL will need to be specified in the Settings and Postman Variables section during OrderCloud Webhook configuration)
    • Click on the ‘Save’ button to set up the connector in the Teams Channel

AZURE FUNCTION APP SETUP:

  • Create a Function App from Azure Portal with the below options,
    • Name: Name of your choice
    • Runtime Stack: Node.js
    • Region: Region of your choice, preferably closer to the OrderCloud Hosting location
    • Operating System: Windows
    • Plan Type: Serverless
  • Copy the default API key from created Azure Function (this will be used in the OrderCloud Webhook Configuration step)
  • Azure Function requires a Storage Account for managing the triggers and logging. You may utilize your existing storage account or create a new one and add the blob storage connection string to ‘AzureWebJobsStorage’ app setting in the Function App

ORDERCLOUD WEBHOOK CONFIGURATION:

    • Launch the Postman Web/Windows app by selecting ‘Run in Postman’ link from the below URL,
      https://documenter.getpostman.com/view/20395702/2s83KadMin
    • Import the Postman Scripts to your Workspace
    • Populate all the collection variables
      • Specify the Teams Webhook URLs captured from the Teams App Configuration page for sellerTeamsWebhookUrl, supplierTeamsWebhookUrl, and buyerTeamsWebhookUrl collection variables
      • Specify the Middleware API Client ID & Secret in clientID, clientSecret collection variables
      • Specify a custom webhook secret for ‘webhookSecret’ collection variable
      • Retrieve the Azure Function URL from the Azure portal and specify in azureFunctionHostUrl collection variable
      • Retrieve the API Key from the API Keys section of Azure Function App and specify in azureFunctionAPIKey collection variable
      • Populate the sellerApiClientID, buyerApiClientID, middlewareApiClientID collection variables
    • You may modify the Webhooks by updating the individual scripts if needed
    • Click on ‘Run’ button to execute the scripts, which will create the webhooks and a dedicated API client for Reminders notifications in the portal
    • Create a Client Secret for the new Reminders Trigger Api Client
    • Reminders can be disabled/enabled by configuring the ‘AzureWebJobs.Reminders-TimerTrigger.Disabled’ setting in the Function App

AZURE FUNCTION APP DEPLOYMENT & CONFIGURATION:

  • Clone the OrderCloud Teams GitHub Repo,
    https://github.com/SubbuRamanathan/ordercloud-microsoft-teams-integration
  • Launch the codebase in Visual Studio Code to update the configurations and deploy it to Azure Function App by following the below steps
  • Review and update the default texts, links, sitemap URL, etc. in the templates under the templates folder as needed
  • Team notification’s background or icons can be updated in the images folder
  • Populate the settings as needed
    • Specify the Client ID and Secret of the new Reminders Scheduler API Client in ORDERCLOUD_API_CLIENTID and ORDERCLOUD_API_CLIENTSECRET
    • Specify the ‘webhookSecret’ you mentioned in the Postman collection variables for OC_WEBHOOK_HASH_KEY
    • Specify the TeamsWebhook URL(s) copied from the Teams App Configuration page for Reminders.Approval.ConnectorUrl, Reminders.Promotion.ConnectorUrl and Reminders.Inventory.ConnectorUrl to receive the respective reminders in the appropriate channel
  • Reminders will be triggered at 10 AM by default and can be updated here if needed
  • Execute the following commands from VS Code Terminal
    • npm install azure-functions-core-tools@4 -g
    • npm install
  • Install the Azure CLI from https://aka.ms/installazurecliwindows
  • Launch a new Powershell Window as Administrator, navigate to your cloned repository path and execute ‘az login’ command (you can optionally include the –tenant attribute if you have more tenants associated with your login)
  • Log in with your Azure Portal credentials when asked to do it from a Browser Window
  • Deploy to Azure Function App by executing the following command from the same Powershell Window(alternatively, you could use the Azure Function App extension in VS Code to deploy, but the settings have to be manually created in Azure Portal)
    • func azure functionapp publish <NAME OF YOUR FUNCTION APP> –publish-local-settings
      (Select no for overwriting existing Azure settings when asked)

CUSTOMIZATIONS:

  • Each element in the notification, including Title, Subtitle, Facts, Actions, and Icon/Image, can be customized in the respective OrderCloud Webhook’s configuration data
    • Title, Subtitle & Actions supports tokens(Eg: ${FirstName}), to add user-specific values in the notifications
    • Facts can be updated to add any parameter available in the OrderCloud Webhook response. The parameters should be delimited by ‘|’.
  • Search queries for the reminders can be configured in the settings file for optimal notifications
  • Background Image, Button Color, or Text Color can be updated in the settings file

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

Source Code for this module is available on 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!

Leave a Reply

Your email address will not be published. Required fields are marked *