1

Hello I was trying to make botkit reply with an image on my callback function but am unsure as to how convo.say() or bot.reply() would handle sending out images. Does anyone have experience making the slackbot replying with images?

Sairaj Sawant
  • 1,842
  • 1
  • 12
  • 16

1 Answers1

0

Since you're using slack, it should be possible with interactive messages.

Here's an example message object from slack's own documentation of interactive messages (found here: https://api.slack.com/docs/message-buttons)

{
    "text": "New comic book alert!",
    "attachments": [
        {
            "title": "The Further Adventures of Slackbot",
            "fields": [
                {
                    "title": "Volume",
                    "value": "1",
                    "short": true
                },
                {
                    "title": "Issue",
                    "value": "3",
            "short": true
                }
            ],
            "author_name": "Stanford S. Strickland",
            "author_icon": "http://a.slack-edge.com/7f18https://a.slack-edge.com/a8304/img/api/homepage_custom_integrations-2x.png",
            "image_url": "http://i.imgur.com/OJkaVOI.jpg?1"
        },
        {
            "title": "Synopsis",
            "text": "After @episod pushed exciting changes to a devious new branch back in Issue 1, Slackbot notifies @don about an unexpected deploy..."
        },
        {
            "fallback": "Would you recommend it to customers?",
            "title": "Would you recommend it to customers?",
            "callback_id": "comic_1234_xyz",
            "color": "#3AA3E3",
            "attachment_type": "default",
            "actions": [
                {
                    "name": "recommend",
                    "text": "Recommend",
                    "type": "button",
                    "value": "recommend"
                },
                {
                    "name": "no",
                    "text": "No",
                    "type": "button",
                    "value": "bad"
                }
            ]
        }
    ]
}

enter image description here

You can also create your own custom message from here https://api.slack.com/docs/messages/builder

Sayegh
  • 1,381
  • 9
  • 17