detoxy-node v0.1.5
detoxy-node
Installation
npm i --save detoxy-node
Usage
Creating a new instance
In order to start using the library, you first need to create an instance of the Detoxy class:
let Detoxy = require('detoxy-node');
const detoxy = new Detoxy(apiKey, {defaults});
apiKey
is required in order to create a Authorization header, allowing us to associate the data with your account.
Optionally you may pass defaults
as an object that will be passed to the underlying request instance. A list of the possible options are listed here.
This is useful to override the default 10s timeout. Example:
const detoxy = new Detoxy('abc', {
development: true, // Use custom machine learning model
useExtened: true, // Request spam categories in case of spam evaluation
timeout: 5000 // Set 5s timeout
});
detoxy.evaluate({content:'spam'})
This will create an evaluation request towards Detoxy.
detoxy.evaluate({content:'spam'});
Options
- data: Object (required)
- content: String (required), content for evaluation
- user_ip: String (optional), ip adress of the user
- user_agent: String (optional), user agent of the user creating the evaluation
- referrer_domain: String (optional), domain from which the user came
- content_permalink: String (optional), content permalink
- content_id: String (optional), content id
- content_action: String (optional), action performed (create, update)
- content_type: String (optional), content type (post, threat, comment)
- content_author_id: String (optional), author id
- content_author_name: String (optional), author name
- content_author_email: String (optional), author email
- content_author_signup_timestamp: String (optional), author signup timestamp
- content_author_role: String (optional), author role
- content_post_timestamp: String (optional), content creation timestamp
- content_language: String (optional), language of the content
- use_for_training: String (optional), whether the data will be used for training
Further examples
We've included functional examples in the examples/ directory of the repo to further assist in demonstrating how to use this library to integrate with Detoxy
Tests
npm install && npm test
License
Released under the MIT license. See file LICENSE for more details.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.