Blog

How to Build a SharePoint Chatbot Can Transform Your Workflows

sharepoint chatbot
sharepoint chatbot
sharepoint chatbot

Automation is reshaping the way businesses operate, and chatbots are at the forefront of this transformation. More organisations are integrating chatbots into their workflows to streamline communication, improve customer service, and reduce manual tasks.

According to Microsoft’s latest statistics, SharePoint serves over 200 million users globally, making it one of the most widely deployed business solutions. Given SharePoint’s position as a widely adopted business collaboration platform, developing a Power Automate chatbot for SharePoint is an ideal way to enhance user interaction and automate repetitive tasks.

Yet, many organizations struggle with user adoption and efficient information retrieval within their SharePoint environments. This is where intelligent chatbots step in, transforming how users interact with SharePoint’s vast repository of information and workflows.

This article will delve into how you can build and deploy a SharePoint chatbot seamlessly into an existing SharePoint ecosystem, and explore different frameworks, tools, and best practices. Let’s begin.

What is a Chatbot?

A chatbot is an AI-powered software application that simulates human conversation to assist users in tasks, answer queries, and automate processes. You can deploy it on various platforms such as websites, applications, and messaging services.

Explore our
Services & Solutions

Are you looking for specific SharePoint requirements?

The two primary types of chatbots are:

Rule-based chatbots – Operate on predefined scripts and respond based on specific keywords.

AI-driven chatbots – Use Natural Language Processing (NLP) and Machine Learning (ML) to provide more dynamic and context-aware responses.

What is a SharePoint Chatbot?

A SharePoint chatbot represents the convergence of artificial intelligence and Microsoft’s collaborative platform, creating an intelligent interface that understands and responds to user queries in natural language. These sophisticated digital assistants go beyond simple question-and-answer interactions, offering capabilities that can transform how organizations utilize their SharePoint environment.

At its core, a SharePoint chat implementation serves as a bridge between users and the platform’s vast functionality. Instead of navigating through multiple pages or searching through documents, users can simply ask the bot for what they need. This natural interaction method significantly reduces the learning curve associated with SharePoint adoption and improves overall user experience.

 

Key capabilities of modern SharePoint chatbots include:

  • Natural language processing for understanding user intent
  • Context-aware responses based on user roles and permissions
  • Integration with existing SharePoint workflows and processes
  • Ability to handle complex queries across multiple SharePoint sites
  • Automated document retrieval and information access
  • User authentication and security compliance
  • Multi-language support for global organizations

The impact of implementing a power automate chatbot in SharePoint environments extends beyond mere convenience. Organizations report significant improvements in:

  • Employee productivity through faster information access
  • Reduced IT support tickets for routine SharePoint queries
  • Enhanced user adoption of SharePoint features
  • Streamlined business processes through automation
  • Improved data governance and security compliance

Bot Framework SDKs and Development Tools

Creating an effective power automate chatbot requires the right set of tools and frameworks. Microsoft’s Bot Framework SDK provides a robust foundation for developing intelligent conversational experiences. Understanding these tools is crucial for successful implementation.

The Bot Builder SDK for .NET

The Bot Builder SDK for .NET stands as the primary development tool for creating SharePoint chatbots. It provides libraries, samples, and tools to build bots capable of handling freestyle interactions and guided conversations. This framework leverages C# to provide developers with a familiar environment for bot development. Key advantages include:

  • Comprehensive libraries for natural language processing
  • Built-in dialog management systems
  • Integration with Azure Cognitive Services
  • Robust security and authentication features
  • Scalable architecture for enterprise deployments

 

Development Prerequisites

Before beginning the development process, ensure your environment includes:

  • Visual Studio 2017 or later with the latest updates
  • Bot Framework SDK for .NET
  • Azure subscription for deployment
  • Bot Framework Emulator for testing
  • Required project templates:
  • Bot Application template
  • Bot Controller template
  • Bot Dialog template

Setting Up Your Development Environment

  1. Install Visual Studio 2017 or later
  2. Update all Visual Studio extensions to their latest versions
  3. Download and install project templates: 
  • Bot Application template from Microsoft’s official repository
  • Bot Controller template for handling message routing
  • Bot Dialog template for conversation management

4.Configure template directories by copying these files to the Visual Studio project templates directory, typically located at %USERPROFILE%\Documents\Visual Studio 2017\Templates\ItemTemplates\Visual C#\

his SDK is particularly useful for SharePoint developers familiar with .NET, as it integrates seamlessly with SharePoint’s ecosystem.

Creating a Chatbot for SharePoint

Let’s walk through the process of creating a chatbot using the Bot Application template and the Bot Builder SDK for .NET. The development process follows a structured approach, ensuring your SharePoint chatbot meets both technical requirements and user needs.

By leveraging the Bot Application template and integrating it with the Power Automate chatbot, you can create a bot that not only responds to queries but also automates tasks like document approvals and notifications.

Step 1: Launch Visual Studio as Administrator

To ensure smooth execution and avoid permission-related issues, launch Visual Studio with the Run as Administrator option. This grants the necessary privileges for creating and managing your project files.

Step 2: Create a New C# Project

After you open Visual Studio, follow these steps:

  • In Visual Studio, click on Create a new project.
  • In the Create a new project window, search for the Bot Application template.
  • Select the Bot Application template and click Next.
  • Provide a name for your project, choose a location to save it, and click Create.

 

The Bot Application template is pre-configured with all the necessary components to build a basic chatbot, including references to the Bot Builder SDK for .NET.

Step 3: Understanding the Bot Application Template

The Bot Application template is a pre-configured project that simplifies chatbot development. It includes:

  • A reference to the Bot Builder SDK for .NET, which is essential for building bots.
  • Predefined code structures in the Controllers\MessagesController.cs and Dialogs\RootDialog.cs files for handling messages and conversations.
  • Integration with Microsoft.Bot.Builder NuGet package provides the necessary libraries and tools.

With this template, you save considerable time and effort, as it eliminates the need to write code from scratch.

 

Step 4: Manage NuGet Packages

To ensure your project uses the latest version of the Bot Builder SDK, follow these steps:

  • In Solution Explorer, right-click on your project name.
  • Select Manage NuGet Packages from the context menu.
  • In the NuGet Package Manager, navigate to the Browse tab.
  • In the search box, type “Microsoft.Bot.Builder” and press Enter.
  • From the search results, locate the Microsoft.Bot.Builder package.
  • If an update is available, click the Update button next to the package.   

Updating the SDK ensures that your chatbot runs on the latest features, bug fixes, and security patches.

Step 5: Acknowledge and Complete the Update

Follow the on-screen prompts to complete the update process. This may involve accepting license agreements or confirming changes to your project configuration.

Once the update is complete, rebuild your project to ensure all dependencies are correctly resolved.

 

Step 6: Explore the Prebuilt Code

The Bot Application template provides a fully functional chatbot without requiring additional code. Here’s how it works:

  1. MessagesController.cs: This file contains the Post method, which handles incoming user messages. It acts as the entry point for all user interactions.
  2. RootDialog.cs: This file contains the MessageReceivedAsync method, which processes the user’s message and generates a response.

By default, the bot echoes back the user’s message in the following format:

Echoed Message Format: You sent @@, which was $$ characters, where @@ represents the user’s message and $$ represents the number of characters in the message.

This prebuilt structure allows you to focus on customising your bot’s functionality rather than setting up the basics.

Step 7: Test Your Bot Using the Bot Framework Emulator

  • Download and install the Bot Framework Emulator from the official GitHub repository.
  • Launch the emulator after installation.
  • Once connected, type a message in the emulator’s chat window. The power automate chatbot will respond with an echoed message in the predefined format.

Step 8: Start Your Bot in Visual Studio

In Visual Studio, click the Run button (or press F5) to start your chatbot.

Visual Studio will:

  • Build the application.
  • Deploy the application.
  • Launch the default web browser (e.g., Google Chrome) to display the default.htm page.

You can modify the default.htm file to customise the bot’s name and description.

Step 9: Connect Your Bot to the Emulator

In the Bot Framework Emulator, type the following URL into the address bar:
http://localhost:1234/api/messages

Replace 1234 with the port number your bot is running on, if different.

Leave the Microsoft App ID and Microsoft App Password fields blank for now. These are only required when registering your bot with the Bot Framework.

Click Connect.

Step 10: Test Your Bot

