Twitter: Unread direct messages using the Twitter API - api

Twitter:
I must be blind, but how would I find out how many unread direct messages a certain user has?
I'm using this documentation: https://dev.twitter.com/docs

Unread is a vaguely defined term. Unread is usually used in a specific client application. So, for instance, if you are using Twitterrific in two different machines with the same user account, both client instances will have different unread messages with respect to each other.
If you want to keep track of unread messages for your client, you must store the last message read ID. Each Twitter status is uniquely identified by a long number representing a global message ID, so it should not be difficult to accomplish.

Currently, Twitter doesn't offer this functionality. There is no way, currently, for Twitter to store which direct messages(or mentions or statuses for that matter) a user has read or hasn't read.
Though I believe they are looking into it.

Related

Firebase Cloud Messaging sending messages one by one

I am developing an app where I want to send notifications to multiple users from my backend server. These notifications will contain 4 different contents, three of them will go to 3 different users, but the forth one will go to more than 1000 users, the frequency of theses messages will be 3 to 7 times a week. Is it ok to send this amount of messages one by one using the Cloud Messaging api? Or should I group the messages before sending?
I thought about creating a topic in the Cloud Messaging, and subscribe the users to it and then send a message, but I don't if it is correct to keep subscribing/unsubscribing users just to send one message.
NOTE: I've never used any push notifications service before.
The Firebase Cloud Messaging infrastructure delivers billions of messages per day. The volume you're describing sounds well within reason for it.
Without knowing more about the use-case it's hard to say whether using a topic would be a better approach, so I recommend reading the documentation on topic messages to get a better understanding for it.

How to chat and call automatically in MS Teams?

I'm working on a solution to build a system that automatically alerts users on Microsoft Teams. The order of execution will be:
Automatically scan alarm logs
Sort and send MS Teams messages to personnel for corresponding processing
If the processing staff does not receive the message, make a call on MS Teams to read the pre-recorded voice record.
I used python to automatically get the warning list, to send this alert list to the handler, I have tried MS Teams REST API but it only supports sending messages to Channel. How do I automatically chat and voice calls to an MS Teams user? Can chatbot help me with this problem? I see there are many types of bots that can be added to the conversation:
I think a chatbot is definitely the best way to deal with this. Essentially, you're wanting the bot to message a user on demand, which is something called "Proactive Messaging". You can read more here and here. There are a few things you need to know about this, but in a nutshell you need a way to specifically identify the user for sending the message, which you can get when the user first installs your bot (mostly you need "ServiceUrl" and "ConversationId").
With regards to knowing if the user has read the message, you might want to send an "adaptive card" with a button for the user to acknowledge that they've read the message, and if you don't get a callback within some time frame, start the voice call.

How to manage in RASA an unique user_id for many channels in parallel?

I have to design an e-learning tutorbot that has multiple possible channels living in parallel:
A live chat (to support learner with FAQ when browsing the e-learning application website)
A IM chat as Telegram (for asyncronous notifications)
An email (for anything else)
...
Take a part the connectors gateway communication logics.
My problem/question is mainly about how to manage user identification.
I want that a user is identified with an unique identifier (call it conversation_id) regardless of channel.
In the mentioned scenario user has one different ID for each channel:
An account_id on the website (e.g. solyarisoftware)
A chat_id on Telegram (e.g. 1234567890)
An email_address (e.g. giorgio.robino#blabla.com)
So, how to let RASA chatbot accept requests coming from the same user (but from different channels)? In other words, how can I map multiple channel IDs into a RASA unique ID, say the conversation_id ?
At the end of the day I need to generate a lookup table that map a UUID with all channel ids. Right?
But is not clear to me what's a good (simple) user experience. At first glance seems to me that that I need a sort of login/registration flow: each time user submit a request on channel X, only for the first time, the user must identify himself somewhere (with his email/account_id?). So by example trough Telegram, when the Telegram connector server receive a /start command, the bot must ask the user email(or account_id), to be able to associate 1-to-1 the TG chat_id with that email. Not perfect in terms of security, I admit.
Any experience/idea/suggestion?
Thanks/giorgio
I don't have an hands-on experience on this but it is something I have been thinking myself for a while.
Indeed the 'merge' of the different accounts (across channels) is something that we need to maintain ourselves, making sure each channel user ID is eventually mapped to a universal user ID (lookup table makes sense to me).
Since you have a website, an email address and multiple channels I would say the assumption is that users first registered on the web site. Each user has a unique email address and obtains an account secured by username/password, as well as a unique secret token.
When chatting on browser (ie Rasa WebChat) you can initialise the plugin with custom parameters (ie userId=1 or token=X), in this case the chat session is assigned to the given user id.
When using Telegram (or other messenger application) I would (at the very first access) ask the user if he/she has already registered. If yes then I would ask the token: this can be used to perform the map and link this Telegram user to the universal user Id. Same approach for other channels.
Depending on your needs you might need to deal with anonymous access (users don't provide the token) or maybe you want to provide a different token for each channel (more secure, but requires more work and an easy way to explain this to users).
Finally something to look at (I haven't tried myself) is the possibility to provide in the web site the option to open Telegram (or others) passing an extra parameter, which would allow you to perform the mapping. I don't know if this is possible, but it would simplify this process for your end users. Or the other way around: the users in Telegram could be provided with a link which opens the website, where they can login and be recognised.

How can a telegram bot broadcast a message to active chats / users

We are building an internal bot to monitor / control our software. It is NOT exposed to the public and will be used by other team members, either directly (as a direct chat) or through a few channels depending which side of the software is on topic.
The bot should do two things:
reply to commands; the reply should go to the user that originated it.
send notices to all users / channels it is involved in.
When a message arrives, I can get the channel id and the user id; while the user id is kind of guaranteed to exist for while, what is the situation with the channel?
Can I store the channel id and broadcast messages to all channels the bot is involved in? what happens if a channel is closed? do channel ids have lifetimes?
I can't really find anything online about the best practice regarding this scenario.
I have doubt Understand what you want but it seems better know these things :
ID's are unique in Telegram and even in all others applications so
they are lifetime
Channel ID , Groups ID , User ID have same behavior but their difference is on their integer. (User ID's are Positive but channels and groups are Negative. check example here)
Users can just send message in channels that they have admin permission in it right? Bots are same. so if your bot isn't admin anymore , the Telegram gives you error in response and you can check it and after facing that error delete that channel ID in your channels list.
I hope this information help you but if you have any other question feel free to leave a comment and I'll update the post and answer you immediately.

Telegram groups, supergroups, and channels

I'm new to Telegram. I need a clarification about one of the features of Telegram.
After creating groups or channels in Telegram, is there a way to know which recipients have received the message, and which recipients have actually read the message?
I know this functionality is available in Whatsapp, I was wondering whether Telegram also provide this functionality.
No telegram doesn't have that functionality yet. The moment you send a message to either a group, supergroup or channel, it is perceived as sent and read, however channels show you the actual number of people who have read the message.
You can however see the most active users by time spent on a supergroup using a third-party bot like ComStatbot.
Normal groups on telegram are the equivalent to Whats App groups. I recommend you to always convert to supergroup due to more functions.