Skip to content

Instantly share code, notes, and snippets.

@PamornT
Created January 23, 2020 09:17
Show Gist options
  • Save PamornT/80f9dbc98d6617ec43674e18b293fac9 to your computer and use it in GitHub Desktop.
Save PamornT/80f9dbc98d6617ec43674e18b293fac9 to your computer and use it in GitHub Desktop.
const structjson = require('./structjson');
const intentResponseMessage = intentResponse.queryResult.fulfillmentMessages
const replyMessage = intentResponseMessage.map( (messageObj) => {
let struct
if (messageObj.message === "text") {
return {type: "text", text: messageObj.text.text[0] }
} else if(messageObj.message === "payload") {
struct = messageObj.payload
return structjson.structProtoToJson(struct)
}
return null
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment