dialogflow / fulfillment-webhook-json

Dialogflow's Fulfillment: Webhook JSON (Requests & Responses)
Apache License 2.0
191 stars 70 forks source link

Custom payload for platforms like Telegram, Facebook, Slack #17

Open crispywong opened 5 years ago

crispywong commented 5 years ago

Hi,

I would like to ask how to custom payload for carousel, image in other platforms like Facebook, Telegram and etc.

Information

DialogFlow API version: V2 API Node version: v8.10.0 body-parser version: ^1.18.3 express: ^4.16.4

This is code snippet to return carousel response to Telegram and Google. It worked in google assistant but failed to display carousel list in Telegram. Only text "Category list" was displayed in Telegram.

return res.json({
          payload: {
            google: {
              expectUserResponse: true,
              systemIntent: {
                intent: "actions.intent.OPTION",
                data: {
                  "@type":
                    "type.googleapis.com/google.actions.v2.OptionValueSpec",
                  carouselSelect: {
                    items: [
                      {
                        optionInfo: {
                          key: "car",
                          synonyms: ["automobile", "vehicle"]
                        },
                        description: "A four wheel vehicle",
                        title: "Car"
                      },
                      {
                        optionInfo: {
                          key: "plane",
                          synonyms: ["aeroplane", "jet"]
                        },
                        description: "A flying machine",
                        title: "Plane"
                      }
                    ]
                  }
                }
              },
              richResponse: {
                items: [
                  {
                    simpleResponse: {
                      textToSpeech: "Category List"
                    }
                  }
                ]
              }
            },
            telegram: {
              text: "Category list",
              expectUserResponse: true,
              systemIntent: {
                intent: "actions.intent.OPTION",
                data: {
                  "@type":
                    "type.googleapis.com/google.actions.v2.OptionValueSpec",
                  carouselSelect: {
                    items: [
                      {
                        optionInfo: {
                          key: "car",
                          synonyms: ["automobile", "vehicle"]
                        },
                        description: "A four wheel vehicle",
                        title: "Car"
                      },
                      {
                        optionInfo: {
                          key: "plane",
                          synonyms: ["aeroplane", "jet"]
                        },
                        description: "A flying machine",
                        title: "Plane"
                      }
                    ]
                  }
                }
              }
            }
          },
          outputContexts: []
        });

Is there any mistake in the payload for Telegram? Could anyone provide guidance on this?

Thanks in advanced.

Thank you.

Regards.

hcharley commented 5 years ago

Hi, I also have this question.

nguyendn commented 3 years ago

Same here, I tried the payload below on Slack but only fulfillmentText works

          "fulfillmentText": "This is a text response",
          "source": "local",
          "payload": {
            "slack": {
              "text": "This is a text response for Slack."
            }
          }
 }
Screen Shot 2021-01-20 at 2 09 56 PM