How to send images as bot responses in Slack?

(Bhargav) #1

Hi,

I want display images in the chat bot in slack. Can anyone please help me on how to send images from rasa to slack

Thanks in advance,

(Abhinav) #2

You can use urls for images or create a simple REST API for getting the image in rasa actions server using custom actions…there is a parameter image in dispatcher. dispatcher.utter_template(“utter_greet”,tracker, image=“image_url”)

Hope it helps…:slightly_smiling_face:

(Ella Rohm-Ensing) #3

Hey @Bhargav, you can also create a template in your domain file that has an image like so:

  utter_cheer_up:
  - text: "Here is something to cheer you up:"
    image: "https://i.imgur.com/nGF1K8f.jpg"

then you can use the utter_cheer_up action directly or via dispatcher.utter_template("utter_cheer_up", tracker).

(Bhargav) #4

Hi @imabhinav-am , @erohmensing,

Thank you very much. This is working fine :slight_smile:

(Bhargav) #5

One small information. Can we send the images from our local path\system. I am trying to do that. Its not working :frowning_face:

(Abhinav) #6

For that you have to create an API on your system or host the image somewhere on internet

(Bhargav) #7

HI @imabhinav-am,

Can you please explain me more about how to create API?

Thanks,

(Ella Rohm-Ensing) #8

@Bhargav are you able to do it with the file URI scheme? file URI scheme - Wikipedia

Depending on your OS it should look something like file:///path/to/image.png or something like that

(Bhargav) #9

Hi @erohmensing,

I tried the file url but this is not working