Comments (18)
Hi @akshaykadidal-
How are you initializing your bot? Have you set an "approved_*" parameter on the constructor to allow yourself to talk to the bot. There's 3 approved parameters:
@param approved_users: List of email address who are allowed to chat to this bot.
@param approved_domains: List of domains which are allowed to chat to this bot.
@param approved_rooms: List of rooms whose members are allowed to chat to this bot.
To allow your specific user, you would do something like this:
bot = WebexBot(teams_bot_token=os.getenv("WEBEX_TEAMS_ACCESS_TOKEN"),
approved_users=["[email protected]"], # add your e-mail address here
bot_name="My Teams Ops Bot",
include_demo_commands=True)
from webex_bot.
I have not filled in any of these optional parameters. I see that I get a warning.
[WARNING] [webex_bot.webex_bot.webex_bot.approval_parameters_check]:117 Your bot is open to anyone on Webex Teams. Consider limiting this to specific users, domains or room members via the WebexBot(approved_domains=
I update the code to add the approved domains and my email IDs.
I readded the bot the result is the same.
how can I check if my requests are reaching the websocket?
from webex_bot.
In a 1:1 conversation with a bot, I see log messages like:
2023-09-04 17:39:59 [INFO] [webex_bot.webex_bot.webex_bot.process_incoming_message]:198 Message from my.email.com: Webex Teams Message:
{
...json blob...
}
2023-09-04 17:39:59 [INFO] [webex_bot.webex_bot.webex_bot.process_raw_command]:216 New user_command: a test message
2023-09-04 17:39:59 [INFO] [webex_bot.webex_bot.webex_bot.process_raw_command]:217 is_card_callback_command: False
2023-09-04 17:39:59 [WARNING] [webex_bot.webex_bot.webex_bot.process_raw_command]:236 Did not find command for a test message. Default to help card.
My "driver" script is really simple with a fresh checkout:
~/dev/webex_bot$ cat tester.py
import os
from webex_bot.commands.echo import EchoCommand
from webex_bot.webex_bot import WebexBot
# Create a Bot Object
bot = WebexBot(teams_bot_token=os.getenv("WEBEX_TEAMS_ACCESS_TOKEN"),
bot_name="My Teams Ops Bot",
include_demo_commands=True)
# Add new commands for the bot to listen out for.
bot.add_command(EchoCommand())
# Call `run` for the bot to wait for incoming messages.
bot.run()
from webex_bot.
No other events are recorded nothing in the logs to show that an event was recieved.
time stamps are diffrent because the VM is probably showing GMT.
from webex_bot.
Where are we on this issue? I'm having the exact same observation.
from webex_bot.
Are you behind a proxy?
from webex_bot.
I don't think so, but I don't want to give the false response. I'm in the campus network and I'm waiting the response from IT.
from webex_bot.
I worked with IT and they guided me to disable the virtual proxy in the cloud. However after that, I'm still having the same observation.
On the terminal, it only shows the following logs. No events displayed when webex client chats to the bot.
...
2023-11-15 10:18:06 [INFO] [webex_bot.webex_bot.webex_bot.init]:49 Registering bot with Webex cloud
2023-11-15 10:18:06 [INFO] [restsession.webexteamssdk.restsession.user_agent]:169 User-Agent: webexteamssdk/0+unknown {"implementation": {"name": "CPython", "version": "3.10.11"}, "system": {"name": "Windows", "release": "10"}, "cpu": "AMD64", "organization": {}}
2023-11-15 10:18:07 [INFO] [webex_bot.webex_bot.webex_bot.get_me_info]:90 Running as bot 'CCReport' with email ['[email protected]']
2023-11-15 10:18:07 [INFO] [webex_websocket_client.webex_bot.websockets.webex_websocket_client._connect_and_listen]:160 Opening websocket connection to wss://mercury-connection-partition2-a.wbx2.com/v1/apps/wx2/registrations/a26872de-a8ce-44ab-b414-143081f04e57/messages
2023-11-15 10:18:07 [INFO] [webex_websocket_client.webex_bot.websockets.webex_websocket_client._connect_and_listen]:163 WebSocket Opened.
The network connection looks all OK.
nc -zv 170.72.231.161 443
Connection to 170.72.231.161 port 443 [tcp/https] succeeded!
Any suggestions?
from webex_bot.
Are you doing a 1:1 chat or in a room? If it's a room, you need to invite the bot and @tag
it.
You can turn on debug logging and see if that reveals anything. You should see some PING/PONG messages.
logging.getLogger("webex_bot.websockets").setLevel(logging.DEBUG)
logging.getLogger("websockets").setLevel(logging.DEBUG)
from webex_bot.
I'm on 1:1 chat. Here is what I did:
1, Deleted the bot and recreatd [email protected] on developer.webex.com. Just in case.
2, Updated the example.py with 3 new lines per your suggestion:
import logging
ogging.getLogger("webex_bot.websockets").setLevel(logging.DEBUG)
logging.getLogger("websockets").setLevel(logging.DEBUG)
3, Set the environment and run python example.py on my Windows machine:
2023-11-16 09:43:16 [INFO] [webex_bot.webex_bot.webex_bot.init]:49 Registering bot with Webex cloud
2023-11-16 09:43:16 [INFO] [restsession.webexteamssdk.restsession.user_agent]:169 User-Agent: webexteamssdk/0+unknown {"implementation": {"name": "CPython", "version": "3.10.11"}, "system": {"name": "Windows", "release": "10"}, "cpu": "AMD64", "organization": {}}
2023-11-16 09:43:17 [INFO] [webex_bot.webex_bot.webex_bot.get_me_info]:90 Running as bot 'Report1116' with email ['[email protected]']
2023-11-16 09:43:17 [INFO] [webex_websocket_client.webex_bot.websockets.webex_websocket_client._connect_and_listen]:160 Opening websocket connection to wss://mercury-connection-partition1-a.wbx2.com/v1/apps/wx2/registrations/e207328b-c20c-4785-b413-c8511e66f872/messages
2023-11-16 09:43:17 [INFO] [webex_websocket_client.webex_bot.websockets.webex_websocket_client._connect_and_listen]:163 WebSocket Opened.
4, on the searching header of my webex client, I filled in [email protected]. Type something there.
Unfortunately no response. On the terminal, nothing is displayed.
Is there a way to check if Webex cloud receives any info to the given bot and if webex cloud ever tried to send request to my Windows computer?
from webex_bot.
Sorry, I forgot the webex bot creates its own logging handler which kind of breaks the normal python logging config.
Try setting env var LOG_LEVEL=DEBUG
before starting the bot. My commands didn't actually enable debug logging.
Is there a way to check if Webex cloud receives any info to the given bot and if webex cloud ever tried to send request to my Windows computer?
No, not that I'm aware of.
from webex_bot.
With the update, it does pop up a lot on the terminal. Enve ping/pong looks all good, I still don't see any response in webex client. No updates on logs either.
logs.txt
from webex_bot.
I don't have an answer. I agree the logs look ok and don't see an obvious problem. I talked with someone and the recommendation was to try the (supported) project at https://github.com/webex/webex-js-sdk/ to see if that works/fails.
If that also fails, then will have more leverage with webex support.
If it works, then we'd need more info to determine what the difference is. As it is now, I've never seen webex_bot not work in the few years I've been using it, so I can't duplicate this failure case.
from webex_bot.
I am having the same issue
from webex_bot.
So I tried running the code on replit, to see if the issue is something on my side, but it still doesn't work, any ideas?
from webex_bot.
Same issue here. node bot is working well. Could be something related to socket package 10.2?
from webex_bot.
Hi figure out, Cisco changed some configuration about device data, please register for the notification over the websocket in the device data:
DEVICE_DATA = {
"deviceName": "pywebsocket-client",
"deviceType": "DESKTOP",
"localizedModel": "python",
"model": "python",
"name": "python-spark-client",
"systemName": "python-spark-client",
"systemVersion": "0.1",
"features": {
"user": [
{
"key": "direct-message-notifications",
"val": "true",
"mutable": True,
"lastModified": "2019-07-03T09:18:54.806Z",
"type": "USER",
"deletedTime": 0
},
{
"key": "group-message-notifications",
"val": "true",
"mutable": True,
"lastModified": "2019-07-03T09:26:51.902Z",
"type": "USER",
"deletedTime": 0
},
{
"key": "mention-notifications",
"val": "true",
"mutable": True,
"lastModified": "2019-07-03T09:25:21.164Z",
"type": "USER",
"deletedTime": 0
},
{
"key": "web-color-theme",
"val": "true",
"mutable": True,
"lastModified": "2021-06-08T13:48:46.908Z",
"type": "USER",
"deletedTime": 0
}
]
}
}
from webex_bot.
Related Issues (20)
- send an attachment .txt or xlsx file ?
- `AttributeError: 'WebexBot' object has no attribute 'command'`
- TypeError: 'staticmethod' object is not callable, when run the 'help' command - Bug HOT 1
- Future exception was never retrieved HOT 2
- default help card is annoying HOT 3
- webexteamssdk.exceptions.ApiError: [400] Bad Request - Unable to retrieve content HOT 2
- The card displayed for Help restricts the number of buttons to 5 HOT 3
- Example if Response with file attachement HOT 3
- How to add more command_keyword
- Websockets.exceptions.ConnectionClosedError HOT 3
- Running webex_bot on Ubuntu 20.04 gets TypeError on action response
- Websocket connection through Proxy Server HOT 3
- How can we make bot to listen and respond to messages which do not reffer directly to it? Without bot being tagget in the message HOT 13
- Help get user info within command function.. HOT 1
- Bot not responding to messages with attachments (no log output either).
- Webex_bot do not work behind proxy HOT 1
- ModuleNotFoundError: No module named 'imp' HOT 4
- How to do multi-post responses HOT 1
- Commands not being received HOT 30
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webex_bot.