How to get unread message via rest api in Rocket.chat without providing a date? - rocket.chat

I'm trying to get the number of unread messages. This answer provided an answer by adding a date to the rest endpoint. This seems fine but requires you to store a date somewhere which can ofcourse be deleted. However, the rocktchat webclient seems to do it in another way. Deleting the browser history or login in somewhere else will still result in the same number of unread messages. So I guess they are not providing a date? How can I get the number of unread messages without providing a date?
Version of Rocket.Chat Server: 0.61.1

If you have no "updated at" date at hand (cleared history or else) you should probably just pass a very old date in.
probably: var unixTimeZero = Date.parse('01 Jan 1970 00:00:00 GMT');
However you might want to ask the user if he wants to pull the last 2 days, or "all". Maybe "1 week".
Slightly offtopic: Please do this. I use google mail on my android and when I need the latest email, but haven't updated in 3 weeks, I'm getting a looot of mails I don't need. (note: I have auto-sync off)

Related

Recurring email with reminder

I am quite new on power automate tool (started today) and I have a task that I am trying to accomplish but I can't because I don't have so much experience on that so I will describe below:
1 - I need to send recurring emails every friday 8am with an attachement for some email adressess
ps: this part I have already done as you can see on the link
Click here
2 - After 72 hours(monday 8am) the people that didn't reply would receive another e-mail asking for the answer.
Can you people from the community help em with that ?
Thanks all and have a nice day :grinning_face_with_big_eyes:
To do this automatically would require that the response is stored somewhere that can be accessed by Power Automate, then write another timed flow which filters for the response (or lack of it).

Triggering scheduled reminders based on new Intercom customers

I don't even know if SO is the right place for this question but I thought I'd give it a go as I've found answers on here before.
I'm trying to solve the following issue using widely available SaaS tools if possible as non devs will be using/managing this process.
We are trying to set up an internal scheduled reminder system for our team to make following up with our customers easier, Our work tool set is pretty standard:
Our CRM is Intercom,
Slack is used for internal chat
Notion for task management
Stripe for payments.
We would want it to go a little like this:
1.Customer signs up.
2.Intercom tags new customer.
3.Tag Triggers scheduled reminders (After 1, 3, 5, 7 days etc.) in Slack or Notion (preferably)/ or something else.
I've looked into Triggering reminders in Slack based on new messages in a channel as well as Using Zapier and IFTTT but haven't found a way thus far.
Any advice on tools/services that would help would be appreciated.
This is easily achievable on zapier.
It would look something like this.
trigger (customer signs up), Intercom: New Company
optional: add a filter where it will only continue if the new company has certain
tags
action, "delay by zapier" 1 day
do something, ie. post to slack/send email..
action, "delay by zapier" 2 days
do something, ie. post to slack/send email..
action, "delay by zapier" 2 days
do something, ie. post to slack/send email..
action, "delay by zapier" 2 days
do something, ie. post to slack/send email..

How to improve email robustness? [mailgun, laravel]

I planned to improve email robustness using below way. I am using laravel and mailgun. If any bounces email is in the mailgun then i want to send that to someone related to the email(not to that previous receiver and it related with previous sender or someone) so that i plan to use Task scheduler and schedule every hour this process. After that email send successfully i want to remove that email from mailgun.
I actually want to know how to implement get bounces email from mailgun and if send successfully using Task scheduler i want to remove that email from mailgun. if any sample's to achieve this? or any different ideas?
Normally when a bounce happens, providers such as Mailgun will retry a few times depending on the bounce status/type. After failing to send to that email address, Mailgun will put that address into your Bounces list to avoid sending to that address in the future. There's really no point in trying to send emails to an address which doesn't exist, inbox is full, domain expired, etc. So perhaps you should review your bounce list before you consider doing this. Mailgun's dashboard provides the description and date it happened. If you wish to send to a particular address again, you can remove the address from the bounce list. More about bounces here.
You can use mailgun-php or simply use Guzzle to call their API to retrieve your bounces. I'm not sure what you meant my removing email, but hope this helps.
Edit:
You can use their API to get all your bounces, and also the message content (retention depends on your plan or settings) if you need the original content. You could also use their webhooks to get the failed emails, so you don't really need to schedule/cron.
Edit 2:
The bounce list only stores email addresses of previously bounced emails. Also, I just realized that, if you're checking hourly for bounced messages, looks like the suppression/bounce API won't be of much help since you can't know if a message has failed for an address already on the list. This is the only data from bounce list:
{
"address": "alice#example.com",
"code": "550",
"error": "No such mailbox",
"created_at": "Fri, 21 Oct 2011 11:02:55 GMT"
},
So looks like you've to use the events API or webhooks to get the failed messages.
I've used mailgun-php sometime ago, and I found that the it wasn't easy working with Events on that library due to protected properties of the class. So if you have trouble, maybe just use Guzzle or use webhook approach instead.

gmail API Users.messages: list is not getting replies

If I make a request to the gmail API for Users.messages.list it will return 100 of the newest messages.
If I make another request, 1 minute later and there are no new emails it will return the same 100 most recent messages.
If I make a third request, 2 minutes after the original and there is a reply to one of the 100 most recent messages it will still return the 100 most recent messages.
The problem with this is the it only returns the message id and thread id, not if there is a new reply or not. That would mean that I would have to check every message that I have locally stored, or every one of the 100 returned messages just to know if there was a reply to it or not.
The way that works, you couldn't "check" your email via the api because if you had stored 10000 messages and you were checking replies on all of them you would use up your entire API "number of requests" allocation in a single day!
What's wrong with you Google?
Sure I could use pop3 or imap but why when I could just use something like /list_recent?
You should definitely take a look at this part of the Gmail API documentation: https://developers.google.com/gmail/api/guides/push
Basically, it explains you how you can setup a "watch" over a Gmail account and receive notifications (new e-mail, deleted e-mail, labels added...) through Pub/Sub, the messaging queue protocol from Google.
The notifications will contain an historyId, which is a kind of milestone in the Gmail account. Using the /history endpoint, you'll then get the e-mails that were added and/or deleted since this history point. You have to store the latest historyId you handled somewhere in your app, so that you can query the right changes (and not miss anything) on the next notification.
If you don't need to react to changes in real-time, maybe you can call the /history endpoint periodically, but it will definitely be less efficient at scale.
It takes a bit of work to get this working but at the end of the day you get a very efficient system able to react about changes in real-time.

How to change modified On/ Created on date of all email activities in MSCRM using SQL

We have MS CRM 2013 on-premise.
We had to update email id of all our previous email activities and in doing so all the activities have got updated with the new modified on and sent date.
Now the problem is whenever we see the activities on first page it is by default sorted by modified on date.
Is there any script(SQL) with which we can change the modified on/ Sent date of all the email activities.
Have a look here, you might find a solution to your problem:
http://www.magnetismsolutions.com/blog/vincentzhong/2012/08/15/how_to_modify_the_created_on_value_of_dynamics_crm_2011_part_1
I would also say, that modifying created on date using SQL is possible, but unsupported and I would really discourage you from doing that.

Resources