gmail api returning total messages as 0 for a particular Label - gmail-api

I have been using the "Get Label" API to get the details of a particular Label.
It was all working until the last couple of days.
What I now observe is that the "Total Messages" Count is always 0. "UnRead Messages" Count show up properly.
I have used it in my application and also tried it from https://developers.google.com/gmail/api/v1/reference/users/labels/get - "Try It Now" and the result is the same --- 0 Total Messages

As noted in the comments to the question, there's an apparent bug in the API as reported here.
FWIW I'm running into the same issue.
In my case I have three accounts, all created programmatically by the same code, all containing messages inserted programmatically by the same code. The get label API repeatably reports the correct number of messages for one account while erroneously reporting zero messages for the other two accounts. Viewing the account in the web interface shows all the messages in all the accounts as expected.

Related

Low resolution Email Preview in Salesforce for marketing cloud connect emails

Question about Marketing Cloud Connect - In case of Individual Email Result in Salesforce, an email preview is sent from MC to SF object along with a thumbnail preview of the email template (as base64 encoded image). This thumbnail has two problems.
a. isn’t clear enough for the sales agent to see what was sent to customer
b. can’t find what offer percentage was given to customer as the preview has ampscript value instead of actual value.
There is no way to change the default configs of MCC to increase the thumbnail size. To solve this and improve the image resolution, I’ve thought of below solutions. Is there any other possible way that you’ve done?
From customer send log, take ‘view_email_url’ and get the html using a visual force page and remove all the ‘https://click…xx.com/’ links to ensure click/ open counts aren’t impacted. Downside - # of api calls to make are higher
For every email, create a jpg preview of the email template and store it in MC and store this in SF in a custom object as ‘EmailName vs EmailPreviewUrl’. And, whenever a marketer creates a new email, they have to ensure that they create a jpg copy in MC and update associated record in Saleforce custom object. Downside - sales agent will not know what % of offer is given to customer (ps - % of offer is decided in MC automation based on raw order information we’ve about this customer). To manage this downside, we can send the offer details of each customer to SF using updateSingleSalesforceObject method everytime an email is sent. To do this, all the campaigns should be standardized to some extend.
Any other thoughts? is there any configs that I can flip to increase the image size?
To answer this question, we ended up creating a cloudpage code resource (similar to API) that returns the complete HTML of 'view_email_url' (aka view as web page) for a given email + Subscriber + datesent + BU. We used SSJS to query sendLog DE using these inputs to figure out the view_email_url value. To avoid counting view_email_url opens to tracking opens, we wrapped the open counter pixel inside a context variable - something like below.
%%[
IF _messagecontext != 'VAWP' THEN
]%%
<custom name="opencounter" type="tracking" />
%%[ ENDIF ]%%

protoPayload vs jsonPayload in logging

The log entries of my app result in jsonPayload while the gae request log entries use protoPayload. Just like in protoPayload, I added a requestId in my logging that shows up in jsonPayload. However, when using the log viewer where "Show entries from same request" action, I don't see my log entries since the filter uses protoPayload.requestId="xyz". I tried to use an or condition with jsonPayload.requestId="xyz" but that didn't help. Ideally I wouldn't even want to manually edit the clause as it will be painful to do everytime. Seems like per the following documentation, the requestId in each of these types of payloads don't map to the same underlying bigquery field.
https://cloud.google.com/logging/docs/export/bigquery
There is also a "trace" field directly on the log entry and that is same for all the related logs. However, there is no field called trace to search. Doing a text search does return all the entries. While this works, again the UX is bad as it requires first drilling down to the request log entry, copying the trace value and then doing a query.
So, are there any other options to tie the request log entry with the rest of the app log entries for that request easily?
There is a field called "trace" that is on the log entry which works. I think I was confused with the "traceId" within the protoPayload. Note that to get the "trace" field to show up with json payload, the field name should be "logging.googleapis.com/trace"

AzureAD Graph API - getting removed users using delta links on groups

