Creating an Automated Agent to Post Historical Computer Events in Teams Daily

image

I recently did a video here –

Video link = https://www.youtube.com/watch?v=KZkhK41lynI

but I’ve now been able to produce the following steps for your to replicate this.

Automate Daily Updates in Teams with Copilot Studio & Power Automate: A Step-by-Step Guide

Ever wanted a little bot to automatically post daily updates, fun facts, or important reminders into your Microsoft Teams channel? Maybe a “This Day in History” update, a daily project status reminder, or a motivational quote?

In this guide, we’ll walk through how to build an automated agent using Microsoft Copilot Studio and Power Automate that posts information to a Teams channel on a daily schedule. We’ll use the example from the video: creating a bot that posts significant computer history events for the current day.

What You’ll Need:

  1. A Microsoft 365 account.

  2. Appropriate licenses to use Power Automate and Copilot Studio.

  3. Access to Microsoft Teams and permission to post in a specific channel.

The Overall Process:

We’ll create a system with a few interconnected parts:

  1. Power Automate Flow #1 (Trigger): Runs once a day on a schedule.

  2. Copilot Studio Agent: Receives a prompt from Flow #1, uses its general knowledge (AI) to find the relevant information (e.g., historical events).

  3. Copilot Studio Topic: Takes the AI-generated response and triggers another flow.

  4. Power Automate Flow #2 (Action): Receives the formatted response from the Copilot Topic and posts it to a designated Teams channel.

Let’s break it down!

Step 1: Create Your Copilot in Copilot Studio
  1. Navigate to Microsoft Copilot Studio.

  2. Create a New Copilot. Let’s name it “History Bot” for this example (the video used “History”).

  3. Configure Basic Details:

    • Name: History Bot

    • Description: An agent that posts historical events daily.

    • General Instructions: Use general knowledge to create a list of historical events that happened on this day relating to computers. (Adapt this instruction based on the type of information you want the bot to post).

  4. Enable Orchestration: Ensure the “Use generative AI to determine how best to respond…” toggle under Orchestration is Enabled. This allows the Copilot to understand the instructions and use AI.

  5. Configure Knowledge:

    • Go to the Knowledge section (you might need to scroll down or find it in the left navigation).

    • Ensure “Allow the AI to use its own general knowledge” is Enabled. This lets the bot search the web based on your instructions. We won’t add specific documents for this example.

