I am using Google Apps Script to do something with Gmail messages. To retrieve messages within a specific time range, I use the GmailApp search method. It seems that Gmail will round up the timestamp of the messages to minutes so I could not get results which I would expect to have.
Let's say we have 3 messages with timestamps
2020-10-15 11:14:41
2020-10-15 11:38:49
2020-10-15 11:59:26
When I search the messages by query "after:1602759600 before:1602730800" (from 2020-10-15 11:00:00 to 2020-10-15 12:00:00), only 2 messages were returned. It seems that Gmail rounds up the timestamp of the messages to minutes, where the "11:59:26" message was treated as "12:00" (It also appears as "12:00" in the inbox of the Gmail page)
If I set the query to "after:1602730800 before:1602766800" (from 2020-10-15 12:00:00 to 2020-10-15 13:00:00), the message stamped with "2020-10-15 11:59:26" returned as the search result.
To investigate this, I sent another 2 messages to see how Gmail rounds up. I sent the messages at 12:59:15 and 12:59:45 respectively, this time Gmail rounds down the "12:59:15" to "12:59" and the "12:59:45" to "13:00".
Does anybody knows what is behind the box?
Related
how can I set time interval between two email notifications that Zabbix sends? I want to send a notification about an issue at least 30 minutes since the last email about the same issue.
Currently, I get an email every minute about the same thing and that's annoying.
The only thing I found was this: https://www.zabbix.com/forum/zabbix-help/19970-time-interval-between-two-email-notifications
but unfortunately it wasn't very helpful.
You can manage these intervals in Configuration -> Actions -> your alert action -> Operations.
I think that you have set up Default step duration to 1 minute and a notification action for steps 1 - 0 (Indefinitely).
In the documentation you can find various examples, for instance:
Example 1
Sending a repeated notification once every 30 minutes (5
times in total) to a 'MySQL Administrators' group.
To configure:
in Operations tab, set the Default operation step duration to '30m'
(30 minutes) Set the escalation steps to be From '1' To '5' Select the
'MySQL Administrators' group as recipients of the message
You can define a default step duration of 1 minute and define the escalations:
step 1 - 1 to send a mail after 1 minute
step 30 - 30 to send a mail after 30 minutes
or step 30 - 0 to send a mail every 30 minutes
I want to make an app displaying LAST x days' temperature on 3 hourly basis using the openweathermap API only. I went through the available APIs. They either have the predicted forecast of next 5 days or the historical data expecting start and end as parameters which I tried to use then (https://openweathermap.org/history).
So just to check whether I have understood the params correctly or not, I tried fetching(through the address bar):
http://history.openweathermap.org/data/2.5/history/city?id=1275339&type=hour&appid=df78dcfa9580e72b15fdf62d406d34ec&start=1369728000&end=1369789200".
But I got HTTP error 401:
{"cod":401, "message": "Invalid API key. Please see http://openweathermap.org/faq#error401 for more info."}
I fail to understand how should the parameters be entered to get the desired results (last 5 days temperature on 3 hourly basis) and also how do I enter "cnt" (if needed to) such that it gives me 3 hourly data.
I have a use case where i need to get the timestamp for the form responses (and string it) and email to respondent.
Here is my code and i would like to ensure it's exactly the same as Timestamp in my sheet
Code
Logger.log("e.response.getTimestamp()" + e.response.getTimestamp()) ;
Screenshot of the respondent (sorry for couldn't post image yet)
Screenshot of the respondent
Questions
- How come the timing is 1 second different?
- How could i string it (in both form and app string) so i can get identical result
The problem is that Google Forms stores internally form responses using milliseconds but when writing the timestamp to Google Sheets the timestamps are rounded to seconds.
Google Apps Script
https://developers.google.com/apps-script/reference/gmail/gmail-label
getUnreadCount()
// log the number of unread threads labeled with MyLabel
var label = GmailApp.getUserLabelByName("MyLabel");
Logger.log(label.getUnreadCount());
Gets the number of unread threads tagged with this label.
When i tried the sample code provided, it return a different unread value.
From the email, it shows 17 unread but the log file shows 12.
Any ideas?
I tested this script thoroughly and found that although, it gets a count of the emails marked with the label from the Inbox, however, it will not count the emails marked which are in maybe some other folder but have the same label. So if you have 17 unread emails with a label (assuming it like your question) "MyLabel", then my guess is 12 of those are in the Inbox but 5 of those have skipped/been moved from the Inbox and hence are not being counted by the function.
However, one of the work-arounds is to use:
var threads = label.getThreads();
and move add of all of these to Inbox while keeping these files marked with your label. Now, if you count, your function should return 17. But ideally you shouldn't have to do that, so I would suggest that you also file it as a defect here and make use of the work-around in the meanwhile.
So I am writing a simple inbox private message system.
My table schema is as follows:
messageID
message
sender id
receiver id
date sent
read ( 0 = no , 1 = yes)
I am able to show the messages for the user by relating his userID to receiverID. However I also want to show the messages he has sent in the inbox to the user.
For example his inbox should show:
Darth Vader - 3 New messages
Luke - 0
new messages (0 because either I read
all of them OR i sent him the message
and he has not replied).
But what i can only come up with is
Darth Vader - 3 New messages.
Can I get any help with how I can accomplish this SQL call?
EDIT: To Clear the Confusion
I am neither Luke or Darth. I have received 3 New messages from darth, and I have sent a message to luke.
EDIT**
Basically I want to be able to make the inbox like how an SMS app would be, where you can see the sms you just sent in a list of sms's by your friends.
SELECT users.username, count(messageID) AS unread
FROM users, messages
WHERE messages.senderID=<USER ID>
AND messages.receiverID=users.userID
AND messages.read=0
Just to make sure I got this right, this query will show all the users I have sent a message to and count the number of those messages which have not been read.