Comments (12)
What is the result of the following code?
const {google} = require('googleapis');
const auth = new google.auth.OAuth2(CLIENT_ID, CLIENT_SECRET);
auth.setCredentials({
access_token: USER_ACCESS_TOKEN,
refresh_token: USER_REFRESH_TOKEN,
scope: USER_SCOPE,
token_type: USER_TOKEN_TYPE,
expiry_date: USER_EXPIRY_DATE
});
const gmail = google.gmail({
version: 'v1',
auth,
});
gmail.users
.watch({
userId: EMAIL_ADDRESS_OF_USER,
requestBody: {
topicName: projects/PROJECT_NAME/subscriptions/SUBSCRIPTION_NAME,
},
})
.then((result) => console.log(result))
.catch((err) => console.log(err));
from gmailpush.
Ok do you have gmailpush_history.json
file in your project directory and if so, is the content of the file something like this?
[{"emailAddress":"[email protected]","prevHistoryId":16404,"watchExpiration":1595828633883}]
from gmailpush.
It show nothing 200 status code. I tried stop too 204 status code and look like it didnt stop 🐶
from gmailpush.
Was there anything in data
property like data: { historyId: '3611979', expiration: '1595827674000' }
?
from gmailpush.
{
config: {
url: 'https://www.googleapis.com/gmail/v1/users/akinasand%40gmail.com/watch?topicName=projects%2Fpubsub-283819%2Ftopics%2FMyTopc&labelIds=UNREAD',
method: 'POST',
userAgentDirectives: [ [Object] ],
paramsSerializer: [Function],
headers: {
'x-goog-api-client': 'gdcl/4.4.0 gl-node/12.16.1 auth/6.0.5',
'Accept-Encoding': 'gzip',
'User-Agent': 'google-api-nodejs-client/4.4.0 (gzip)',
Authorization: 'Bearer ya29.a0AfH6SMDsti4CXNWMtZWC9N_WnNykZBFFIvGaZuimZMeAwhHubaLB-hZVV8ksXsbTHz7MD2bRU6ERdjhxI3033v8ff789XjxdjvvxQ0N0juv4zcaG9TFai4iEseCj5TajCcX8o3P2e4UfITOzXsttuQsiEHwiX6HrbWRW1',
Accept: 'application/json'
},
params: [Object: null prototype] {
topicName: 'projects/pubsub-283819/topics/MyTopc',
labelIds: [Array]
},
validateStatus: [Function],
retry: true,
responseType: 'json'
},
data: { historyId: '16404', expiration: '1595828633883' },
headers: {
'alt-svc': 'h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-25=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"',
'cache-control': 'private',
connection: 'close',
'content-encoding': 'gzip',
'content-type': 'application/json; charset=UTF-8',
date: 'Mon, 20 Jul 2020 05:43:53 GMT',
server: 'ESF',
'transfer-encoding': 'chunked',
vary: 'Origin, X-Origin, Referer',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0'
},
status: 200,
statusText: 'OK',
request: {
responseURL: 'https://www.googleapis.com/gmail/v1/users/akinasand%40gmail.com/watch?topicName=projects%2Fpubsub-283819%2Ftopics%2FMyTopc&labelIds=UNREAD'
}
}
from gmailpush.
Was there anything in
data
property likedata: { historyId: '3611979', expiration: '1595827674000' }
?
yes.
from gmailpush.
Ok do you have
gmailpush_history.json
file in your project directory and if so, is the content of the file something like this?[{"emailAddress":"[email protected]","prevHistoryId":16404,"watchExpiration":1595828633883}]
Got it, let's me try, I can see that file. This must do on server
from gmailpush.
@byeokim Thank you, I did it :) the file gmailpush_history need to be delete.
If I run stop command will pubsub stop? I tried before but look like it not stop :s
from gmailpush.
Congrats!
Unfortunately I don't know why it won't stop sending notifications to Google Pub/Sub topic after you invoked stop()
.
from gmailpush.
I don't know it get this error on server. I tried to read from server and get this.
{"data":"[{\"emailAddress\":\"[email protected]\",\"prevHistoryId\":20064,\"watchExpiration\":1596434240536},{\"emailAddress\":\"[email protected]\",\"prevHistoryId\":20064,\"watchExpiration\":null},{\"emailAddress\":\"[email protected]\",\"prevHistoryId\":20064,\"watchExpiration\":null},{\"emailAddress\":\"[email protected]\",\"prevHistoryId\":20064,\"watchExpiration\":null}]"}
sometime it work perfect, but sometime it get this error. What can make this error?
from gmailpush.
Are you still having that issue?
from gmailpush.
I am not sure, i tried to delete file on server then look like it work ok. Lets me tracking that
from gmailpush.
Related Issues (11)
- Cannot read property 'readFile' HOT 2
- google-map-react-examples/src/examples/MarkerInfoWindow.js HOT 3
- A video example HOT 9
- Got Error: getEmailAddress() requires an argument: notification HOT 1
- Get watchExpiration = null HOT 6
- Message notifications causing `requested entity was not found` error HOT 2
- Gmailpush initialize function not getting called using example code HOT 8
- Not getting email notifications: gmailpush.getEmailAddress parse issues HOT 14
- How to automatically refresh the access token? HOT 6
- Mark Notified Email as Read HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gmailpush.