1

I am building a google dialogflow chatbot for COVID-19 data. I have created a intent which will call a webhook service. This service is a python flask app which is gathering data & processing the data. My use case is the user will ask for details of a locality. I am creating an image (.png file) in my flask app. But how can I return it back to dialogflow?. Till now, it accepts images that have a public URL. But in my case, I don't have a public URL. each image is dynamic in nature based on user input. Can anyone help how I can achieve this? Any help appreciated. Let me know any details.

Meet Sinojia
  • 121
  • 1
  • 1
  • 8
sid bhat
  • 11
  • 1

1 Answers1

1

you need your backend (another app or another endpoint of the same webhook) to provide the image as if it was a standard download.
For example in DialogFlow you would configure a custom payload to display the image

{
"metadata": {
"templateId": "11",
"contentType": "300",
"payload": [
  {
    "name": "Download",
    "action": {
      "type": "link",
      "url": "#avatar.avatarUrl",
      "openLinkInNewTab": "yes"
    }
  }
]
},
"platform": "kommunicate"
}

The url #avatar.avatarUrl would be the URL to fetch a given image (ie http://myserver/get/image0001): this is an endpoint which gets the image you want (based on your logic and implementation) and returns a stream with the content of the image as well as setting the content-type=image/png (or other suitable type).

Example above might depend on which channel you use (browser? chat app?) and programming language, but the approach should be valid in any case.

Beppe C
  • 11,256
  • 2
  • 19
  • 41