Once connected, type a message in the emulator’s chat window. Your bot will respond with an echoed message in the predefined format.

To examine message details, in the emulator, click on any speech bubble in the conversation. The Details pane will display the message details in JSON format, including metadata such as timestamps, message IDs, and channel information.

Congratulations, by following these steps, you have successfully created a basic chatbot using the Bot Application template and the Bot Builder SDK for .NET. This chatbot can now handle simple interactions and echo user messages.

 

Registering the Bot on Microsoft Bot Framework & Publishing it in the Azure Web App

The next step in building a SharePoint chatbot is to register it on the Microsoft Bot Framework and publish it to an Azure Web App. This process makes your bot accessible in the cloud and integrates it with SharePoint and other platforms.

Step 1: Prerequisites

Before proceeding, ensure you have:

  • Administrative access to a Microsoft Azure subscription.
  • A web app created in Azure to host your bot.

Step 2: Create a Web App in Azure Bot Service

  1. Sign in to Azure: Go to the Azure Portal and log in with your credentials.
  2. Create a New Web App:
  • In the Azure Portal, Select New in the menu blade
  • Navigate to the Web + Mobile category and select Create below Web App.
  • Fill in the required details:
  •  App name: Choose a unique name for your web app. This name will be part of the URL (e.g., neologixbot.azurewebsites.net).
  • Subscription: Select your Azure subscription.
  • Resource Group: Create a new resource group or select an existing one.
  • Operating System: Choose Windows.
  • Region: Select the region closest to your users.

 

  • Click Review + Create, then Create to deploy the web app.

 

3.Verify Deployment:

  • Once the deployment is complete, click the Notifications bell icon to confirm the status.
  • A tile for your web app will appear on the Azure dashboard. Click it to access the Overview page.

 

4.Test the Web App URL:

  • In the Overview section, locate the URL of your web app
  • Open the URL in a new browser tab to verify it’s working.

 

Step 3: Register Your Bot on the Microsoft Bot Framework

  1. Go to the Bot Framework Portal: Visit https://dev.botframework.com/ and sign in with your Microsoft account.
  2. Register Your Bot:

