Skip to content

Commit 5f574e7

Browse files
author
Botium
authored
Merge pull request #16 from codeforequity-at/develop
Develop
2 parents 753bee0 + 5b817cb commit 5f574e7

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

index.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const util = require('util')
12
const uuidv4 = require('uuid/v4')
23
const mime = require('mime-types')
34
const _ = require('lodash')
@@ -212,6 +213,13 @@ class BotiumConnectorDirectline3 {
212213
activity.text = msg.messageText
213214
}
214215

216+
if (msg.forms) {
217+
activity.value = {}
218+
msg.forms.forEach(f => {
219+
activity.value[f.name] = f.value
220+
})
221+
}
222+
215223
if (msg.media && msg.media.length > 0) {
216224
debug('Posting activity with attachments ', JSON.stringify(activity, null, 2))
217225
const formData = new FormData()
@@ -248,12 +256,16 @@ class BotiumConnectorDirectline3 {
248256
},
249257
body: formData
250258
}).catch(err => {
251-
debug('Error posting activity', err)
259+
debug('Error posting activity with attachments', err)
252260
reject(new Error(`Error posting activity: ${err}`))
253261
}).then(async (res) => {
254262
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+
}
257269
})
258270
} else {
259271
debug('Posting activity ', JSON.stringify(activity, null, 2))
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
form
2+
3+
#me
4+
BUTTON card inputs
5+
6+
#bot
7+
Welcome to Mockbot v4!
8+
9+
#bot
10+
BUTTONS Open Url|Submit|Show Card
11+
12+
#me
13+
FORM SimpleVal|myname
14+
FORM UrlVal|myhomepage
15+
FORM EmailVal|myemail
16+
FORM CompactSelectVal|2
17+
FORM MultiSelectVal|1;2
18+
FORM IsCool
19+
20+
#bot
21+
You posted

0 commit comments

Comments
 (0)