Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create mail alert #5

Closed
ilya-nurullin opened this issue Nov 27, 2017 · 2 comments
Closed

Cannot create mail alert #5

ilya-nurullin opened this issue Nov 27, 2017 · 2 comments

Comments

@ilya-nurullin
Copy link

const alerts = require('google-alerts-api');
alerts.configure({
    mail: 'your_mail@gmail.com',
    password: '**********'
});

const { HOW_OFTEN, DELIVER_TO, HOW_MANY } = alerts;

alerts.sync(() => {
    const alertToCreate = {
        howOften: HOW_OFTEN.AT_MOST_ONCE_A_DAY,
        sources: [],
        lang: 'en',
        name: 'NodeJS AND "Chrome V8"',
        region: 'PL',
        howMany: HOW_MANY.BEST,
        deliverTo: DELIVER_TO.MAIL,
        deliverToData: ''
    };

    alerts.create(alertToCreate, (err, alert) => {
        console.log(err);
        console.log(alert);
    });
});

Console output:

TypeError: Cannot read property '0' of undefined
    at Request.reqHandler.create [as _callback] (D:\OSPanel\domains\dev.dev\node_modules\google-alerts-api\src\api.js:117:38)
    at Request.self.callback (D:\OSPanel\domains\dev.dev\node_modules\request\request.js:188:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (D:\OSPanel\domains\dev.dev\node_modules\request\request.js:1171:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (D:\OSPanel\domains\dev.dev\node_modules\request\request.js:1091:12)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)
undefined
@adasq
Copy link
Owner

adasq commented Nov 27, 2017

You should provide your mail in deliverToData field, in order to create alert. It musn't be empty

@adasq
Copy link
Owner

adasq commented Nov 27, 2017

Closing, if still does not work, feel free to reopen.

@adasq adasq closed this as completed Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants