Microsoft is on a mission to empower every person and every organization to achieve more. In a world that cries for remote-friendly solutions, there’s more demand for developers, apps, and process automation than ever before.
As part of this mission, Microsoft aims to make developer tools as accessible and inclusive than possible. These days, domain experts can implement their solutions without having expert coding knowledge. These domain experts can instead rely on Low Code solutions such as Microsoft’s own Power Platform and thus create their ideal solutions from testing to production in a matter of hours.
We – Microsoft Learn Student Ambassadors :purple_heart: and the awesome Cloud Advocates at Microsoft :avocado: – wanted to give it a shot and prove how easy it can be to create a QnA solution for the education sector, such as student clubs or societies.
Problem Domain
Let’s suppose you oversee any community (such as your school class) using popular chat apps such as Microsoft Teams or Discord. Whenever members join your community, you want them to on-board or – more specifically - verify them.
(In case you need an example: In our case, we want competitors for Microsoft Competition to verify their Discord account when they join the competition Discord server. Once verified, participants will receive broader access to the Discord server.)
Technical Considerations
As part of the project, we want to keep some crucial key aspects in mind, such as:
- Be cost effective - (building expensive solutions is easy, - Lee Stott, our mentor and Cloud Advocate)
- Use and integrate into tools already used, such as Power Platform and Microsoft Azure
- Maintainable and extendable
- Ease of deployment for students/societies using Discord
- Flat learning curve
All these considerations should make it also possible to deploy the solution for other scenarios and communities.
Technical Design
Power Virtual Agent (PVA) is a convenient low-code solution for designing your custom conversational bots. All the Artificial Intelligence is already backed in – the bot knows how to respond to your users so they can serve their needs.
Using PVA, you can design your conversations and even call custom actions so you can interact with external services. In our case, we need to interact with Discord so that we can grant roles to the user. This interaction (= our business logic) is implemented in the Bot Service + Code.
To integrate into Discord using a Channel Connector, we use Azure Functions – a serverless event-driven development platform to integrate services using triggers and bindings. Azure Functions uses an App Service plan which configures the Function's hosting environment.
You know some words, right? So basically...
- Azure Functions is a cost-effective solution for implementing small pieces of functions.
- Using Azure Functions, we can connect PVA using Power Automate which is responsible for bridging PVA with Azure Functions.
- Power Automate is a low code solution for implementing your functions. It’s like Azure Functions but you design your business logic using a node-based canvas.
If you don't intend to use Discord as the platform for your PVA solution, be sure to check out Microsoft's official channel integrations such as Microsoft Teams, WhatsApp, Telegram and many more.
The Team
We are a bunch of Gold Microsoft Learn Student Ambassadors who are passionate life-long learners:
Gold Microsoft Learn Student Ambassador | Gold Microsoft Learn Student Ambassador | Modern Apps Consultant @ Microsoft | Gold Microsoft Learn Student Ambassador | Gold Microsoft Learn Student Ambassador |
I love technology and believe that it is the route to a better world. With better management, tech and all other domains can flourish easily. Therefore, I am proud to have a grip on both, technical and managerial roles. |
I am a software developer with 10 years of experience and 4 years of professional experience. I'm profound in building full-stack projects in C#, .NET, Microsoft Azure while keeping costs, best-practices, and good software design in mind. I recently joined Microsoft as an Azure Cloud & AI Consultant. |
I am a person who loves to learn about different technologies every day. I try to keep myself busy in learning new things and share my learnings with my community members and fellow mates. My moto is to connect with the people, learn with them, motivate them and grow in a better way. I love giving talks too :p |
Maintaining a Growth Mindset can do wonders, and that's the best part about me. I am a hardworking professional who loves to motivate others about the power of technology. The inner explorer in me keeps me going upright to learn about new pieces of tech. |
As you can see in the group picture above taken with Team's Together Mode, we have had loads of fun while collaborating and doing shenanigans!
Based on each team member’s attributes we could quickly identify strengths and learning opportunities. Thanks to the Cloud Advocate’s guidance we could also create a roadmap. Using the comprehensive project timeline, we figured out that we should initially clarify all specific requirements, decide on team roles, clarify how our data looks like and how we ingest them.
With these clarifications in place, we could go ahead and spend some time on our database design, proof of concept and final implementation.
Implementation
First, we needed to clarify what kind of data we require so that participants get verified on the Discord server. This required a few draft sessions followed by some follow-ups with Microsoft.
We decided to use Microsoft SQL to store our relational data since it can be integrated into other projects, assuming they already make use of a SQL server. We wanted to split tables by normalizing them so that the administrators can easily ingest new email addresses for approval.
Next to the database design, which is kept relatively simple, we also created flow charts for the user. We wanted to define the user’s journey as they interact with the bot as follows:
Once we had the user flow in place, we could quickly iterate and implement the flow in Power Virtual Agents (PVA). PVA allows us to create topics. Each topic builds around a conversation and can be composed by using Messages, Questions and Actions.
Using this taxonomy, we could post messages to the user who invoked the conversation (=topic), ask them question and perform asynchronous operations using Actions via Power Automate. Below, you can see the flow we implemented for the verification process as stated in the beginning of this post:
The verification process is being dealt with by an external service, in this case a custom Azure Function. However, to invoke this service, we require an Action. The Action is responsible for calling our service using Power Automate. Power Automate is a service that allows you to implement No Code business logic using a design canvas, similar to PVA.
In PVA, we can create and reference our new Power Automate flow that hooks up the PVA with our Azure Functions.
Remember that we asked the user for their nickname and stored it in a variable before? The variable is being reused here and can be passed into Power Automate flow as an input parameter. Depending on the flow's outcome, we can implement a condition. If the external verification processed passed, we will let the user know. In case it doesn't, the bot will automatically escalate the issue if required.
The intersection between PVA, Power Automate, and Azure Function can be shown below. Below, you see a Power Automate flow that takes the PVA's variable input, passes it to a request call to the external Azure Function, and returns the Function's result as the output value for the PVA:
For those dealing with code, here's how the Azure Function looks like:
[FunctionName(nameof(ValidateParticipant))]
public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req)
{
// Get email address
var emailAddress = GetRequestBody(req);
if (string.IsNullOrEmpty(emailAddress))
return new BadRequestErrorMessageResult("emailAddress not given in form");
// Verify
var isRegistered = await _verificationService.IsRegisteredAsync(emailAddress);
// Return
return isRegistered ? new OkObjectResult(true) : new OkObjectResult(false);
}
It's a simple HTTP Trigger function that takes the email address and verifies it against a service that is injected via Dependency Injection.
Yep, that's how easy you can intersect these tools with each other - and the best of it: it's relatively simple and easy!
Deployment
We are aware that this solution can be dropped into other areas as well. For this reason, we implemented an Azure Bicep template for ease deployment. Azure Bicep is a domain specific language that describes the deployment resources of our project. Using this template, we can simply deploy new instances of the project whenever and wherever we like.
Ultimately, this makes it easier for you to reuse our solution and deploy it to Microsoft Azure with a single click!
Next Steps, Take Aways & Further References
Recently, we finished working on this project with these amazing Cloud Advocates after about three months. For those of you who are visual learners, we also recorded a video that you can check out on the official Microsoft 365 Developers YouTube channel.
This project was loads of fun and we'll miss the awesome weekly stand-up calls we've had together. To recap, here are our top take aways:
- Working with Low Code solutions is very easy and doesn't have a steep learning curve like programming (don't let that discourage you from learning programming languages like C# though!).
- Working with a group of diverse people is uplifting and interesting (Previously I didn't know that my Indian fellows stay up for so long! I go to bed at 11 pm usually).
- The Cloud Advocates are awesome
- Working across time zones while being a full time student can be a hassle. Commitment is required but it's worth it!
- Microsoft Learn is a great place to look up if you're stuck.
- You should join the Microsoft Learn Student Ambassador program if you would like to take part in future opportunities :)
For more details about our project, make sure to check out:
We hope you enjoyed our take. Please let us know what you think and feel free to connect with us!
Cheers!
Arpita, Gino, Prnika, Rohit