Gmail API PubSub Push Endpoint is triggered twice - gmail-api

We have integrated Gmail API into our app to get the email inbox updates of Gmail accounts. We have used Gmail watch API to start listening to the updates of the Gmail inbox of a user. We have added a subscription and mentioned the endpoint of our app, Topic-Subscription details screenshot attached below, where we are ready to receive inbox updates.
But there are some Gmail accounts, whenever an email is received on those accounts then our "push endpoint" is triggered twice instead of once. That's causing a problem within our app.
Can you please explain that is it possible that a push endpoint can be triggered multiple times, on a single email received at the Gmail inbox?

Related

Not received emails even though the SendGrid activity shows Delivered

I have created Azure Logic App with Recurrence trigger and then used SendGrid connector for sending emails to multiple team members.
I didn’t receive any email even though the logic app actions executed successfully. After that I have checked SendGrid account email activity status, it is having “Delivered” status for the mentioned to email address in the SendGrid action.
Note: I have whitelisted the Outbound IP address of my logic app in SendGrid IP Address Management.
Twilio SendGrid developer evangelist here.
I don't know how Azure Logic Apps trigger emails with SendGrid, but if an email isn't being sent they shouldn't be getting the "Delivered" status.
You said that you have not set up Single Sender Verification or Domain Authentication. In order to send an email using SendGrid from the email address you provide, that email address should either have been verified as a Single Sender (which is mostly useful for testing) or it should be from a domain that you have authenticated with SendGrid.
Try setting one of those verification methods up and then try sending emails again.

GMail stops sending push notification

I've configured the push notifications following this guide and when calling the watch endpoint I get an expiration of about one week.
During this period I expect to receive notification to the Pub/Sub topic I've configured without the need to call the watch endpoint some time before the expiration date.
However what happens is that after about one day I'm not receiving notifications anymore and calling the watch endpoint doesn't help.
Why GMail has stopped to send notification to the subscription endpoint?
Gmail Pub/Sub notification subscriptions expire in 7 days, you have to call watch() again to renew your subscription.
https://developers.google.com/gmail/api/guides/push#renewing_mailbox_watch
Maybe that's the issue.

List Google Group's emails with Gmail API Users.messages

is it possible to load emails sent to google group via API?
I can see something like that in Gmail API: https://developers.google.com/gmail/api/v1/reference/users/messages/list
but not sure if it will work for google groups.
When I tried it I just got "Delegation denied for..." error.
What I need is to periodically load emails (possibly with attachments) from more google groups (so it is not convenient to resend all emails to some regular gmail address...) - any ideas?
Thanks
For the question is it possible to load emails sent to google group via API?
I think there is no API that allows reading a message in Google Group.
So the alternative way is to use a Gmail account which is a member of that group. By using this Gmail you can check all the message that is sent to that group.
About the Delegation Denied error, this message will be sent if the initiator, in response to a credential request message, is unwilling to generate the requested credential.
Check this SO question for more information.

GMail API - Can I send email using the Service Account?

When I send an email using the GMail API, I get an Access Token for the user to whom the message is to be sent and then when sending the message, I put some value in the From Field.
But no matter what I put in the from field, the message in the email shows as From "Me" and is in the Sent mails as well as Inbox.
Is there a way, I could use the Service Account to send the email, so that it does not show up as From "Me" and is also not in the Sent Mails.
You cannot use a service account to impersonate a free gmail account. I spent a lot of time confirming this after reading a reply that was here before. Maybe it worked at some point, but it doesn't anymore.
There is no way to share / grant another user permission to access
your standard gmail account. So there is no way for you go delegate
the permissions for bob#mycompany.com to access bob#gmail.com.
and
you can impersonate G-Suite accounts but not Gmail accounts
These quotes are from Google's official C# Auth repo:
https://github.com/googleapis/google-api-dotnet-client/issues/1561
No. The Gmail API is for Gmail users and service accounts are just for doing auth to a real Gmail account, they don't have their own Gmail account, etc.
If you want to send the email from some service, you need some bulk-sending email service like at: https://cloud.google.com/compute/docs/tutorials/sending-mail/ or something you run yourself or from some other provider.
No, what you are looking for is a bulk email sending service. Checkout sendgrid , Amazon AWS SES, mandrill or if you want to stick with Google, this. You could of course run your own postfix server (although I'm assuming you were using gmail api for deliverability in the first place.

Receive slack bot messages via requests to external URL

Is it possible to receive direct messages on behalf of a slack bot via POST requests to a certain domain?
I want to have an endpoint in Google App Engine that receives incoming direct messages from Slack via POST requests, and posts messages back via the API. Is it possible?
You can use the new Events API. Create a bot, subscribe to message.im events, and set your endpoint as the callback URL
You just need to set up an "outgoing webhook"in slack and point it to whatever endpoint you need on your GAE server. In order to respond just use an "incoming webhook" to receive the answer.

Resources