Skip to content

Latest commit

 

History

History
115 lines (75 loc) · 3.7 KB

File metadata and controls

115 lines (75 loc) · 3.7 KB
page_type description products languages extensions contentType createdDate
sample
Demonstrating on how a bot can archive groupchat messages and send it to user as a file.
office-teams
office
office-365
csharp
samples
11-10-2021 23:35:25

Archive groupchat messages

Using this C# sample, a bot can archive chat messages of groupchat and send it to user.

This feature shown in this sample is currently available in Public Developer Preview only.

Key features

  • Sending archive chat messages text file of a groupchat to user

Bot command

Bot reply

Prerequisites

Setup

1 Clone the repository

```bash
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
```

2 In a terminal, navigate to samples/bot-archive-groupchat-messages/csharp

3 Run ngrok - point to port 3978

# ngrok http -host-header=rewrite 3978
  1. Create a Bot Registration In Azure portal, create a Bot Framework registration resource.

    Add this permission to app registration

Permissions

  1. Modify the manifest.json in the /AppManifest folder and replace the <<MICROSOFT-APP-ID>> with the id from step 4 (Azure AAD Id).

  2. Zip the contents of AppManifest folder into a manifest.zip, and use the manifest.zip to deploy in app store or add to Teams.

  3. Modify the /appsettings.json and fill in the {{ MICROSOFT-APP-ID }},{{ MICROSOFT-APP-PASSWORD }} and {{ Connection Name }} with the id from step 4.

  4. In the valid domains section of the manifest update your ngrok url {<<ngrokid>>.ngrok.io}.

  5. Upload the manifest.zip to Teams (in the Apps view click "Upload a custom app")

    • Go to Microsoft Teams. From the lower left corner, select Apps
    • From the lower left corner, choose Upload a custom App
    • Go to your project directory, the ./appPackage folder, select the zip folder, and choose Open.
    • Select Add in the pop-up dialog box. Your tab is uploaded to Teams

To try this sample

  • In a terminal, navigate to FetchGroupChatMessages

    # change into project folder
    cd # FetchGroupChatMessages
  • Run the bot from a terminal or from Visual Studio, choose option A or B.

    A) From a terminal

    # run the bot
    dotnet run

    B) Or from Visual Studio

    • Launch Visual Studio
    • File -> Open -> Project/Solution
    • Navigate to samples/bot-archive-groupchat-messages/csharp folder
    • Select FetchGroupChatMessages.csproj file
    • Press F5 to run the project

Interacting with the bot in GroupChat

Select a groupchat and add the bot to chat.

Send getchat message to the bot, you will recieve a consent card by the bot in your personal scope.

Deploy the bot to Azure

To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.