I noticed the same problem, but later found out that it was due to how the API works. You can filter emails using LabelIds, but you will only receive notifications if emails are directly filtered by the selected custom label. I guess its design, not a flaw in the API.
To test this, create a custom filter in Gmail that directly applies your custom shortcut to a set of emails, and you should receive notifications for these emails.
Edited (June 11, 2015): A push notification sends you the HistoryID and the user's mailbox name. In response, your endpoint should call userhistory.list () with the HistoryID and LabelId that you want to track for changes.
$opt_param = array(); $opt_param['startHistoryId'] = $historyID; $opt_param['labelId'] = $labelID; $opt_param['fields'] = 'nextPageToken,historyId,history/messagesAdded'; $service->users_history->listUsersHistory($userID, $opt_param);
Above is a snippet of PHP code to filter the history list with historyID and labelID.
Furhan S.
source share