GMAIL API returns different ThreadID than inboxSDK - gmail-api

Context: I am using the [PHP] Gmail API and InboxSDK.
When sending a message (with Gmail API), I output the message sent object (reference here).
It contains info about message ID and Thread ID.
What is happening?
Id and ThreadID is the same (ok: because it is the first message in the thread).
But if I check the received mail with InboxSDK, i see a different ThreadID than the one returned by GMAIL API.
Example of what is going on:
I send a Test email via API.
When checking the thread ID with InboxSDK though...
We can see both Thread Ids are different.
Maybe I am doing something wrong, can you please help me out with this?
Note: I tried this multiple times with multiple google accounts. The issue is constant.

Related

Creating threaded messages with Gmail API

I am using the Gmail "insert" API to create messages in Gmail. (I am not sending the message or replying to an existing message, these are just being created with labels and left there). I have a thread Id for my messages that I need to use to group them together in Gmail, but I can't seem to get it working - messages are shown in Gmail as separate, not in a thread. My first thought was to use the "threadId" property in the json of the insert, but this causes http error 404 ""Requested entity was not found."
In my RFC message headers, I am creating the relevant threading headers as follows:
Subject: Performance issue with libcurl 7.73
MIME-Version: 1.0
Message-ID: <17576c8ef0591c6e>
In-Reply-To: <17576c8ef0591c6e>
References: <17576c8ef0591c6e>
So I create 2 messages with the above headers, all values identical except that the 2nd subject begins with "Re:". Does not work to thread them together. Any ideas?

Is there a limit on number of recipients of message sent using Gmail API?

We recently sent an email using GMail API. In the email, there are 270 recipients in BCC. We got the following error from googleapi: Error 400: Too many recipients, invalidArgument,
My question is: Is there a limit on the number of recipients in a message sent using Gmail API? if it is the case, how big is it?
Yes, there is.
According to this you have a limit of 100 recipients per message.
Recipients per message sent via SMTP (by POP or IMAP users) or the Gmail API
Addresses in the To, Cc, and Bcc fields of a single email. Includes email sent using smtp-relay.gmail.com or smtp.gmail.com*
100
Not sure if this limitation is only for third parties (such as yourself) or in general. The terms of use for the API clearly state that one should not abuse the API and sending a mail to almost 300 people at the same time might be considered an attempt to spam.
As an alternative you can split your recipients count into chunks that fit into the limit and send multiple mails to cover them all. In your case you would have to send 3 mails: 2x100 and 1x70.
Don't forget about the note (above the table in the document I've linked):
Sending limits are different if your organization uses the SMTP relay service to route outgoing mail through Google. Instead, go to sending limits for the SMTP relay service.

Creating a message in an Inbox by Gmail thread via Gmai API

Steps to reproduce:
Send a message from Inbox
Create a 2nd message in that same thread using Gmail API's "insert" method
Delete the first message either from the API or from Gmail (but really delete it, not just put it into trash)
Result: the 2nd message seems to get somehow disconnected from the thread and Inbox acts weirdly on it (see video if curious -- the weird behaviour itself starts at 2:10).
Bug or feature?
How to avoid it?

Sending threaded email from Google App Engine

I've got an app that's sending email from AppEngine, but each email looks like it's a unique message. Instead I want related emails to be threaded in my email client. Is there a specific header/format I need to use?
These emails are not necessarily in response to another email, so I don't have a Message-ID to plug into References. I've tried using a natural key in References and In-Reply-To to no avail.
I was able to thread a list of emails just by using the In-Reply-To header with your format <msg-identifier#host>.
Supposedly, msg-identifier is the identifier to the message you're replying to, but as you're not replying to any message but sending all of them out of thin air, creating a new ID and using it in all the emails you send will also do the trick.
I got this working by using both References and In-Reply-To with the format <identifier#systemname>. Maybe it'll work with less; I made several changes at once. If someone chimes in with that kind of detail I'll happily accept their answer instead of mine.

Google Channel API sends a message to all clients

I created a working Google Channel AP and now I would like to send a message to all clients.
I have two servlets. The first creates the channel and tells the clients the userid and token. The second one is called by an http post and should send the message.
To send a message to a client, I use:
channelService.sendMessage(new ChannelMessage(channelUserId, "This is a server message!"));
This sends the message just to one client. How could I send this to all?
Have I to store every Id which I use to create a channel and send the message for every id? How could I pass the Ids to the second servlet?
Using Channel API it is not possible to create one channel and then having many subscribers to it. The server creates a unique channel for individual JavaScript clients, so if you have the same Client ID the messages will be received only by one.
If you want to send the same message to multiple clients, in short, you will have to keep a track of active clients and send the same message to all of them.
If that approach sounds scary and messy, consider using PubNub for your push notification messages, where you can easily create one channel and have many subscribers. To make it run on Google App Engine is not that hard, since they support almost any platform or device.
I know this is an old question, but I just finished an open source project that uses the Channel API to implement a publish/subscribe model, i.e. you can have multiple users subscribe to a single topic, and then all those subscribers will be notified when anyone publishes a message to the topic. It also has some nice features like automatic message persistence if desired, and "return receipts", where a subscriber can be notified whenever OTHER subscribers receive that message. See https://github.com/adevine/gaewebpubsub#gae-web-pubsub. Licensed under Apache 2.0 license.

Resources