fbradyirl / webex_bot

Python package for a Webex Bot based on websockets.
MIT License
68 stars 44 forks source link

Example if Response with file attachement #29

Closed wardjallen closed 2 years ago

wardjallen commented 2 years ago

Description

Looking for an example of a response with file attachment

gconklin commented 2 years ago

This worked for me. Set Response.files to the name of the file to be attached.

According to the code that the files is passed to, you can only have one attachment for now even thought it accepts a list.

https://github.com/CiscoDevNet/webexteamssdk/blob/master/webexteamssdk/api/messages.py#L199

from webex_bot.models.command import Command
from webex_bot.models.response import Response

class AttachmentCommand(Command):
    def __init__(self):
        super().__init__(
            command_keyword="attach",
            help_message=f"Attach command",
            )

    def execute(self, message, attachment_actions, activity):
        response = Response()
        response.text = "Displayed when text only support"
        response.markdown = "Displayed when **Markdown** support"
        response.files = "./example.py"
        return response
wardjallen commented 2 years ago

Thanks

vikas00074 commented 1 year ago

How to reply multiple files, anyone have idea?