Skip to content
An image and content moderation NodJS library for Kiyo.io
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
src
tests
.eslintignore
.eslintrc.yml
.gitignore
.istanbul.yml
README.md
index.js
package.json
yarn.lock

README.md

K-Sequencing for NodeJS

CircleCI Build Status

support or question support@datawow.io

Installation

NPM

npm install k-sequencing

Import

var kseq = require('k-sequencing');

Usage example

Promise with then()
var kseq = require('k-sequencing');

var data = {
    instruction: 'face',
    categories: 'face ear eye',
    data: 'www.your-image.url',
    postback_url: 'www.your-callback.url', multiple: false
};

var projectToken = "your project token"

kseq.choice.create({ token: projectToken, data }).then(result => {
    console.log(result.data);
}).catch(err => {
    console.error(err);
});

List of available Image Moderations

Image Choices

Get list
choice.list({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
params object
  • id (string, optional)
  • page (string, optional): Default 0
  • per_page (string, optional): Default 20
Create
choice.create({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
params object
  • instruction (string, required)
  • categories (string group, required): separate group by space name1 name2 name3
  • data (string URL, required)
  • allow_empty (boolean, optional): Default is false
  • postback_url (string URL, optional)
  • multiple (boolean, optional): Default is false
  • postback_method (string, optional): Default with your project setting. if you set this parameter that will be override your default setting
  • custom_id (string, optional): Use to custom Primary key of data row
  • staff_id (string, optional)

Image Closed Question

Get list
closedQuestion.list({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
params object
  • id (string, optional)
  • page (string, optional): Default 0
  • per_page (string, optional): Default 20
Create
closedQuestion.create({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
params object
  • data (string URL, required)
  • postback_url (string URL, optional)
  • postback_method (string, optional): Default with your project setting. if you set this parameter that will be override your default setting
  • custom_id (string, optional): Use to custom Primary key of data row
  • staff_id (string, optional)

Image Messages

Get list
message.list({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
params object
  • id (string, optional)
  • page (string, optional): Default 0
  • per_page (string, optional): Default 20
Create
message.create({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
params object
  • instruction (string, required)
  • data (string URL, required)
  • postback_url (string URL, optional)
  • postback_method (string, optional): Default with your project setting. if you set this parameter that will be override your default setting
  • custom_id (string, optional): Use to custom Primary key of data row
  • staff_id (string, optional)

Photo Tags

Get list
photoTag.list({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
params object
  • id (string, optional)
  • page (string, optional): Default 0
  • per_page (string, optional): Default 20
Create
photoTag.create({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
params object
  • instruction (string, required)
  • data (string URL, required)
  • postback_url (string URL, optional)
  • postback_method (string, optional): Default with your project setting. if you set this parameter that will be override your default setting
  • custom_id (string, optional): Use to custom Primary key of data row
  • staff_id (string, optional)

Predictions

Get list
prediction.list({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
params object
  • id (string, optional)
  • page (int, optional): Default 0
  • per_page (int, optional): Default 20
Create
prediction.create({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
params object
  • data (string URL, required)
  • postback_url (string URL, optional)
  • postback_method (string, optional): Default with your project setting. if you set this parameter that will be override your default setting
  • custom_id (string, optional): Use to custom Primary key of data row

Dynamically get image from project token

image.get({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
params object
  • id (string URL, required): Image ID or Client's image ID.

Customer Document Verification

Create a customer

kseq.kyc.createCustomer({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • address (String, optional): The customer's address.
  • dob (DateTime, optional): The customer's date of birth.
  • first_name (String, optional): The customer's first name.
  • last_name (String, optional): The customer's last name.
  • gender (String, optional): The customer's gender.
  • id_card (String, optional): The customer's ID Card.
  • email (String, optional): The customer's email.
  • custom_id (String, optional): The customize record ID.

Create and upload a document

kseq.kyc.createDocument({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • data (Array of hash, required): The customer's document images.
  • type (String, required): The type of document. e.g.
PASSPORT
DRIVING_LICENSE
SOCIAL_SECURITY_NUMBER
NATIONAL_ID_CARD
NATIONAL_ID_CARD_COMPLETE
VISA
BOOK_BANK
WEBSITE
OTHER
  • customer_id (String, required): The customer's ID that belongs to document.
  • custom_id (String, optional): The customize record ID.
// Example create document
data: {
  customer_id: '5b752f286e11576f13c0324a',
  type: 'PASSPORT',
  data: [
    {
      attr: "front_side",
      url: "front_pic_url"
    },
    {
      attr: "back_side",
      url: "back_pic_url"
    }
  ]
}

List Customers

kseq.kyc.listCustomer({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • id (String, optional)
  • page (String, optional): Default 0
  • per_page (String, optional): Default 20

List Documents

kseq.kyc.listDocument({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • customer_id (String, required)
  • id (String, optional)
  • page (String, optional): Default 0
  • per_page (String, optional): Default 20

List of available Text Moderations

Profanity Filter

First, you need to create profanity filter set which is the list of word that you want to filter out by

Create profanity filter set

profanity.createFilter({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
Params payload
  • project_type (string, required): A project type ( for now default is text_bad_word )
  • filter_set (array of string, optional): List of word you want to filter out
  • use_default (boolean, optional): Select whether using predefined filter set or custom by your own

Get profanity filter set

profanity.retrieveFilter({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
Params payload
  • id (string, required): Custom filter set ID.

After you have profanity filter set, you can send stream data of text to sanitize by

Send text data to sanitize

profanity.sanitize({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
Params payload
  • data (string, required): Stream of text to moderate.
  • postback_url (string URL, optional): Where you want us to send result back to
  • postback_method (string, optional): Default with your project setting. If you set this parameter that will be override your default setting
  • custom_id (string, optional): Use to custom Primary key of data row

Get profanity filtered text

profanity.result({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
Params payload
  • id (string, optional) Text Bad Word's Custom ID

Text Human Categorization

Send text category data to categorize

category.create({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
Params payload
  • conversation (Array of hash, required): Stream of text to moderate.
"conversation": [
  {
    "name": "p1",
      "message": "hello p2"
  },
  {
    "name": "p2",
    "message": "hello p1"
  }
]
  • title (string, optional): Title of conversation
  • postback_url (string URL, optional): Where you want us to send result back to
  • postback_method (string, optional): Default with your project setting. If you set this parameter that will be override your default setting
  • allow_empty (boolean, optional): Default is false
  • custom_id (string, optional): Use to custom Primary key of data row

Get Text Human Categorization

category.get({ token: <authorization>, data: <params> })
Authorization
  • authorization (string, header, required): Token of your project
Params payload
  • id (string, optional) Text Category's ID or Custom ID

Text Closed Question

Create a Text Closed Question

kseq.textClosedQuestion.create({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • data (String, required): The stream of text.
  • custom_id (String, optional): The customize record ID.
  • postback_url (String URL, optional): Postback's URL.
  • postback_method (String, optional): Postback's method.

List Text Closed Questions

kseq.textClosedQuestion.list({ token: <project-token>, data: <payload> })
  • id (String, optional)
  • page (String, optional): Default 0
  • per_page (String, optional): Default 20

Text Conversation

Create a Text Conversation

kseq.conversation.create({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • conversation (Array of String, required): The list of conversation.
  • custom_conversation_ids (Array of String, optional): The list of customization's conversation ID.
  • postback_url (String URL, optional): Postback's URL.
  • postback_method (String, optional): Postback's method.

List Text Conversations

kseq.conversation.list({ token: <project-token>, data: <payload> })
  • id (String, optional)
  • page (String, optional): Default 0
  • per_page (String, optional): Default 20

Facebook Page monitoring

Create predefined keywords and actions

kseq.facebookPage.create({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • page_id (String, required): The Facebook Page ID.
  • actions (Hash, required): The hash of keyword and action.
// Example of data's structure.
data: {
  page_id: "245473502860590",
  actions: { word: 'foo', action: 'removed' },
}

Get keyword and action from Facebook Page's ID

kseq.facebookPage.get({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • page_id (String, required): The Facebook Page ID.

List Facebook's Feed histories

kseq.facebookPage.getFeed({ data: <payload> })
Payload
  • page_id (String, required): The Facebook Page ID.
  • start_date (DateTime, optional): The start range of feed date. (Default: Start date of current month)
  • end_date (DateTime, optional): The end range of feed date. (Default: End date of current month)

Video Moderation

Video Closed Question

Create a Video Closed Question

kseq.video.create({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • data (String, required): The video's url.
  • custom_id (String, optional): The customize record ID.
  • postback_url (String URL, optional): Postback's URL.
  • postback_method (String, optional): Postback's method.
  • muted (Boolean, optional): Opiton to mute video's sound.
  • allow_seeking (Boolean, optional): Option to be able to seek.
  • play_at (Integer, optional): The specific video starter point.

Get Video Closed Question

kseq.video.get({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • id (String, required): The Video Closed Question's ID.

List Video Closed Questions

kseq.video.list({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • id (String, optional):
  • page (String, optional): Default 0
  • per_page (String, optional): Default 20

AI Consensus

AI Consensus

Create AI Consensus task

kseq.aiConsensus.create({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • data (String, required): The image's url.
  • custom_id (String, optional): The customize record ID.
  • postback_url (String URL, optional): Postback's URL.
  • postback_method (String, optional): Postback's method.

List AI Consensus

kseq.aiConsensus.list({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • id (String, optional):
  • page (String, optional): Default 0
  • per_page (String, optional): Default 20

Document Verification

Document Verification

Create Document Verification task

kseq.documentVerification.create({
  token: <project-token>,
  data: {
    data: "https://assets-cdn.github.com/images/modules/open_graph/github-mark.png",
    info: {
      type: {
        value: "driver_license"
      },
      dob: {
        value: "1983/12/26"
      }
    }
  }
}).then(result => {
  console.log(result.data.data);
})
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • data (String, required): The document image's url.
  • info (Hash, required): The Document information.
  • custom_id (String, optional): The customize record ID.
  • postback_url (String URL, optional): Postback's URL.
  • postback_method (String, optional): Postback's method.

List Document Verification

kseq.documentVerification.list({ token: <project-token>, data: <payload> })
Authorization
  • project-token (String, header, required): The token of your project.
Payload
  • id (String, optional):
  • page (String, optional): Default 0
  • per_page (String, optional): Default 20
You can’t perform that action at this time.