Private chat with bot

Hi everyone!

Is it possible to receive messages from privet chat with a bot ( 2022-11-09_13-32-45 )?

I only found information about outgoing webhooks, but they are for public channels, and about slash commands, but this is very unusual to use slash command in every message to bot.

Hi omnitest805,

a bot works just like a normal user account if you wish, so it is capable of listening to incoming events which also includes direct messages. You will have to write a small program that does this for you, though, the bot itself is just an account which does not do anything what you do not tell it.
So basically you would have to write a small tool that connects to your Mattermost server using the credentials of the bot account and in this tool you will then have to wait for incoming messages and once you receive one, you can then react to it with what ever action you need.

Thanks again for the reply :slightly_smiling_face:

How it is possible? Through websocket’s? We can’t use websockets in our case :slightly_frowning_face:

Is there any other possibilities to receive messages from private chat with a bot?

Most of the functionality depends on websockets, because only that way you can subscribe to events and get instant notifications, but you can also work around that and use API calls like GetPostsForChannel and poll your Mattermost server with the bot token in regular intervals.