Skip to content

Commit

Permalink
Updated Readme files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChetanSharma-msft committed Oct 19, 2022
1 parent e807f74 commit 3c19e23
Show file tree
Hide file tree
Showing 12 changed files with 424 additions and 236 deletions.
71 changes: 44 additions & 27 deletions samples/bot-archive-groupchat-messages/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ languages:
- nodejs
extensions:
contentType: samples
createdDate: "11-10-2021 23:35:25"
createdDate: "10/11/2021 23:35:25 PM"
urlFragment: officedev-microsoft-teams-samples-bot-archive-groupchat-messages-nodejs
---

Expand All @@ -19,7 +19,7 @@ Using this nodejs sample, a bot can archive chat messages of groupchat and send

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

## Interaction with bot
## Interaction with app

![Bot Archive Group ChatMessagesGif](Images/botArchiveGroupchatMessagesGif.gif)

Expand All @@ -35,15 +35,19 @@ This feature shown in this sample is currently available in Public Developer Pre
> Note these instructions are for running the sample on your local machine, the tunnelling solution is required because
> the Teams service needs to call into the bot.
### 1. Setup for Bot SSO
In Azure portal, create a [Bot Framework registration resource](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=csharp%2Caadv2).
### 1. Setup for Bot
- Register Azure AD application
- Register a bot with Azure Bot Service, following the instructions [here](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-quickstart-registration?view=azure-bot-service-3.0).

- Ensure that you've [enabled the Teams Channel](https://docs.microsoft.com/en-us/azure/bot-service/channel-connect-teams?view=azure-bot-service-4.0)
- While registering the bot, use `https://<your_ngrok_url>/api/messages` as the messaging endpoint.

> NOTE: When you create your app registration in Azure portal, you will create an App ID and App password - make sure you keep these for later.
## Instruction on setting connection string for bot authentication on the behalf of user

1. In the Azure portal, select your resource group from the dashboard.
2. Select your bot channel registration link.
2. Select your Azure bot registration link.
3. Open the resource page and select Configuration under Settings.
4. Select Add OAuth Connection Settings.
5. Complete the form as follows:
Expand Down Expand Up @@ -71,7 +75,14 @@ In Azure portal, create a [Bot Framework registration resource](https://docs.mic
- Add `https://token.botframework.com/.auth/web/redirect` under Redirect URLs and click Configure button.
- Once the flyout menu close, scroll bottom to section 'Implicit Grant' and select check boxes "Access tokens" and "ID tokens" and click "Save" at the top bar.

### 2. Run your bot sample
### 2. Setup NGROK
1) Run ngrok - point to port 3978

```bash
ngrok http -host-header=rewrite 3978
```

### 3. Setup for code
1) Clone the repository

```bash
Expand All @@ -86,62 +97,68 @@ In Azure portal, create a [Bot Framework registration resource](https://docs.mic
npm install
```

4) Run ngrok - point to port 3978

```bash
ngrok http -host-header=rewrite 3978
```
5) Update the `.env` configuration for the bot to use the `MicrosoftAppId` and `MicrosoftAppPassword` and `ConnectionName` from the Bot Framework registration. (Note that the MicrosoftAppId is the AppId created in step 1 (Setup for Bot SSO), the MicrosoftAppPassword is referred to as the "client secret" in step 1 (Setup for Bot SSO) and you can always create a new client secret anytime.)
4) Update the `.env` configuration for the bot to use the `MicrosoftAppId` and `MicrosoftAppPassword` and `ConnectionName` from the Bot Framework registration. (Note that the MicrosoftAppId is the AppId created in step 1 (Setup for Bot SSO), the MicrosoftAppPassword is referred to as the "client secret" in step 1 (Setup for Bot SSO) and you can always create a new client secret anytime.)

6) Run your bot at the command line:
5) Run your bot at the command line:

```bash
npm start
```
- **Manually update the manifest.json**
### 4. Setup Manifest for Teams

