in twitter/server.js [145:170]
function listWebhooks(url) {
return new Promise((resolve, reject) => {
request.get(
'https://api.twitter.com/1.1/account_activity/all/webhooks.json',
{oauth: twitterOAuth}, function(err, resp, body) {
if (err) {
console.error('Failed to check webhooks: ' + err);
reject(err);
}
const environments = JSON.parse(body).environments;
if (Array.isArray(environments)) {
const environment = environments.find((element) => {
return element.environment_name === environmentName;
});
if (environment) {
const webhooks =
environment.webhooks.filter((value, index, arr) => {
return value.url === url;
});
resolve(webhooks);
}
resolve([]);
}
});
});
}