Skip to content

Commit 358b8c9

Browse files
authored
[samples] Archive 01.k.directline-token (#5537)
* Archive 01.k * Update entry
1 parent 3a004ca commit 358b8c9

File tree

5 files changed

+37
-4623
lines changed

5 files changed

+37
-4623
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
283283

284284
### Samples
285285

286-
- Sample `01.getting-started/l.sharepoint-web-part` and samples under `07.advanced-web-chat-apps` is being archived and will no longer receive updates, in PR [#5533](https://github.com/microsoft/BotFramework-WebChat/pull/5533), by [@compulim](https://github.com/compulim)
286+
- Sample `01.getting-started/l.sharepoint-web-part`, `01.getting-started/k.direct-line-token`, and samples under `07.advanced-web-chat-apps` is being archived and will no longer receive updates, in PR [#5533](https://github.com/microsoft/BotFramework-WebChat/pull/5533), [#5536](https://github.com/microsoft/BotFramework-WebChat/pull/5536), and [#5537](https://github.com/microsoft/BotFramework-WebChat/pull/5537), by [@compulim](https://github.com/compulim)
287287

288288
## [4.18.0] - 2024-07-10
289289

samples/01.getting-started/k.direct-line-token/README.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
> 💥 The sample has been archived and will no longer receive updates.
2+
13
# Direct Line Token Sample
24

35
# Description
@@ -43,55 +45,53 @@ You can follow our instructions on how to [create an Azure Bot resource](https:/
4345
<details><summary>JavaScript</summary>
4446

4547
1. Save the Microsoft App ID and password to `/bot/.env`
46-
- ```
47-
MICROSOFT_APP_ID=12345678abcd-1234-5678-abcd-12345678abcd
48-
MICROSOFT_APP_PASSWORD=<your-microsoft-app-password>
49-
```
48+
- ```
49+
MICROSOFT_APP_ID=12345678abcd-1234-5678-abcd-12345678abcd
50+
MICROSOFT_APP_PASSWORD=<your-microsoft-app-password>
51+
```
5052
1. Save the Web Chat secret to `/web/.env`
51-
- ```
52-
DIRECT_LINE_SECRET=<your-direct-line-secret>
53-
```
53+
- ```
54+
DIRECT_LINE_SECRET=<your-direct-line-secret>
55+
```
5456
5557
</details>
5658
5759
<details><summary>C#</summary>
5860
5961
1. Save the Microsoft App ID and password to `/bot/appsettings.json`
60-
- ```
61-
"MicrosoftAppId": "12345678abcd-1234-5678-abcd-12345678abcd"
62-
"MicrosoftAppPassword": "<your-microsoft-app-password>"
63-
```
62+
- ```
63+
"MicrosoftAppId": "12345678abcd-1234-5678-abcd-12345678abcd"
64+
"MicrosoftAppPassword": "<your-microsoft-app-password>"
65+
```
6466
1. Save the Web Chat secret to `/web/appsettings.json`
65-
- ```
66-
"DirectLineSecret": "<your-direct-line-secret>"
67-
```
67+
- ```
68+
"DirectLineSecret": "<your-direct-line-secret>"
69+
```
6870
6971
</details>
7072
7173
During development, you will run your bot locally. Azure Bot Services will send activities to your bot thru a public URL. You can use [ngrok](https://ngrok.com/) to expose your bot server on a public URL.
7274
7375
1. Run `ngrok http -host-header=localhost:3978 3978`
7476
1. Update your Bot Channel Registration. You can use [Azure CLI](https://aka.ms/az-cli) or [Azure Portal](https://portal.azure.com)
75-
- Via Azure CLI
76-
- Run `az bot update --resource-group <your-bot-rg> --name <your-bot-name> --subscription <your-subscription-id> --endpoint "https://a1b2c3d4.ngrok.io/api/messages"`
77-
- Via Azure Portal
78-
- Browse to your Bot Channel Registration
79-
- Select "Settings"
80-
- In "Configuration" section, set "Messaging Endpoint" to `https://a1b2c3d4.ngrok.io/api/messages`
77+
- Via Azure CLI
78+
- Run `az bot update --resource-group <your-bot-rg> --name <your-bot-name> --subscription <your-subscription-id> --endpoint "https://a1b2c3d4.ngrok.io/api/messages"`
79+
- Via Azure Portal
80+
- Browse to your Bot Channel Registration
81+
- Select "Settings"
82+
- In "Configuration" section, set "Messaging Endpoint" to `https://a1b2c3d4.ngrok.io/api/messages`
8183
8284
## Prepare and run the code
8385
8486
1. Under each of `bot`, and `web` folder, run the following commands, depending on your language:
8587
8688
<details><summary>JavaScript</summary>
87-
8889
1. `npm install`
8990
1. `npm start`
9091
9192
</details>
9293
9394
<details><summary>C#</summary>
94-
9595
1. `dotnet build`
9696
1. `dotnet run`
9797
@@ -101,18 +101,18 @@ During development, you will run your bot locally. Azure Bot Services will send
101101
102102
# Things to try out
103103
104-
- Type anything to the bot. It should reply with your user ID, which will stay the same for the duration of the session.
105-
- Open a new browser tab to http://localhost:5000 and type anything to the bot. It should reply with a different user ID since it has generated a different Direct Line token.
104+
- Type anything to the bot. It should reply with your user ID, which will stay the same for the duration of the session.
105+
- Open a new browser tab to http://localhost:5000 and type anything to the bot. It should reply with a different user ID since it has generated a different Direct Line token.
106106
107107
# Code
108108
109109
The code is organized into two separate folders:
110110
111-
- `/bot/` is the bot server
112-
- `/web/` is the REST API for generating Direct Line tokens
113-
- `GET /api/directline/token` will generate a new Direct Line token for the app. The token will be bound to a random user ID.
114-
- During development-time, it will also serve the bot server via `/api/messages/`
115-
- To enable this feature, add `PROXY_BOT_URL=http://localhost:3978` to `/web/.env`
111+
- `/bot/` is the bot server
112+
- `/web/` is the REST API for generating Direct Line tokens
113+
- `GET /api/directline/token` will generate a new Direct Line token for the app. The token will be bound to a random user ID.
114+
- During development-time, it will also serve the bot server via `/api/messages/`
115+
- To enable this feature, add `PROXY_BOT_URL=http://localhost:3978` to `/web/.env`
116116
117117
## Constructing the user ID
118118
@@ -246,9 +246,9 @@ Note that we do _not_ specify a user ID when initiating Web Chat. Direct Line wi
246246

247247
This sample includes multiple parts:
248248

249-
- **The UI** is a static HTML/JS web page with Web Chat integrated via JavaScript bundle. It makes a POST request to the backend API and uses the resulting Direct Line token to render Web Chat.
250-
- **The backend API** generates Direct Line tokens. Each generated token is bound to a new, randomly-generated user ID.
251-
- **The bot** is a bare-bones bot that responds to every message by sending the user's ID.
249+
- **The UI** is a static HTML/JS web page with Web Chat integrated via JavaScript bundle. It makes a POST request to the backend API and uses the resulting Direct Line token to render Web Chat.
250+
- **The backend API** generates Direct Line tokens. Each generated token is bound to a new, randomly-generated user ID.
251+
- **The bot** is a bare-bones bot that responds to every message by sending the user's ID.
252252

253253
## Motivation
254254

@@ -342,6 +342,6 @@ The flow could be:
342342

343343
# Further reading
344344

345-
- [Create an Azure Bot resource](https://docs.microsoft.com/en-us/azure/bot-service/abs-quickstart?view=azure-bot-service-4.0&tabs=userassigned#create-the-resource)
346-
- [Generating a Direct Line token](https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-authentication?view=azure-bot-service-4.0#generate-token)
347-
- [Enhanced Direct Line Authentication feature](https://blog.botframework.com/2018/09/25/enhanced-direct-line-authentication-features/)
345+
- [Create an Azure Bot resource](https://docs.microsoft.com/en-us/azure/bot-service/abs-quickstart?view=azure-bot-service-4.0&tabs=userassigned#create-the-resource)
346+
- [Generating a Direct Line token](https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-authentication?view=azure-bot-service-4.0#generate-token)
347+
- [Enhanced Direct Line Authentication feature](https://blog.botframework.com/2018/09/25/enhanced-direct-line-authentication-features/)

0 commit comments

Comments
 (0)