JILL24
How do Discord or Slack bots update messages in real-time using REST API?
I’ve been working on a project where I’m trying to understand how Discord or Slack bots function on the backend. I know bots typically use WebSocket connections to receive real-time updates, and REST APIs to send responses or updates.
My question is: how do bots manage to update messages in real-time? For instance, when a bot edits or updates a message in a channel, it happens almost instantly like WebSockets, but traditionally, this should be happening over a REST API. Similarly, webhooks also seem to perform instant updates, but I understand they also use REST APIs.
Does anyone have insights into how these bots are architected to provide real-time functionality while still using REST APIs for responses? Is there a mechanism behind the scenes that ensures this instant update behavior? Any explanation would be appreciated!
First Post!
namxam
I never built a chat bot and I am not sure what you really ask for. REST APIs can be really fast. You have a little bit of overhead compared to a we socket connection, but they are still fast.
If you are interested in the inner workings of a chat bot, I would suggest to read the code of one of the various elixir discord / slack / … libraries.







