I am creating a filter in Gmail using Gmail API but the problem is that any filter created via API is moved to the top of the existing filters. I need it to be put at the bottom. There does not seem to be any guide to achieve this in the documentation.
Here's my code
gmail.users.settings.filters.create ({
userId: email,
auth: oAuth2Client
resource:{
action:{
addLabelIds : [
"#{response.data.id}"
]
removeLabelIds:[
"INBOX"
]
}
position: 'LAST',
criteria:[
"query": "label:inbox",
"excludeChats": true,
"negatedQuery": responder.deliveryExceptions,
]
}
})
How can I achieve this?
I've performed multiple tests on my end, the result is the same when creating the filter through the Gmail API the filter is moved to the top, I played around with the Gmail web UI and actually in that scenario the new filters created are moved to the bottom, it is an action performed automatically and there's no option available to control the position, my guess is that this limitation is related to the fact that there's no option to sort the existing filters.
Nevertheless, having the ability to control if you can add the new filter to the top or at the bottom would be a nice feature to have. If you have the time, you can open a Feature request