简体   繁体   中英

How to set dialogflow fulfillment response json context without using webhook client?

I want to create a rich response to Facebook integration using Dialogflow fulfillment. I tried using webhook but it's not working and then I try below way directly using response and now I am facing this context binding issue.

I tried below

let responseJson = {};

    let rich = [
      {
        'text': {
            'text': [
                text
            ],
        },
        'platform': 'FACEBOOK'
      },
    ];

    responseJson.fulfillmentMessages = rich;

    responseJson.outputContexts = context;

    response.json(responseJson);

my context JSON

{ name: 'MAINTENANCE_REQUEST', lifespan: 5, parameters: { maintenanceRequest: maintenanceRequest }}

To add a custom payload without a webhook, go to your intent, and scroll to the bottom where it says "responses". Click on the plus sign (picture) and click on the facebook option. Click on the add responses -> custom payload. The format and available fields for the custom payload are described here . Delete the "Text Response" if it's there so the custom payload will be the only one to be returned.

Dialogflow 控制台

在此处输入图像描述

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