Click on My Bots and then Register.

  • Fill out the Bot Registration form with the following details:
  •   Bot name: Enter a name for your bot.
    Messaging endpoint: Use the URL of your Azure web app followed by /api/messages (e.g. https://neologixbot.azurewebsites.net/api/messages)
  • Ensure the endpoint uses HTTPS for secure communication.

 

Step 4: Create App ID and Password

Create an app ID and password for the bot so it can authenticate with the Bot Framework.

  1. Generate App ID and Password:
  • In the Bot Registration form, click Create Microsoft App ID and password in Register your bot with Microsoft to generate a new App ID and password under Configuration.
  • A new window will open to generate the App ID. Copy the App ID and store it securely.
  • Click Generate an app password to create a password. Copy and securely store this password as well.    

 

2.Complete Registration:

  • Return to the Bot Framework Portal and paste the App ID into the designated field.
  • Agree to the Terms of Use, Privacy Statement, and Code of Conduct.
  • Finally, click Register to complete the process.
  • A dialog saying Bot created appears. Click OK. The bot is now ready, registered with the Bot Framework, deployed to the cloud, and is fully functional.

3.Verify Registration:

Once registered, your bot will appear under My bots in the Bot Framework Portal.

  • The system will redirect you to the bot’s dashboard, where you can manage settings and channels.

Step 5: Link Your Code to the Registered Bot

  1. Update Web.config File:
  • Open your bot project in Visual Studio.
  • In the Web.config file, locate the following keys:
  • BotId: Replace the placeholder with your bot’s handle (name).
  • MicrosoftAppId: Paste the App ID you generated earlier.
  • MicrosoftAppPassword: Paste the App Password you generated earlier.

2. Save the changes and rebuild your project to apply the updates.

Step 6: Publish Your Bot to Azure

  1. Publish from Visual Studio:
  • Right-click on your project in Solution Explorer and select Publish.

 

  • Choose Microsoft Azure App Service and click Select Existing.

 

  • Select your Azure web app and click OK.
  •  

2. Verify Deployment:

  • Once the publishing process is complete, Visual Studio will redirect you to the web app’s URL.

 

  • This confirms your bot is successfully hosted in Azure.

Step 7: Test Your Published Bot

  1. Use the Bot Framework Portal:
  • Go to your bot’s dashboard in the Bot Framework Portal.
  • In the Test section, type a message in the chat window and check if the bot responds.

[insert screenshot]

2. Verify Echoed Messages:

  • If the bot is functioning correctly, it will respond with the echoed message format:
  • Echoed Message Format: You sent @@, which was $$ characters, where:

@@ represents the user’s message.
$$ represents the number of characters in the message.

Step 8: Configure Channels

  • To add communication channels, navigate to the Channels section in the Bot Framework Portal.
  • By default, the system enables the Web Chat and Skype channels.
  • You can add additional channels like Microsoft Teams, Slack, or Facebook Messenger as needed.

Enabling the Bot within SPFx

The final step in integrating your SharePoint chatbot is to enable it within the SharePoint Framework (SPFx). This enables your power automate chatbot to embed directly into SharePoint sites, giving users seamless access to its features. Follow these steps to integrate your bot into SPFx.

Step 1: Generate a SharePoint Framework Application

  1. Open Windows PowerShell: Launch PowerShell with administrative privileges.
  2. Execute the following command to start the SharePoint Framework Solution Generator: @microsoft\sharepoint
  3. Provide the required details:
  • What is your solution name?: Enter the solution name
  • Where do you want to place the files?: Choose Create a subfolder with a solution name.
  • Do you want to allow tenant admin to deploy apps to all sites?: Select Yes.
  • Which type of client-side component to create?: Choose WebPart.
  • What is your WebPart name?: Enter the name
  • What is your WebPart description?: Enter the description
  • Which framework would you like to use?: Select No JavaScript Framework.

[insert screenshot]

4.Once you provide all the details, the solution generates successfully.

Step 2: Open the Generated Web Part in Visual Studio Code

  1. Navigate to the folder where you created the solution.
  2. Open the folder in Visual Studio Code.

Step 3: Integrate Bot Framework Web Chat with SPFx

  1. Open the Web Part File
  2. Fetch the Web Chat Embed Code
  • Go to the Bot Framework Portal and locate your bot.
  • Under Connect to channels, click Edit on the Web Chat channel.
  • Copy the Embed code under Default SharePoint Site.

[insert screenshot]

3.Update the Web Part Code

  • Locate the innerHTML property in the .ts file.

 

  • Replace the default code with the iframe code you copied from the Bot Framework Portal.
  •  In the Bot Framework Portal, under Default Site, click Show to reveal the Secret Key. Copy the secret key.

[insert screenshot]

5.In the .ts file, locate the placeholder YOUR_SECRET_HERE. Replace it with the Secret Key you copied. Save the file.

 

Step 4: Test the Web Part Locally

  1. In Windows PowerShell, navigate to the root folder of your SPFx solution and Run the gulp serve command. This will launch the SharePoint Workbench in your default browser.
  2. Add the Web Part to the Workbench:
  • In the SharePoint Workbench, click the + symbol to add a new web part.
  • Select the bot web part from the list.

3.Test the Bot:

  • The integrated Web Chat will appear in the web part.
  • Type a message in the chat window and verify the bot’s response.

 

4.If the chat window is too small, adjust the iFrame size in the code to display the full chat interface.

Conclusion

Building a SharePoint chatbot is no longer a daunting task, thanks to tools like the Bot Builder SDK for .NET and seamless integrations with power automate chatbot. These chatbots can revolutionise how businesses interact with SharePoint, automating tasks, improving efficiency, and enhancing user experiences.

At Neologix, we specialise in custom SharePoint solutions and can help develop chatbot solutions tailored to your business needs. With over 20 years of experience in SharePoint and IT solutions, our team of experts will collaborate closely with you to design, develop, and deploy a chatbot that integrates seamlessly into your operations with minimal disruption.

Ready to take your SharePoint implementation to the next level with a chatbot? Contact us today at info@neologix.ae or +971-521043226 for a detailed consultation.

One Response

Do You Want To Boost Your Business?

Drop us a line and keep in touch

CTA-News

Discover more from Neologix UAE

Subscribe now to keep reading and get access to the full archive.

Continue reading

Get In Touch

We’d Love To Hear From You !

ipad