Step 2: Create the Daily Trigger Flow (Power Automate Flow #1)

This flow starts the process each day.

  1. Go to Microsoft Power Automate.

  2. Create a New Flow > Scheduled cloud flow.

  3. Configure the Trigger:

    • Give your flow a name (e.g., “Daily History Trigger”).

    • Set the schedule: Repeat every 1 Day.

    • Choose a specific time for it to run (e.g., 12:45 PM as shown in the video).

  4. Add Action: Send Prompt to Copilot:

    • Click “+ New step”.

    • Search for and select the “Copilot Studio” connector.

    • Choose the action “Sends a prompt to the specified copilot for processing (Preview)”.

    • Select your Copilot: Choose the “History Bot” (or whatever you named it) from the dropdown.

    • Prompt: Enter the text you want to send to the Copilot each day. Based on the video and our Copilot instructions, this would be something like: Please tell me about today in history with computers.

  5. Save this flow.

Step 3: Create the Posting Topic in Copilot Studio

This topic handles the response from the AI and sends it to the next flow for posting.

  1. Go back to your History Bot in Copilot Studio.

  2. Navigate to the Topics section.

  3. Optional Cleanup: The video creator removed the default/generic system topics. You might want to do this for a dedicated bot like this to keep things clean, but it’s not strictly necessary.

  4. Create a New Topic > From blank.

  5. Name the Topic: Call it “Post Result”.

  6. Configure the Topic Trigger:

    • Click on the default “Phrase” trigger and delete it.

    • Add a new trigger. Select the trigger type: AI response generated (or similar wording like “On Generated Response”). This means the topic starts after the Copilot AI has formulated its answer based on the prompt from Flow #1.

  7. Add Action: Call Power Automate Flow:

    • Click the + below the trigger and select Call an action > Create a flow. This will open Power Automate in a new tab to create Flow #2.

Step 4: Create the Posting Flow (Power Automate Flow #2)

This flow takes the Copilot’s response and posts it to Teams.

  1. Power Automate should have opened with a trigger “When an agent calls the flow (Preview)”. This trigger will have an input field ready.

  2. Define Input:

    • Click on the trigger step.

    • Add an input of type Text. Name it something descriptive like CopilotResponseContent. This is where the Copilot topic will pass the AI’s generated text.

  3. Add Action: Post to Teams:

    • Click “+ New step”.

    • Search for the “Microsoft Teams” connector.

    • Select the action “Post message in a chat or channel”.

    • Post as: Choose Flow bot.

    • Post in: Select Channel.

    • Team: Select the Team you want to post to.

    • Channel: Select the specific Channel within that Team.

    • Message: Click in the message box. The dynamic content panel should appear. Select the CopilotResponseContent input variable you defined in the trigger step. This inserts the text generated by the Copilot.

  4. Add Action: Respond to Agent:

    • Click “+ New step”.

    • Search for “Copilot Studio” connector.

    • Select the action “Respond to the agent”. (This step simply tells the Copilot topic that the flow has finished). You usually don’t need to add outputs here for this simple scenario.

  5. Save this flow. Give it a name like “Post History Bot Result to Teams”.

Step 5: Connect the Topic to the Flow
  1. Go back to the Copilot Studio tab where you were editing the “Post Result” topic.

  2. The “Call an action” step should now let you select the flow you just created (“Post History Bot Result to Teams”). Select it.

  3. Map Inputs: You’ll see the CopilotResponseContent input field you created in Flow #2. You need to tell the topic what to send to this input.

    • Click the input field.

    • Select the lightning bolt icon (Insert variable).

    • Go to the System variables.

    • Find and select Response.FormattedText. This variable holds the final, formatted answer from the Copilot’s AI generation process.

  4. End the Topic: Add a final step to the topic: End conversation > End current topic.

  5. Save the topic.

Step 6: Testing and Troubleshooting
  1. Test Flow #1: In Power Automate, open the “Daily History Trigger” flow. Click Test > Manually > Run flow. This simulates the daily schedule.

  2. Check Copilot Activity: In Copilot Studio, go to the Activity tab for your “History Bot”. You should see a new session started by the “History Trigger”. It will show steps like “Knowledge sources used” and eventually call the “Post Result” topic.

  3. Check Teams: Look in the designated Teams channel. The message should appear shortly after the flows run successfully.

  4. Troubleshooting Connection Issues (Common Problem):

    • Symptom: In the Copilot Studio Activity > Transcript view, you might see the process get stuck on “Waiting for user” and display a card saying “Additional permissions are required to run this action. To proceed, please select ‘Connect’…” This usually means the connection for Flow #2 (posting to Teams) isn’t working correctly.

    • Problem: The “Connect” button on that card might not work reliably.

    • Workaround 1 (Recommended): In Copilot Studio, go to the Test your agent pane > click the More options (…) menu > Manage connections. This opens the connection management page. Find the connection related to your “Post History Bot Result to Teams” flow (it will likely show an error or ask for reconnection) and fix it, ensuring it’s properly authenticated to Teams.

    • Workaround 2 (Advanced): As shown in the video, you can use your browser’s Developer Tools (F12). Inspect the non-working “Connect” button element in the transcript view. Find the aria-label or similar attribute containing a URL (it will look something like https://copilotstudio.microsoft.com/c2/tenants/…/user-connections). Copy this URL, paste it into a new browser tab, and follow the prompts to fix the connection.

    • After fixing the connection, you may need to re-test Flow #1.

Conclusion

That’s it! You’ve now built an automated system where Power Automate triggers a Copilot Studio agent daily, the agent uses AI to generate content, and another Power Automate flow posts that content into Teams.

You can adapt the Copilot’s instructions, the trigger schedule, and the final Teams message formatting to suit countless automation needs. Happy automating!

Creating an Automated Agent to Post Historical Computer Events in Teams Daily

Video link = https://www.youtube.com/watch?v=KZkhK41lynI

In this video, I walk you through the process of creating an automated agent that posts daily historical computer events in a Teams channel. Starting from copilotstudio.microsoft.com, I show you how to set up the agent, configure triggers, and manage connections. Learn how to troubleshoot common issues and ensure your agent runs smoothly. Join me as I share tips and insights to help you leverage AI for regular updates in your business. Don’t miss out on this practical guide to enhancing your team’s productivity with automation!

Need to Know podcast–Episode 344

Join me to hear about the latest news and update from the Microsoft cloud as well as a deep dive into SharePoint agents. Plenty of AI news is again coming your way in this episode as Copilot spreads its wings and continues to grow across the stack. List in for more details.

Brought to you by www.ciaopspatron.com

you can listen directly to this episode at:

https://ciaops.podbean.com/e/episode-344-sharepoint-agents/

Subscribe via iTunes at:

https://itunes.apple.com/au/podcast/ciaops-need-to-know-podcasts/id406891445?mt=2

or Spotify:

https://open.spotify.com/show/7ejj00cOuw8977GnnE2lPb

Don’t forget to give the show a rating as well as send me any feedback or suggestions you may have for the show.

Resources

@directorcia

Join my shared channel

CIAOPS merch store

Become a CIAOPS Patron

CIAOPS Blog

CIAOPS Brief

CIAOPSLabs

Support CIAOPS

Widespread Microsoft Entra lockouts tied to new security feature rollout

FYAI: How agents will transform business and daily work

Announcing new computer use in Microsoft Copilot Studio for UI automation

Introducing agent flows: Transforming automation with AI-first workflows

Five things for IT administrators to know about SharePoint agent management

How to deploy Microsoft Purview DSPM for AI to secure your AI apps

Transforming security​ with Microsoft Security Exposure Management initiatives

Microsoft Purview: New data security controls for the browser & network

Step-by-Step Guide : How to enable QR code authentication for Microsoft Entra ID (Preview)

ActiveX disabled by default in Microsoft 365

Achieve greater security with Intune and Microsoft 365

Troubleshooting Windows Feature updates in Microsoft Intune

Azure Files: More performance, more control, more value for your file data

Feature deep dive: Using PDFs in OneDrive and our journey thus far

PowerShell script to report EntraID signin update

One the things that I have tasked myself with is to go back through my scripts and using AI (aka Github Copilot) to improve my code.

Screenshot 2025-04-18 095201

The latest script to get this treatment is:

https://github.com/directorcia/Office365/blob/master/graph-signins-get.ps1

which now has greater flexibility and speed. I also used Copilot to produce documentation for the script which is here:

https://github.com/directorcia/Office365/wiki/Get-tenant-signins

In my Visual Studio Code editor what I did was simply to open up the script.

Screenshot 2025-04-18 100356

I then set Copilot to operate in ‘agent’ mode, as shown above. I also selected an AI model to use. I have the default choices of:

Screenshot 2025-04-18 100555

I can also configure others like Gemini if I want. This time I selected Claude 3.7 and then basically told Copilot to ‘improve’ my code. After that I asked it to provide options for using paging to get more results as well as ensuring the output was in local time.

After one update to the time format it produced an error when it ran but I simply told Copilot to fix that error and it did so. The code once again executed.

Thus, the updated script and documentation is now available via the links above and I am amazed at how easy it was to make all these changes to get the result that I wanted without having to type any additional code myself into the script! I suppose he downside is that the code is more complex and I don’t intrinsically understand it as well as if I had written every line, but I have Copilot to help explain any part of the code to me if needed and the time savings getting to a result speak for themselves.

The functionality that AI provided for me via Github Copilot is enormous and should make short work of any PowerShell automation I do in the future. If you are using PowerShell (or any code) then you really need to be looking at the benefits AI will provide you.

Enhancing Your Copilot Studio Agent with Topics and Actions

Video URL = https://www.youtube.com/watch?v=O-nHz5Z3Avk

In this video, we explore how to extend the capabilities of your Copilot Studio agent by integrating external knowledge sources using topics and actions. Here’s a step-by-step guide based on the video content:

1. Creating the Agent:

  • Start by creating an agent as usual, providing a description and general instructions. Ensure the orchestration option is selected and enabled. 0:12

  • The initial knowledge source selected is a single site, which allows the agent to answer questions in a basic manner. 0:23

2. Improving Information Retrieval:

  • To enhance the agent’s responses, especially for current news, create an action using Brave search. 0:54

  • Set up a free Brave account and obtain the API key for Brave search. 1:08

  • Configure the action to use Brave search for web news queries. 1:18

3. Creating and Configuring Topics:

  • Add a new topic that triggers when users ask about news. 2:01

  • Describe the trigger conditions and steps for the topic. 2:13

  • Create a search query variable to feed into the Brave search action. 2:31

  • Ensure the variable captures the prompt and keywords from the user’s query. 3:09

4. Testing and Publishing:

  • Test the setup by asking the agent for the latest news on a specific topic, such as “Alpine” or “Ferrari”. 3:58

  • Verify that the topic triggers correctly and retrieves detailed news results via Brave search. 4:19

  • Publish the updated agent to make the enhancements live. 4:35

By following these steps, you can significantly improve the relevance and detail of the information your Copilot Studio agent provides, leveraging external knowledge sources effectively.

Thank you for watching the video!

Techwerks 27

bw-car-vehicle

CIAOPS Techwerks face to face returns to Melbourne CBD on Thursday the 22nd of May 2025. The venue for the event will be:

Melbourne City College
Level 9, 120 Spencer St
MELBOURNE VIC 3000

The course is limited to 20 people and you can sign up and reserve your place now! You reserve a place by completing this form:

http://bit.ly/ciaopsroi

or by sending me an email (director@ciaops.com) expressing your interest.

The content of these all day face to face workshops is driven by the attendees. That means we cover exactly what people want to see and focus on doing hands on, real world scenarios. Attendees can vote on topics they’d like to see covered prior to the day and we continue to target exactly what the small group of attendees wants to see. Thus, this is an excellent way to get really deep into the technology and have all the questions you’ve been dying to know answered. Typically, the event produces a number of best practice take aways for each attendee. This event will largely focus on AI including Copilot, Agents and Agent creation, etc with a special focus on what is relevant for small business.

Recent testimonial – “I just wanted to say a big thank you to Robert for the Brisbane Techworks day. It is such a good format with each attendee asking what matters them and the whole interactive nature of the day. So much better than death by PowerPoint.” – Mike H.

The cost to attend is:

Gold Enterprise Patron = $50 ex GST

Gold Patron = $90 ex GST

Silver Patron = $180 ex GST

Bronze Patron = $360 ex GST

Non Patron = $720 ex GST

I hope to see you there.

SharePoint Agents PAYG costs

image

To get a better idea of the costs of using SharePoint Agents, I’d suggest you have a look at:

https://techcommunity.microsoft.com/blog/spblog/consumption-based-pricing-for-sharepoint-agents/4389591

with the highlight being:

Under the PAYGO model, customers are billed $0.01 per message. Each interaction with a SharePoint agent uses thirty-two (32) messages, so customers are billed at $0.32 per interaction with SharePoint agents. The PAYGO meter uses your Azure subscription as the payment instrument, ensuring seamless integration with existing billing processes. This meter is available worldwide.

and

There are no in-product feature differences between the PAYGO meter, and the SharePoint agent included in the Microsoft 365 Copilot license. Users have the same capabilities and benefits, regardless of the billing model they choose.

Thus, with each interaction being $0.32, let say that typically a user will interact with SharePoint agents three times during any inquiry. That makes it about $1 per enquiry. If we now say that an average user will make 20 inquiries per day, that is $20 per user per day. Multiply that across all the users in an organisation and you can see how it could get very expensive very quickly.

Clearly then, pay as you go SharePoint agents is for very low volume of usage across the organisation, typically one enquiry per day. Otherwise, it make more sense to buy a full license of Microsoft 365 Copilot for the user in question because they effectively get unlimited SharePoint agent enquiries as well as a personal AI assistant plus more.

If you combine any other pay as go usage of Copilot, such as with Copilot Studio as I have outlined before, then it make far more sense to get a full Microsoft 365 Copilot for those who need to use any AI tools. However, pay as you go billing does provide you the flexibility to mix and match with full Microsoft 365 Copilot licenses. If you have a business with 5 major users and 20 casual users then teh starting point is for those 5 users to have full Microsoft 365 Copilot license, while the rest simply use an Azure subscription to cover any incidental costs until the point when another person in the business needs a full license.

To keep control of any SharePoint or Copilot pay as you go, you shoudl always set up a budget in Azure as I have outlined before with Security Copilot

Pay as you SharePoint agents do provide a degree of flexibility of quickly and easily enabling AI across your SharePoint information for your whole organisation but if usage of AI starts to grow then so too will the costs, and potentially quite dramatically if appropriate limits are not configured. The best option with pay as you go SharePoint agents then is its use in combination with full Microsoft 365 Copilot licenses for users who need to use AI extensively in their jobs, while casual users can remain on the pay as you go option. The good news is that you do have the flexibility to mix and match with the two types of licenses as needed and Azure does give you the added benefit of being able to turn off immediately where Microsoft 365 Copilot licenses are typically an annual commitment.