crispy
crispy

Reputation: 91

Custom payload for platforms like Telegram, Facebook, Slack for DialogFlow in Nodejs

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

Information

  1. DialogFlow API version: V2 API
  2. Node version: v8.10.0
  3. body-parser version: ^1.18.3
  4. express: ^4.16.4
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: []
});

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.

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

Upvotes: 1

Views: 1280

Answers (1)

hfurkanvural
hfurkanvural

Reputation: 590

Option responses(such as Carousel and List) are response type of actions-on-google modules and it is created for Google Assistant. Every platform has different screen abilities so you can not use every response type for every platform. As far as I know, there is no carousel or list type supported by Telegram. You may consider to use different options. For more information you may check out :

Rich messages

Upvotes: 1

Related Questions