How many websocket subscribtions should i have in a messenger app? - events

I develop a backend part of a messenger thing of some project. And i'm wondering what whould be the best way to provide websocket stomp subscriptions to frontend.
Pseudo event list:
message delivered
message edited
chat created
user typing
etc.
should it be like:
users/id/messages/created
users/id/messages/edited
users/id/chats/created
(One subscription per event)
or:
users/id/messenger/events
and json message with EvenType to define an event

Related

Sending Discord messages from external module without using events

I intend to use a Django web application where users of the application will be able to send messages to Discord.
The idea is that this message will be sent through a Discord bot instead of webhooks so that I am able to add reactions to the messages and easily manage the message.
Is it possible to achieve this functionality using the discord.py library?
Upon researching the discord.py documentation, it seems that messages are sent as a result of certain events that occur in Discord.

How to make Slack app send a private message via an incoming webhook to someone specific?

I created a Slack app that sends a series of interactive messages to a channel. In my Slack API dashboard, I see that I can create and remove hooks. Right now the hook url that I have set up in my code is the one for the Slackbot channel.
But the problem is that such a message only gets sent to me.
I want to send the Slackbot messages to Alice in situation A, and to Bob in situation B. Not just to myself, the guy who configured the app.
What's the best way to do this?
I would suggest that you should not use hooks for this. A more sane way to do this right would be via chat.postMessage Web API method which is documented here!
This is because hooks are tied to specific conversations and that approach quickly hits a wall on what it can really achieve, especially messaging different people. Once you start using the web API it's pretty simple. Just ask for the scope during app installation (remember to add that scope in your dashboard), subscribe to the event in your API dashboard and then you are good to go.
Everytime you send a message via that method, Slack will send you a payload which you can use for testing and logging etc.
You can see all the different ways to message programmatically inside Slack here.

Microsoft Teams Bot not sending message Edit/Delete events to bot messaging endpoint

I set up an app using the App Studio within Teams and enabled a bot.
I set up the Messaging endpoint for the bot and am able to receive message and conversationUpdate events from the Teams client. This all works fine.
However, if I then edit a message in the Teams client, the messaging endpoint does not receive the text of the edited message at the messaging endpoint.
Similarly, if I delete a message, I do not receive an event indicating that a message has been deleted.
I'm wondering:
Is this expected behavior?
Is there somewhere these events have to be configured in order to receive them?
Is there an alternate way to integrate with Teams/BotFramework in order to receive these events?
Thanks!

How to make Slack Bot not respond to all the messages in the private group?

I want my bot to respond only if anyone mentions its name like #mybot.
How to achieve this?
For that you need to use the Events API and subscribe to the event app_metion.
That way your app will receive all message that directly mention your bot with #mybot.
Those messages will be sent as request from Slack to the endpoint provided for receiving events.

Automated/Bot message posting to Microsoft-Teams chat room

How can I automatically post messages to chat rooms in Microsoft-Teams? This is for one-way messaging: i.e. posting messages, not reading messages.
The big picture here is we are evaluating different Group Chat solutions, and one requirement is to post error messages to chat rooms from various services & programs.
A sensible approach seems to be to build a Bot using the REST API however just the authentication seems crazy complex, even then I can't work out how to just post a message. We're looking for a general solution that can be used simply in different scripting languages (Perl, Python, shell scripts, etc), so we don't want to use the .NET SDK or Node.js SDK.
We've already looked at Slack and Cisco Spark. Posting messages in both of these is super simple, so I'm hoping there's a similarly simple solution for Microsoft-Teams?!
For example:
In Slack you can use incoming webhooks to post messages. You use the web interface to get a unique webhook URL for each chat room, and then do simple HTTP POST to that URL (with a JSON message payload) to post to that chat room as the Bot. I had it working in 10 minutes.
In Cisco Spark you create a Bot which gives you a unique Access Token. You then get a room_id for the chat room and use those together to do an HTTP POST (again with a JSON payload) to create a message in the chat room.
So how do you programmatically post/create/send messages to a chat room in Microsoft-Teams?
The simplest way to do what you want is to post a message to a channel using an "Incoming Webhook" connector. For more information, see here: https://msdn.microsoft.com/en-us/microsoft-teams/connectors?f=255&MSPPError=-2147217396#setting-up-a-custom-incoming-webhook
What you're describing is precisely how the Office 365 Connectors work. A Connector allows you to post messages into a Group or Team using web-hooks and a simple JSON payload.
There is a playground for playing with these that is super helpful. One note however, there is a bug in the playground's webhook implementation, so for testing purposes, I would stick to the Send via Email option. This doesn't affect how these work in production, the bug is isolated to the Playground app itself.

Resources