{"size": 731, "ext": "js", "max_stars_repo_path": "src/senders/submit.sender.js", "max_stars_repo_name": "diamondraras/messenger-bot-starter", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/senders/submit.sender.js", "max_issues_repo_name": "diamondraras/messenger-bot-starter", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/senders/submit.sender.js", "max_forks_repo_name": "diamondraras/messenger-bot-starter", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.0740740741, "max_line_length": 59, "alphanum_fraction": 0.4979480164}
const request = require('request')
export default function (sender, msgData, cb) {
    const token = process.env.PAGE_ACCESS_TOKEN
    request({
        url: 'https://graph.facebook.com/v2.6/me/messages',
        qs: {
            access_token: token
        },
        method: 'POST',
        json: {
            recipient: {
                id: sender
            },
            message: msgData,
        }
    }, function (error, response, body) {
        if (cb) {
            cb(response.body.error, response)
        }
        if (error) {
            console.log('Error sending messages: ', error)
        } else if (response.body.error) {
            console.log('Error: ', response.body.error)
        } else { }
    })
}
