mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-18 11:39:15 +00:00
fix(contexts): 🔥 added buttons
This commit is contained in:
@@ -96,12 +96,24 @@ class DialogFlowCXContext extends CoreClass {
|
||||
}
|
||||
|
||||
if (res.message == 'payload') {
|
||||
const { values } = res.payload.fields.buttons.listValue
|
||||
const buttonsArray = values.map((values) => {
|
||||
const { stringValue } = values.structValue.fields.body
|
||||
return { body: stringValue }
|
||||
})
|
||||
return { buttons: buttonsArray }
|
||||
const {
|
||||
media = null,
|
||||
buttons = [],
|
||||
answer = '',
|
||||
} = res.payload.fields
|
||||
const buttonsArray = buttons?.listValue?.values?.map(
|
||||
(btnValue) => {
|
||||
const { stringValue } = btnValue.structValue.fields.body
|
||||
return { body: stringValue }
|
||||
}
|
||||
)
|
||||
return {
|
||||
answer: answer?.stringValue,
|
||||
options: {
|
||||
media: media?.stringValue,
|
||||
buttons: buttonsArray,
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user