Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Donation Alerts API wrapper for Node.JS which supports ES6 promises [BETA]
There was no library so I did it myself. Fuck Mail.ru and their developers.
Feature matrix:
✅ Latest donations with pagination
✅ Retreiving user profile information
✅ Recursive searching through donations messages
✅ Custom alerts (reusable)
✅ Refreshing tokens
✅ Access token generation
✅ OAuth link generation
❌ Merchandise API
❌ Centrifugo & Polls updates
$ npm i alerts-api
OR
$ yarn add alerts-api
const AlertsAPI = require('alerts-api')
/* OR USE ES6 IMPORT: */
import AlertsAPI from 'alerts-api'
const donationAlerts = new AlertsAPI({ access_token: '' })
async function getUserPictureURL() {
let user = await donationAlerts.getUser()
console.log(user.avatar)
}
getUserPictureURL()
Constructor accepts exactly 1 argument: config object
{
access_token: 'def502...e8d', // required; must be a string; token you obtain from exchanging authorization code
version: 1 // optional; defaults to 1; must be a number; version of API
}
STATIC ASYNC generateOauthLink(config)
{
clientID: 690, // required; must be a number; app id in your app's settings
redirectURI: 'https://example.com/', // required; must be a string; correct url specified in your app's settings; must end with slash
scopes: ['oauth-user-show'] // required; must be an array of strings; possible scopes are below in this documentation
}
STATIC ASYNC getAccessToken(config)
{
clientID: 690, // required; must be a number; app id in your app's settings;
clientSecret: '7N...RDY', // required; must be a string; private "API key" in your app's settings;
redirectURI: 'https://example.com/', // required; must be a string; correct url specified in your app's settings; must end with slash
code: 'def502...e8d', // required; must be a string; code you got from oauth authorization after redirection
}
{
token_type: 'Bearer',
expires_in: 61235,
access_token: 'RDY...7N',
refreshToken: 'd50...bc'
}
ASYNC refreshToken(config)
{
clientID: 690, // required; must be a number; app id in your app's settings;
clientSecret: 'd50...bc', // required; must be a string; private "API key" in your app's settings;
refreshToken: 'https://example.com/', // required; must be a string; refresh_token you received in the same response with access_token;
scopes: ['oauth-user-show'], // required; must be an array of strings; possible scopes are below in this documentation
}
{
token_type: 'Bearer',
expires_in: 61235,
access_token: 'RDY...7N',
refreshToken: 'd50...bc'
}
ASYNC getUser()
{
data: {
id: 918237,
code: 'vityaschel',
name: 'VityaSchel',
avatar: 'https://static-cdn.jtvnw.net/user-default-pictures-uv/41780b5a-def8-11e9-94d9-784f43822e80-profile_image-300x300.png',
email: 'vityaschel@utidteam.com',
language: 'en_US',
socket_connection_token: 'sfysjdhgaskduqhtwldiqdguaskdajsd'
}
}
ASYNC getDonations(page, raw)
{
data: [
id: 123456,
name: 'donation',
username: 'user name',
recipient_name: 'your name',
message: 'most valuable in donations',
message_type: 'text',
payin_system: { title: 'Bank card RUB' },
amount: 24,
currency: 'RUB',
is_shown: 1,
amount_in_user_currency: 24,
created_at: '2019-01-17 17:17:09',
shown_at: null
],
page: 1
next: Function,
prev: Function
}
ASYNC searchWithinMessage(term, pageLimit, caseSensetive)
[
id: 123456,
name: 'donation',
username: 'donator`s name',
recipient_name: 'your name',
message: 'most valuable in donations',
message_type: 'text',
payin_system: { title: 'Bank card RUB' },
amount: 24,
currency: 'RUB',
is_shown: 1,
amount_in_user_currency: 24,
created_at: '2019-01-17 17:17:09',
shown_at: null
]
ASYNC sendCustomAlert(alert)
await sendCustomAlert(myAlert)
class CustomAlert inside AlertsAPI class
{
header: 'Text', // optional; defaults to ''; up to 255 characters long string that will be displayed as a header
message: 'Text', // optional; defaults to ''; Up to 300 characters long string that will be displayed inside the message box
is_shown: 1, // optional; defaults to 1; A value containing 0 or 1. Determines whether the alert should be displayed or not.
image_url: 'https://example.com/image.png', // optional; defaults to ''; Up to 255 characters long URL to the image file that will displayed along with the custom alert
sound_url: 'https://example.com/sound.mp3' // optional; defaults to ''; Up to 255 characters long URL to the sound file that will played when displaying the custom
}
let myAlert = new AlertsAPI.CustomAlert({ header: 'My Alert', message: 'Hello world!' })
Please maintain this repository please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏 🙏
PRs are welcome, email me (vityaschel@utidteam.com) if you want to maintain this repository.
FAQs
Donation Alerts API wrapper for Node.JS which supports ES6 promises [BETA]
The npm package alerts-api receives a total of 8 weekly downloads. As such, alerts-api popularity was classified as not popular.
We found that alerts-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.