简体   繁体   中英

postback for reast ai sap conversation

Recast ai Or Sap Conversational Bot

I want to know the postback for recast ai means when someone click on quick replies it can answer from webhook

const express = require('express')
const bodyParser = require('body-parser')

const app = express() 
const port = 5000 
app.use(bodyParser.json()) 
// response
app.post('/', (req, res) => {
  console.log(req.body)

  res.send({
    replies: [{
        type: 'quickReplies',
        content: {
          title: 'Sorry, but I could not find any results for your request :(',
          buttons: [{ title: 'get quiz', value: 'quiz' }],
        },
      },)
})

app.post('/errors', (req, res) => {
  console.log(req.body) 
  res.send() 
}) 

app.listen(port, () => { 
  console.log('Server is running on port 5000') 
})

The postback would be the value of the quick reply. Meaning: when a user is going to click on the button the value is going to be sent to the builder. If you want to trigger a webhook from the postback the trick consists of having a unique value such as POSTBACK and then you can set this as a trigger from another skill doing if _source is POSTBACK then do a webhook call.

Hope that answers the question :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM