|
| 1 | +const util = require('util') |
1 | 2 | const uuidv4 = require('uuid/v4') |
2 | 3 | const mime = require('mime-types') |
3 | 4 | const _ = require('lodash') |
@@ -212,6 +213,13 @@ class BotiumConnectorDirectline3 { |
212 | 213 | activity.text = msg.messageText |
213 | 214 | } |
214 | 215 |
|
| 216 | + if (msg.forms) { |
| 217 | + activity.value = {} |
| 218 | + msg.forms.forEach(f => { |
| 219 | + activity.value[f.name] = f.value |
| 220 | + }) |
| 221 | + } |
| 222 | + |
215 | 223 | if (msg.media && msg.media.length > 0) { |
216 | 224 | debug('Posting activity with attachments ', JSON.stringify(activity, null, 2)) |
217 | 225 | const formData = new FormData() |
@@ -248,12 +256,16 @@ class BotiumConnectorDirectline3 { |
248 | 256 | }, |
249 | 257 | body: formData |
250 | 258 | }).catch(err => { |
251 | | - debug('Error posting activity', err) |
| 259 | + debug('Error posting activity with attachments', err) |
252 | 260 | reject(new Error(`Error posting activity: ${err}`)) |
253 | 261 | }).then(async (res) => { |
254 | 262 | const json = await res.json() |
255 | | - debug('Posted activity, assigned ID:', json.id) |
256 | | - resolve() |
| 263 | + if (json.id) { |
| 264 | + debug('Posted activity with attachments, assigned ID:', json.id) |
| 265 | + resolve() |
| 266 | + } else { |
| 267 | + reject(new Error(`Error posting activity with attachments: ${util.inspect(json)}`)) |
| 268 | + } |
257 | 269 | }) |
258 | 270 | } else { |
259 | 271 | debug('Posting activity ', JSON.stringify(activity, null, 2)) |
|
0 commit comments