fbradyirl / webex_bot

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

Commands not being received #48

Open SandroMarques46 opened 5 months ago

SandroMarques46 commented 5 months ago

Description

I'm trying to do a simple bot following the README.md instructions but I cannot see any commands received

I'm messaging the bot directly (used the bot email to find it on webex)

What I Did

I've tried using the same exact code as it's on the README.md. I've found this issue #12 , maybe it's because i'm messaging the bot from a gmail account? I don't have a cisco account to test it with.

Tried to remove the "approved_..." parameters or add my email to the "approved_users" and the behaviour is always the same.

Log file

image

Steps to reproduce:

fbradyirl commented 5 months ago

Strange. Can you post a screenshot of the page that shows the bot info? Are you behind a proxy?

SandroMarques46 commented 5 months ago

I'm not behind a proxy, i'm using my personal computer with home wifi. I've created two 2 bots (same webex developer account) and both of them had the same problem.

Is this the page you're looking for?

image

SandroMarques46 commented 5 months ago

It probably won't help but i've used this webex bot starter template with Ngrok and it worked fine

fbradyirl commented 5 months ago

I tried myself with a new bot I created today and new token and it works fine for me. Hard to know what exactly is going on unless you want to reach out to me with your token and I can try it myself locally.

SandroMarques46 commented 5 months ago

Just tried with my secondary gmail account and also tried with a brand new one. Nothing's happening :( . Where can I reach out to you?

Afaz-Dev commented 5 months ago

Im currently running into the same issue too

gerivives commented 5 months ago

It is not working for me either. I have tried the following as well:

fbradyirl commented 5 months ago

Please post a bot token and username (bot email) here and I can try. (you can always revoke the token later)

gerivives commented 5 months ago

Please post a bot token and username (bot email) here and I can try. (you can always revoke the token later)

Sure! Here are the details @fbradyirl: stock_manager@webex.bot and <redacted>

fbradyirl commented 5 months ago

Thanks Gerard,

It is working totally fine for me with your bot. Perhaps there is something on your network blocking web socket traffic?

image

fbradyirl commented 5 months ago
import logging
import os

from webex_bot.webex_bot import WebexBot
from webexteamssdk import WebexTeamsAPI
log = logging.getLogger(__name__)

access_token = os.getenv("WEBEX_TEAMS_ACCESS_TOKEN")

# Create a Bot Object
bot = WebexBot(teams_bot_token=access_token,
               include_demo_commands=True)

webex_api = WebexTeamsAPI(access_token=access_token)

bot.run()

This was the code I ran with.

fbradyirl commented 5 months ago

Perhaps open this page: https://websocketstest.com

fbradyirl commented 5 months ago

Also if you have a possibility to try your laptop on a different network to see if that helps. E.g. tether over 5G instead of your home wifi for example. That might rule out carrier level blocking of certain types of protocols.

SandroMarques46 commented 5 months ago

Hello, I've tried :

All of them show this page image

Let's try to debug python version then... 😅 . I've uninstalled everything I've had from python (via control panel + window apps), restarted my PC and installed 3.9.0 as it's suggested on README https://www.python.org/downloads/release/python-390/ image

Ran the command "pip install webex_bot" and then the .py file. Any other suggestion?

SinonCuriosus commented 5 months ago

It is not working for me either.

May you guys confirm if the account you are using in Webex is from a Cisco Domain?

I am wondering if the fact of being "external" has any kind of impact on the resources we are able to work with. (e.g. if just someone logged in Webex with @cisco.com or any kind of "approved" accounts scheme are able to use these bots)

fbradyirl commented 5 months ago

I am wondering if the fact of being "external" has any kind of impact on the resources we are able to work with.

I just tested with a gmail account I have, logged in as that gmail Webex user and was able to send and receive messages to my bot no problem, so seems it is not a Cisco account issue.

fbradyirl commented 5 months ago

If you can provide me with the email address used and the time you are attempting the send (UTC) I can see if I can find anything out on this.

gerivives commented 4 months ago

