You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/java_springboot/15.handling-attachments/README.md
+23-16Lines changed: 23 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,34 +1,37 @@
1
1
# Handling Attachments
2
2
3
-
Bot Framework v4 handling attachments bot sample
3
+
Bot Framework v4 handling attachments bot sample.
4
4
5
5
This bot has been created using [Bot Framework](https://dev.botframework.com), it shows how to send outgoing attachments and how to save attachments to disk.
6
6
7
7
> **NOTE: A specific example for Microsoft Teams, demonstrating how to
8
8
upload files to Teams from a bot and how to receive a file sent to a bot as an attachment, can be found [here](../56.teams-file-upload)**
9
9
10
+
This sample is a Spring Boot app and uses the Azure CLI and azure-webapp Maven plugin to deploy to Azure.
11
+
10
12
## Prerequisites
11
13
12
14
- Java 1.8+
13
15
- Install [Maven](https://maven.apache.org/)
14
16
- An account on [Azure](https://azure.microsoft.com) if you want to deploy to Azure.
15
17
16
-
## To try this sample locally
18
+
## To try this sample
17
19
- From the root of this project folder:
18
20
- Build the sample using `mvn package`
19
21
- Run it by using `java -jar .\target\bot-attachments-sample.jar`
20
22
21
-
- Test the bot using Bot Framework Emulator
23
+
## Testing the bot using Bot Framework Emulator
22
24
23
-
[Bot Framework Emulator](https://github.com/microsoft/botframework-emulator) is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.
25
+
[Bot Framework Emulator](https://github.com/microsoft/botframework-emulator) is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.
24
26
25
-
- Install the Bot Framework Emulator version 4.3.0 or greater from [here](https://github.com/Microsoft/BotFramework-Emulator/releases)
27
+
- Install the latest Bot Framework Emulator from [here](https://github.com/Microsoft/BotFramework-Emulator/releases)
26
28
27
-
- Connect to the bot using Bot Framework Emulator
29
+
### Connect to the bot using Bot Framework Emulator
30
+
- Launch Bot Framework Emulator
31
+
- File -> Open Bot
32
+
- Enter a Bot URL of `http://localhost:3978/api/messages`
28
33
29
-
- Launch Bot Framework Emulator
30
-
- File -> Open Bot
31
-
- Enter a Bot URL of `http://localhost:3978/api/messages`
34
+
With the Bot Framework Emulator connected to your running bot, the sample will show you different types of attachments.
32
35
33
36
## Interacting with the bot
34
37
@@ -42,7 +45,7 @@ As described on [Deploy your bot](https://docs.microsoft.com/en-us/azure/bot-ser
42
45
### 1. Login to Azure
43
46
From a command (or PowerShell) prompt in the root of the bot folder, execute:
44
47
`az login`
45
-
48
+
46
49
### 2. Set the subscription
47
50
`az account set --subscription "<azure-subscription>"`
48
51
@@ -62,10 +65,14 @@ Record the `appid` from the returned JSON
62
65
Replace the values for `<appid>`, `<appsecret>`, `<botname>`, and `<groupname>` in the following commands:
If the deployment is successful, you will be able to test it via "Test in Web Chat" from the Azure Portal using the "Bot Channel Registration" for the bot.
80
87
@@ -83,9 +90,8 @@ After the bot is deployed, you only need to execute #6 if you make changes to th
83
90
84
91
## Further reading
85
92
86
-
-[Maven Plugin for Azure App Service](https://docs.microsoft.com/en-us/java/api/overview/azure/maven/azure-webapp-maven-plugin/readme?view=azure-java-stable)
93
+
-[Maven Plugin for Azure App Service](https://github.com/microsoft/azure-maven-plugins/tree/develop/azure-webapp-maven-plugin)
Copy file name to clipboardExpand all lines: samples/java_springboot/15.handling-attachments/src/main/java/com/microsoft/bot/sample/attachments/AttachmentsBot.java
+50-40Lines changed: 50 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,13 @@
32
32
33
33
/**
34
34
* This class implements the functionality of the Bot.
35
+
*
36
+
* Represents a bot that processes incoming activities.
37
+
* For each user interaction, an instance of this class is created and the onTurn method is called.
38
+
* This is a Transient lifetime service. Transient lifetime services are created
39
+
* each time they're requested. For each Activity received, a new instance of this
40
+
* class is created. Objects that are expensive to construct, or have a lifetime
41
+
* beyond the single turn, should be carefully managed.
35
42
*
36
43
* <p>
37
44
* This is where application specific logic for interacting with the users would be added. For this
Copy file name to clipboardExpand all lines: samples/java_springboot/15.handling-attachments/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
Copy file name to clipboardExpand all lines: samples/java_springboot/15.handling-attachments/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
0 commit comments