我们正在将Gmail拉通知与Google Pub Sub一起使用,并且有一个自定义标签,我想监视该标签是否有任何更改。我使用以下代码为标签注册手表(标签的ID为Label_1)。
WatchRequest request = new WatchRequest();
List<String> labelsToWatch = new ArrayList<>();
labelsToWatch.add("Label_1");
String topicName = "projects/(project_name)/topics/(topic_name)";
request.setLabelIds(labelsToWatch);
request.setLabelFilterAction("include");
request.setTopicName(topicName);
WatchResponse response = gmail.users().watch("email_id", request).execute();
return response.HistoryId.ToString();
手表注册成功。问题是我会收到所有Gmail更改的拉通知,而不仅仅是标签下的通知。
是否支持自定义标签?