- **This step is specific to Teams.**
- Edit the `manifest.json` contained in the `/appPackage` folder to and fill in MicrosoftAppId (that was created in step 1 and it is the same value of MicrosoftAppId as in `.env` file) *everywhere* you see the place holder string `<<MICROSOFT-APP-ID>>` (depending on the scenario it may occur multiple times in the `manifest.json`)
- In the valid domains section of the manifest update your ngrok url `{<<ngrokid>>.ngrok.io}`.
- Zip up the contents of the `/appPackage` folder to create a `manifest.zip`
- Upload the `manifest.zip` to Teams (in the left-bottom *Apps* view, click "Upload a custom app")
> IMPORTANT: The manifest file in this app adds "token.botframework.com" to the list of `validDomains`. This must be included in any bot that uses the Bot Framework OAuth flow.
## Running the sample
**Login command interaction:**
![Bot Welcome](Images/welcome.png)
**Login successful:**
![Bot LoginSuccessful](Images/loginsuccessful.png)
**Set up a bot:**
![Bot Setupbot](Images/setupbot.png)
**Getchat command interaction:**
![Bot BotCommandToGetChatMessages](Images/botCommandToGetChatMessages.png)
**Bot is added to fetch messages:**
![Bot Getchat](Images/getchat.png)
**Ready to download:**
![Bot ReplyFromBot](Images/replyFromBot.png)
## 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.
![Bot ReplyFromBot](Images/replyFromBot.png)
## 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](https://aka.ms/azuredeployment) for a complete list of deployment instructions.
## Further reading
- [Bot Framework Documentation](https://docs.botframework.com)
- [Bot Basics](https://docs.microsoft.com/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0)
- [Azure Portal](https://portal.azure.com)
- [Add Authentication to Your Bot Via Azure Bot Service](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=csharp)
- [Activity processing](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-concept-activity-processing?view=azure-bot-service-4.0)
- [Azure Bot Service Introduction](https://docs.microsoft.com/azure/bot-service/bot-service-overview-introduction?view=azure-bot-service-4.0)
- [Azure Bot Service Documentation](https://docs.microsoft.com/azure/bot-service/?view=azure-bot-service-4.0)
- [.NET Core CLI tools](https://docs.microsoft.com/en-us/dotnet/core/tools/?tabs=netcore2x)
- [Azure CLI](https://docs.microsoft.com/cli/azure/?view=azure-cli-latest)
- [Azure Portal](https://portal.azure.com)
- [Language Understanding using LUIS](https://docs.microsoft.com/en-us/azure/cognitive-services/luis/)
- [Channels and Bot Connector Service](https://docs.microsoft.com/en-us/azure/bot-service/bot-concepts?view=azure-bot-service-4.0)
- [Microsoft Teams Developer Platform](https://docs.microsoft.com/en-us/microsoftteams/platform/)
60 changes: 47 additions & 13 deletions samples/bot-conversation-sso-quickstart/js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ languages:
- nodejs
extensions:
contentType: samples
createdDate: "07-07-2021 13:38:26"
createdDate: "07/07/2021 13:38:26 PM"
urlFragment: officedev-microsoft-teams-samples-bot-conversation-sso-quickstart-js
---
# Teams Conversation Bot SSO quick-start
Expand All @@ -25,13 +25,13 @@ The sample uses the bot authentication capabilities in [Azure Bot Service](https

> IMPORTANT: The manifest file in this app adds "token.botframework.com" to the list of `validDomains`. This must be included in any bot that uses the Bot Framework OAuth flow.
## Interaction with bot
## Interaction with app

![Bot Conversation SSO QuickstartGif](sso_media/BotConversationSSOQuickstartGif.gif)

## Prerequisites

- Microsoft Teams is installed and you have an account (not a guest account)
- Microsoft Teams is installed and you have an account (not a guest account)
- To test locally, [NodeJS](https://nodejs.org/en/download/) must be installed on your development machine (version 16.14.2 or higher)
- [ngrok](https://ngrok.com/) or equivalent tunneling solution
- [M365 developer account](https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/prepare-your-o365-tenant) or access to a Teams account with the appropriate permissions to install an app.
Expand All @@ -42,34 +42,69 @@ The sample uses the bot authentication capabilities in [Azure Bot Service](https
> the Teams service needs to call into the bot.
### 1. Setup for Bot SSO
Refer to [Bot SSO Setup document](../BotSSOSetup.md).
### 2. Configure bot sample
- Refer to [Bot SSO Setup document](../BotSSOSetup.md)

Update the `.env` configuration for the bot to use the Microsoft App Id and App Password from the Bot Framework registration. (Note the MicrosoftAppId is the AppId created in step 1.1, the MicrosoftAppPassword is referred to as the "client secret" in step1.2 and you can always create a new client secret anytime.)
- Ensure that you've [enabled the Teams Channel](https://docs.microsoft.com/en-us/azure/bot-service/channel-connect-teams?view=azure-bot-service-4.0)

### 3. Run your bot sample
Under the root of this sample folder, build and run by commands:
- `npm install`
- `npm start`
- To test locally, you'll need [Ngrok](https://ngrok.com/) installed on your development machine.
Make sure you've downloaded and installed Ngrok on your local machine. ngrok will tunnel requests from the Internet to your local computer and terminate the SSL connection from Teams.

### 4. Configure and run the Teams app
- **Manually update the manifest.json**
- While registering the bot, use `https://<your_ngrok_url>/api/messages` as the messaging endpoint.

> NOTE: When you create your app registration in Azure portal, you will create an App ID and App password - make sure you keep these for later.
### 2. Setup NGROK
1) Run ngrok - point to port 3978

```bash
ngrok http -host-header=rewrite 3978
```

### 3. Setup for code
1) Clone the repository

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

2) In a terminal, navigate to `samples/bot-conversation-sso-quickstart/js`

3) Install modules

```bash
npm install
```
4) Update the `.env` configuration for the bot to use the Microsoft App Id and App Password from the Bot Framework registration. (Note the MicrosoftAppId is the AppId created in step 1.1, the MicrosoftAppPassword is referred to as the "client secret" in step1.2 and you can always create a new client secret anytime.)

5) Run your bot at the command line:

```bash
npm start
```

### 4. Setup Manifest for Teams

- **This step is specific to Teams.**
- Edit the `manifest.json` contained in the `appPackage/` folder to replace with your MicrosoftAppId (that was created in step1.1 and is the same value of MicrosoftAppId in `.env` file) *everywhere* you see the place holder string `{TODO: MicrosoftAppId}` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`)
- Zip up the contents of the `appPackage/` folder to create a `manifest.zip`
- Upload the `manifest.zip` to Teams (in the left-bottom *Apps* view, click "Upload a custom app")

## Running the sample

**Adding bot UI:**

![Install](sso_media/Install.png)

**Welcome to teamsBot:**

![BotSigninCard](sso_media/BotSignInCard.png)

**Login command interaction:**

![UserDetailsCard](sso_media/UserDetailsCard.png)

**View your token:**

![Token](sso_media/Token.png)

You can interact with this bot by sending it a message. The bot will respond by asking for your consent, by this consent the Bot will exchange an SSO token, then making a call to the Graph API on your behalf and returning the results. It will keep you loggined unless you send a message "logout".
Expand All @@ -89,4 +124,3 @@ You can interact with this bot by sending it a message. The bot will respond by
- [Language Understanding using LUIS](https://docs.microsoft.com/en-us/azure/cognitive-services/luis/)
- [Channels and Bot Connector Service](https://docs.microsoft.com/en-us/azure/bot-service/bot-concepts?view=azure-bot-service-4.0)
- [Microsoft Teams Developer Platform](https://docs.microsoft.com/en-us/microsoftteams/platform/)

43 changes: 31 additions & 12 deletions samples/bot-daily-task-reminder/nodejs/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ languages:
- nodejs
extensions:
contentType: samples
createdDate: "24-11-2021 13:20:00"
createdDate: "11-24-2021 13:20:00 PM"
urlFragment: officedev-microsoft-teams-samples-bot-daily-task-reminder-nodejs
---

# Bot task reminder

This sample shows a feature where user can schedule a recurring task and get the reminder at scheduled time.

## Interaction with bot
## Interaction with app

![Bot Daily Task ReminderGif ](Images/BotDailyTaskReminderGif.gif)

Expand All @@ -34,11 +34,27 @@ This sample shows a feature where user can schedule a recurring task and get the
> the Teams service needs to call into the bot.
### 1. Setup for Bot
In Azure portal, create a [Azure Bot resource](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=csharp%2Caadv2).
- In Azure portal, create a [Azure Bot resource](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-authentication?view=azure-bot-service-4.0&tabs=csharp%2Caadv2).

- Ensure that you've [enabled the Teams Channel](https://docs.microsoft.com/en-us/azure/bot-service/channel-connect-teams?view=azure-bot-service-4.0)
- While registering the bot, use `https://<your_ngrok_url>/api/messages` as the messaging endpoint.
**NOTE:** When you create your bot you will create an App ID and App password - make sure you keep these for later.

### 2. Run your bot sample
- To test locally, you'll need [Ngrok](https://ngrok.com/) installed on your development machine.
Make sure you've downloaded and installed Ngrok on your local machine. ngrok will tunnel requests from the Internet to your local computer and terminate the SSL connection from Teams.

- While registering the bot, use `https://<your_ngrok_url>/api/messages` as the messaging endpoint.

> NOTE: When you create your app registration in Azure portal, you will create an App ID and App password - make sure you keep these for later.
### 2. Setup NGROK
1) Run ngrok - point to port 3978

```bash
ngrok http -host-header=rewrite 3978
```

### 3. Setup for code
1) Clone the repository

```bash
Expand All @@ -49,37 +65,40 @@ In Azure portal, create a [Azure Bot resource](https://docs.microsoft.com/en-us/

3) Install node modules

Inside node js folder, open your local terminal and run the below command to install node modules. You can do the same in Visual studio code terminal by opening the project in Visual studio code
Inside nodejs folder, open your local terminal and run the below command to install node modules. You can do the same in Visual studio code terminal by opening the project in Visual studio code

```bash
npm install
```
4) Run ngrok - point to port 3978

```bash
ngrok http -host-header=rewrite 3978
```
5) Update the `.env` configuration file in your project folder for the bot to use the `MicrosoftAppId` and `MicrosoftAppPassword`, `BaseUrl` with application base url. For e.g., your ngrok url. (Note the MicrosoftAppId is the AppId created in step 1 (Setup for Bot), the MicrosoftAppPassword is referred to as the "client secret" in step 1 (Setup for Bot) and you can always create a new client secret anytime.)
4) Update the `.env` configuration file in your project folder for the bot to use the `MicrosoftAppId` and `MicrosoftAppPassword`, `BaseUrl` with application base url. For e.g., your ngrok url. (Note the MicrosoftAppId is the AppId created in step 1 (Setup for Bot), the MicrosoftAppPassword is referred to as the "client secret" in step 1 (Setup for Bot) and you can always create a new client secret anytime.)

6) Run your app
5) Run your app

```bash
npm start
```
7) Manually update the manifest.json

### 4. Setup Manifest for Teams

- **This step is specific to Teams.**

- Edit the `manifest.json` contained in the `appPackage/` folder to replace with your MicrosoftAppId (that was created in step1.1 and is the same value of MicrosoftAppId in `.env` file) *everywhere* you see the place holder string `{MicrosoftAppId}` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`)
- Zip up the contents of the `appPackage/` folder to create a `manifest.zip`
- Upload the `manifest.zip` to Teams (in the left-bottom *Apps* view, click "Upload a custom app")

## Running the sample

**Type command create-reminder to get card for scheduling the recurring task:**

![Schedule task ](Images/ScheduleTaskCard.png)

**Click on schedule task button to open task module for scheduling a task:**

![Task Details ](Images/ScheduleTask.png)

**Once task is scheduled, you will be notified about the task at scheduled time:**

![Task reminder](Images/TaskReminder.png)

## Deploy the bot to Azure
Expand Down
Loading

0 comments on commit 3c19e23

Please sign in to comment.