cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
452
Views
0
Helpful
1
Replies

Webex ChatBot with Outlook

juliaSilva
Level 1
Level 1

Hi, i am Julia, a beginner python developer. 

So, i was trying to add an action to a button on my starting card, this button should open an outlook window with an edited email. The code that should open an outlook window is working with no problems. But, when i add this code to a function or a class in my code with the button of Webex bot card i have multiples errors, with classes and functions, and the most of the times, the bot run, open the outlook window and just stop, or continue to running but if you press the button nothing happens.

This is my last code :

 

import logging
import win32com.client as win32
from webex_bot.models.command import Command
log = logging.getLogger(__name__)


class TesteEmail(Command):
def __init__(self
super().__init__(
command_keyword="email",
help_message="Envie seu chamado para a T.I!",
card=None,

)


class Chamado(Command):
def __int__(self, recipient, subject, text, outlook):
super().__init__(
help_message="Envie seu chamado para a T.I!",
)
outlook = win32.Dispatch('Outlook.application')
self = outlook.CreateItem(0)
self.To = "person1@gmail.com"
self.Subject = "Auto test mail"
self.HtmlBody = """
#html code here
"""
self.Display(False)

 I will be so glad if someone could help me to make it work, and just open the outlook window when the user press the button. Thank you !

1 Reply 1

dstaudt
Cisco Employee
Cisco Employee

Can you provide some details on how this bot is put together and is intended to work?  Where is the bot process/script running (cloud, server, your PC?)

If the bot is not running on your PC, I'm not sure I understand how the Outlook email creation code is supposed to get executed (on your PC?)  Assuming you are using the Action.Submit
If the bot is running somewhere else (a server, in the cloud, etc.), then I don't think your Python code (which probably needs to run on your local PC) running on the bot's host is going to work.
The main challenge is that the adaptive card, as rendered inside the Webex client, is not going to be able to run arbitary code (i.e. your email creation code.)  A card action can submit JSON data to the bot application, which can then do something, but it can't execute Python code.
Adaptive card actions can, howevever, launch URLs.  It seems Outlook has some facility for being cross-launched from browsers via protocol handler.  Note sure how/if the Webex client will handle a 'mailto:' protocol (vs. the 'https:' protocol), but it might 'just work' (or it might launch an annoying interim/empty browser window, or it might ignore non https protocols...)

Getting Started

Welcome to the Webex Community. This is your home to ask questions, share knowledge, and attend live webinars.