Adding label to gmail message.
See original GitHub issueEvery request I make to users.messages.modify (https://developers.google.com/gmail/api/v1/reference/users/messages/modify) returns:
{ errors:
[ { domain: 'global',
reason: 'invalidArgument',
message: 'No label add or removes specified' } ],
code: 400,
message: 'No label add or removes specified' }
I am making the request like:
var service = Google.gmail({version : 'v1', auth : oauth2Client});
service.users.messages.modify({
'userId': 'some email address',
'id': 'some message id',
'addLabelIds': ['some label id'],
'removeLabelIds': []
}, function (err) {
if (!err) {
callback(true);
} else {
console.log(err);
callback(false);
}
});
Not sure if I am just missing something or if this is an issue with the library.
Issue Analytics
- State:
- Created 9 years ago
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Create labels to organize Gmail - Android - Google Support
On your Android phone or tablet, open the Gmail app . Open a message. ... Tap Change labels. Add or remove labels. Tap...
Read more >How to Add Labels in Gmail to Categorize Your Emails
1. Open the Gmail app on your phone or tablet. 2. Navigate to the message you'd like to label. 3. Tap the three...
Read more >How to Use Gmail Labels (Step-by-Step Guide w/ Screenshots)
Select the email message or messages you want to label from your Gmail inbox and click the label button (or label icon) located...
Read more >How to create labels in Gmail - Android Police
From the main Gmail menu ; Select the + icon. add-new-label-1 ; Click Create, and the new Gmail label is ready to use....
Read more >How To Automatically Label E-mails in Gmail - Alphr
Automatically label emails in Gmail · Select Create Label from the left menu. · Name your new label something meaningful and select Create....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I solved it. The problem is you have to pass the addLabelIds parameter inside a resource object:
The docs only say “In the request body, supply data with the following structure:”
They don’t say anything about a resource object. Same goes for the users.labels.create function it says to put the request body in a label object but this library actually only takes a resource object.
Doc still hasn’t been updated 😦
Spent time trying to figure out what was wrong before I came across this.