Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #36

Open
un1v3rs opened this issue Nov 30, 2022 · 13 comments

Comments

@un1v3rs
Copy link

un1v3rs commented Nov 30, 2022

No description provided.

@gconklin
Copy link
Contributor

The Webex bots do not allow this by design. From https://developer.webex.com/docs/api/guides/bots :

A bot can only access messages sent to it directly. In group spaces, bots must be @mentioned to access the message. In 1-to-1 spaces, a bot has access to all messages from the user.

Integrations (https://developer.webex.com/docs/integrations) can be used to process messages that do not require @mentions, but is because integrations act on behalf of a user.

@un1v3rs
Copy link
Author

un1v3rs commented Nov 30, 2022

Thank you. Is there any python library that can support this "integrations"? I would like to make a Bot/Intergation that would check in the messages of the room for specific words in order to take actions

@gconklin
Copy link
Contributor

It's the same API, just a different, more complex authentication mechanism. Theoretically, you could create the auth tokens outside of this library for use with this library, though not directly supported (I suspect)

@gconklin
Copy link
Contributor

Specific to your question, I don't personally know of a library that works directly with the auth flow to make an integration.

There are examples about the oauth flow:

@un1v3rs
Copy link
Author

un1v3rs commented Nov 30, 2022

Let me give you another scenario. Let me know please if it works. Lets say that a service is sending via a bot (called XXX) a message to a webex channel. If I run your script with the token of the same XXX bot, is it going to read and react on messages sent by the same XXX bot but via the service from above? I mean the same bot and tokens are used by two in the same time.

@gconklin
Copy link
Contributor

I'm not exactly sure if I understand your question, but when messages come in, they have metadata such as the user/entity e-mail address that sent the message. With that metadata, you can filter the messages to prevent bots from talking to other bots or allow only certain users to interact with the bot.

@un1v3rs
Copy link
Author

un1v3rs commented Dec 1, 2022

I have run your script with the bot token which is set by another service. Once the bot is sending a message via the service, your script is showing me an event with the following text: "Websocket ack message with ID=xxx. Completed'". Question: How can i tune your demo script in order to run action based on the content of the message which was sent by the service (using the same bot token)? Can your libabry read the message which was sent by a other service? It the same bot for service and your demo script. Thank you

@un1v3rs
Copy link
Author

un1v3rs commented Dec 1, 2022

Btw, how can I turn on the Debug mode? How i see only INFO messages. Thanks

@darrenparkinson
Copy link

If you used the bot token to send a message from elsewhere and you're using the same bot token to receive notifications, then yes, my understanding is that you'd be able to retrieve that message using the bot token.

@un1v3rs
Copy link
Author

un1v3rs commented Dec 1, 2022

Thank so much, that answers to my question. What would be the simplest code that would respond to echo comand with a text? I see your demo include more complex case by returning adaptive cards...

@darrenparkinson
Copy link

Hi, I haven't used this particular library yet, but it looks like you can just create a Response object and pass in the relevant attributes, such as "text"?:

response = Response()
response.text = "Your message here"

@fbradyirl
Copy link
Owner

fbradyirl commented Dec 1, 2022

Yes or even simplier just reply with a string.

@un1v3rs
Copy link
Author

un1v3rs commented Dec 1, 2022

I was able to make what I want. In term of making your script to react on a message which a Bot has created via another service.

Another question here: how can I make Bot to reply to a message? In your case Bot is creating a new message, however I want Bot to reply to a message where he was mentioned into. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants