Twilio Programmable chat: Get Deleted messages - twilio

I want to give user the ability to delete messages.
In the code I am deleting a message using : message.remove(); and the message gets delete all fine.
Now I want to show users in the chat that a message was deleted at that particular place (like in whatsapp). But channel.getMessages() gives only non-deleted messages.
Is there a way to get deleted messages from twilio?
If not possible, I am thinking to update the message when user wants to delete (deleting only the message body). Please suggest if this is the best solution.

Twilio developer evangelist here.
Deleting a message will remove the message. If you want to keep that message history, your best bet would be to add an attribute to the message to indicate that it was deleted.
You can update the attributes of a message with the message.updateAttributes() method and then listen for updates on messages with the messageUpdated event and remove the message from your UI if the attributes indicate it was removed.

Related

Is there any possible way to read message in ms teams before clicking the send button

I am trying to create a teams app that will detect the message that user has typed in before the message is sent on clicking the send button or on the send button click event or before the recipient receives the message. The idea is to read the message and using AI grammatically correct the text or detect if any inappropriate message is being sent that violets office rules, kind of like Grammarly. My question is it possible to detect this text through any possible means like graph api. i am open to any suggestion, not just teams app it can be some kind of windows application that can interact with teams app . Will be taking care of AI part myself.
This isn't supported, there is no No event when user is typing message. You can get an event when user sends the message. For more info here

Twilio SMS Webhooks and Group Text Messages

Is it possible to maintain both group text messages and single text messages with users and keep them separate? I understand there is no concept of a group message per se, but wanted to see if any recent advances in tech has made this possible with Twilio or other providers.
In short, I am creating a POC where a user inside an iOS App can send invoke an API call to my backend application. This application receives a phone number from someone's contact list, and then connects to Twilio to send the SMS message to that target user.
When the user replies, I was researching Twilio Web hooks to receive the message, and then save it in the database. The originating user, then, would be able to see the message on a screen.
I would guess that when a user responds to the twilio message, the only metadata that comes in is their message and phone number, so the "foreign key" is the phone number.. Thus when I save it in my database, I have their phone number and message.
This works up until someone decides to target two or more people in an SMS message using my API, and then target one of those people individually. For example they select me as a sole recipient, and then select me and someone else as a group text message.
In this case, how could my system/Twilio differentiate between if I was responding to the group message, or to the single message?
Any ideas or work arounds? Maybe another technology? Thanks!
I wanted to provide an answer to this in case anyone else was looking into this.
Essentially you pay 3 cents (0.03) per month per active user in each group. Basically you buy phone numbers for each group chat you need.
https://www.twilio.com/conversations/pricing
So if you're doing a million group chats obviously it can get costly, but for simple POCs this isn't the end of the world.
Enjoy!

Gmail Mailbox updates

I have created a app in Ruby on Rails in that I want to get the all updates of the gmail mailbox, I tried with push notification provided by gmail in this link https://developers.google.com/gmail/api/guides/push but in this we get only those message related to that topic, but if i want notification on my server for all the messages then what approach should i adopt,
Please let me know if any one have any idea about it.
The topic is a separate issue from what labelIds to get changes for. The reference for watch() says that if you don't specify any labelIds in the watch, then you will get all the changes to the mailbox.

Rails, check if email was sent or not

I have an app that sends email to registred users. This app sends an automatic email to the user while he is using some functions. Plus, on the admin screen, the admin can send emails to all persons that didn't get the email sent automatically for any reason. I store in database a value showing if the email was delivered or not, so the admin won't send emails to someone that already got one.
The problem is: how can I check if the email was delivered correctly in order to update this value? I am not talking about tests, I need to check right after the method deliver is called if the email was sent, or if any problem happened, like connection loss or email is invalid. Is there any method or way to do this?
Thanks.
When you send a message and no error is raised, you can assume that the mail was delivered (at least you can assume that some system accepted the responsibility to deliver your message).
Nevertheless, there are many reasons for delivery failure; sometimes you may get an error hours or even days later. You will need to have a bouncing mail address and inspect returned messages. If you want to process bouncing, inspect an open source software with bouncing treatment such as phplist. This is no so trivial as you might think.
Another alternative is send e-mails through a dedicated service such us SendGrid. This services provide APIs that will allow you to retrieve information about your messages.
You can also use the mailman gem to parse reply email messages for bad email.

Keep track of read/unread User Messages with a MessageClicks table?

I'm trying to implement a simple Inbox system for users of my app so that can send basic messages to each other - just like in many forum systems.
If User has_many :messages, how do I keep track of and notify the User of messages unread since last time they were read?
I'm thinking clicks on the link to the Messages screen need to be recorded in a separate table (MessagesClicks).
Is that the best approach here?
So then I check the MessagesClicks table to see if any new messages have arrived since the last time that link was clicked - based on a last_clicked or updated_at field.
I would keep track of when a message was read on the message itself with the default value of null.
If the user has any Messages with a dateRead value of null then they have unread messages.
When you display a message to the user on the Messages screen, update the dateRead property of the message from null to now.

Resources