@fbradyirl I have just met with a colleague who works at Cisco. We set up the bot on my PC with the code example you porivded and we are seeing the messages he sends from his account on the logs, but not mine. I have tried @gmail.com accounts, as well as registering with the account from my University.

In case you want to investigate further I am sharing you some more details:

Thanks, Gerard

fbradyirl commented 4 months ago

Seems to be affecting self signup users only.

SinonCuriosus commented 4 months ago

I managed to get it working through Sandro's suggestion, using Ngrok. It would have saved me some hours having to know that the issue was "affecting self signup users only". Thanks for the troubleshooting.

fbradyirl commented 4 months ago

We are testing it now and it turns out it is not self signup users. Starting to narrow it down but it may be todo with the Python version or dependant module.

fbradyirl commented 4 months ago

Still investigating...

fbradyirl commented 4 months ago

I was testing with Gerard's GMail account logged into the WebEx web client and was able to send messages fine to my bot running locally with Python 3.11.7. However when he tries the same it is not working.

Here are my module versions:

image

image

It is certainly baffling at this point.

fbradyirl commented 4 months ago

There may be something here I can try and push a new release.

https://github.com/fbradyirl/webex_bot/issues/41#issuecomment-1890586876

doppelmalz commented 4 months ago

Hi, I'm experiencing the same issue as mentioned above. I've tested with different (personal) developer webex accounts (Registered the bot app and run as bot within that webex account(s)). However, when using my company webex account (Cisco partner) with associated bot it works fine. I can see messages in log from company webex account and personal developer account as well. For both use cases, the same bot app was setup and the same internet/cloud access was established.

Added notification stuff from #41 to DEVICE_DATA. Unfortunately I still cannot see any commands received.

Maybe it's related to the free developer account with some restrictions for associated bots.

venkatesh-hs commented 4 months ago

@doppelmalz Same here. That's a good find.

Hi, I'm experiencing the same issue as mentioned above. I've tested with different (personal) developer webex accounts (Registered the bot app and run as bot within that webex account(s)). However, when using my company webex account (Cisco partner) with associated bot it works fine. I can see messages in log from company webex account and personal developer account as well. For both use cases, the same bot app was setup and the same internet/cloud access was established.

Added notification stuff from #41 to DEVICE_DATA. Unfortunately I still cannot see any commands received.

Maybe it's related to the free developer account with some restrictions for associated bots.

doppelmalz commented 4 months ago

@venkatesh-hs The interesting thing is that the websocket flavor of the webex javascript framework (see https://github.com/WebexCommunity/webex-node-bot-framework/blob/main/docs/example3.md) works great with the free developer account. The implementation of the websocket connection or/and how the server side handles the connection in javascript seems to be different from python with regards to the free developer account.

Nevertheless I would prefer the python way.

fbradyirl commented 4 months ago

@venkatesh-hs The interesting thing is that the websocket flavor of the webex javascript framework (see https://github.com/WebexCommunity/webex-node-bot-framework/blob/main/docs/example3.md) works great with the free developer account. The implementation of the websocket connection or/and how the server side handles the connection in javascript seems to be different from python with regards to the free developer account.

Nevertheless I would prefer the python way.

If possible, could you sniff the registration part of the JS library and provide the headers and body of the request to WDM. I can compare.

doppelmalz commented 4 months ago

I'm not familiar with javascript. But enabling debug for webex-node-bot-framework and trace for webex-js-sdk provides the following output. Not sure if it helps.

webex-node-bot.log

EDIT: Put some logger statements (Keyword DEBUG) in the proper .js files (device registering and websocket connection) webex-node-bot_2.log

Thanks.

devil33 commented 3 months ago

I also do not receive anything with my customer account. Ran the bot on corporate and personal devices, seeing identical results. Would love to use this project. Any findings from the logs so far @fbradyirl ?

Edit: With further testing, I have no luck with three different paid users from different orgs. Nevertheless, a consultant from Cisco tested the bot for me and had success right away. That is, same bot, same code and same machine as well.