I am not able to get removed users using a delta link retrieved from a previous call of https://graph.microsoft.com/v1.0/groups/delta
Explanations:
I retrieve the groups using the query
https://graph.microsoft.com/v1.0/groups/delta
which returns the results correctly
Then I keep the delta link
(example of delta link from JSON response: "#odata.deltaLink": "https://graph.microsoft.com/v1.0/groups/delta?$deltatoken=7VBZ66f3HT ...
)
I remove manually a user which belongs to a group to be sure the delta link works and returns the removed user id.
-> nothing at all is returned.
According to their documentation, it should work:
https://learn.microsoft.com/en-us/graph/delta-query-groups#deltalink-response
Moreover, when i do the same thing with delta user query, it works fine, the removed user is returned with user delta link.
Question:
Does anyone is experiencing this issue and did you find any solution?
I didn't reproduce your issue on my side. I am using Microsoft graph explore to test the api.
When I accessed the final nextLink response, I got the deltaLink.
Then I removed two users from a group on Azure portal.
I can get the expected result when I access the deltaLink.
Update:
I just noticed that you deleted the user directly. That's why you can only get removed user on user delta. If you remove the user from the group directly, you will get the removed user.

AAD Change Notifications - Delta query to track recent changes using "$deltaToken=latest"

I have created brand new AAD Group, added a couple of users to it, and removed users from it. I then tried the below request and it's returning a deltalink as expected:
https://graph.microsoft.com/beta/groups/delta/?$filter= id eq '900faee0-0115-44a9-876w-cd1644472792'&$deltaToken=latest
When trying to call the deltaLink I received using the above request, I'm getting an empty response without the expected members#delta showing recently added or deleted Users.
Note: I didn't try the delta function on the desired resource as I'm not interested in retrieving the full state of the resource but trying above $deltaToken=latest request as very first delta change query.
The reason you're not seeing membership changes is that you haven't expanded members in your query. Your current question will only return changes to the Group itself, not related entities.
To retrieve a delta for the Group & Members your query should be:
/v1.0/groups/delta/?$expand=members&$filter= id eq '900faee0-0115-44a9-876w-cd1644472792'&$deltaToken=latest
Also, note that you really shouldn't call the Graph Beta version unless your testing new Graph features. The Beta APIs can and will see breaking changes occur without warning. It is not safe for production code.

Firebase Realtime Database: Retrieving "limited" data on "backend"

This is my first question and I hope that will bring me a good luck about my problem!
I've been working on an "free/paid" application and my main rule is for these two customers to allow Free customers only query 500 items from my Firebase Realtime database. But If they want more then have to pay for me to see all the items. But the problem is I can only make this happen on front end or client side and that makes my web application hackable..
Can you please help me, how can I limit the query result on Firebase console depending customer status?
if the user is "authenticated and paid for it" then allow him to list more than 500 result. If he is "anonymous or authenticated but not paid for it" then limit him for 500 results.
On BACKEND!
Thanks guys,
That used to be impossible for a long time. But I think you might now be able to do this thanks to query based rules. This allows your security rules to validate that a query that is attached matches your rules. For example (from the documentation):
messages: {
".read": "query.orderByKey &&
query.limitToFirst <= 1000"
}
So these rules only allow a query if it reads at most 1000 messages.
Example queries:
db.ref("messages").on("value", cb) // Would fail with PermissionDenied
db.ref("messages").limitToFirst(1000)
.on("value", cb) // Would succeed (default order by key)
If you store people's maximum number of items in a custom claim, you should be able to check that in the rules:
messages: {
".read": "query.orderByKey &&
query.limitToFirst <= auth.token.maximumItemCount"
}
You'll note that in each of these cases, the client should also specify the correct number of items in its query. The security rules "merely" ensure that the query is allowed, they don't automatically filter the items.
My disclaimer "should" is because I never tested anything like this, so be sure to post back if you're having problems making it work.
For more info see:
Documentation on query-based rules.
Blog post introducing Query-based Security Rules.
Documentation on custom claims, which are set through the Admin SDK.

Resources