Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kik-node-api

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kik-node-api

An API for creating kik bots (and other stuff)

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
increased by350%
Maintainers
1
Weekly downloads
 
Created
Source

Kik Node API

A chatting API for kik built with Node.js, based on https://github.com/tomer8007/kik-bot-api-unofficial

Installation

For now you will need to simply download the repository, NPM installation coming soon

Usage

Events
  1. The Basics
  2. Group Events
  3. Private Events
Requests
  1. Group Requests
  2. Private Requests

Getting Started

You can use the API by creating an instance of KikClient, you'll use it to listen to events and send requests to kik

const KikClient = require("./src/kikClient")

Kik = new KikClient({
    username: "username",
    password: "1234",
    promptCaptchas: true,
    trackUserInfo: true,
    trackFriendInfo: true
})

Kik.connect()

username: your kik account's username

password: your kik account's password

promptCaptchas: prompt in the console to solve captchas. If not you must handle it yourself using the event

trackUserInfo: track users and return their usernames and display names in the events when possible

trackFriendInfo: track friends and return their usernames and display names in the events when possible

All users are represented in a js object that looks like this:

user: { 
    jid: "kikteam@talk.kik.com", 
    username: "kikteam",
    displayName: "Kik Team",
    pic: "http://profilepics.cf.kik.com/luN9IXX3a4sks-RzyiC7xlK-HdE"
}

groups are represented in the following js object:

group: { 
    jid: "1100221067977_g@groups.kik.com", 
    code: "#kikbotapi",
    name: "Kik Bot API Unofficial",
    users: ["jid1", "jid2", "jid3"]
}

Events

The Basics

KikClient uses Node's Event Emitter class to handle events, all events are attached in the following way:

Kik.on(eventname, (param1, param2) => {
    //do stuff with params here
})

Below are the details of all events emitted by the KikClient class

Authenticated
Kik.on("authenticated", () => {
    console.log("Authenticated")
})
Received Roster
Kik.on("receivedroster", (groups, friends) => {
    console.log(groups)
    console.log(friends)
})

groups: an array of group objects representing the groups you are in

friends: an array of user objects, each representing a friend

Received Captcha
Kik.on("receivedcaptcha", (captchaUrl) => {
    console.log("Please solve captcha" + captchaUrl)
})

captchaUrl: url to the captcha page

Received JID Info
Kik.on("receivedjidinfo", (users) => {
    console.log("We got peer info:")
    console.log(users)
})

users: an array of user objects returned as a result of requesting jids

Group Events
Received Group Message
Kik.on("receivedgroupmsg", (group, sender, msg) => {
    console.log(`Received message from ${sender.jid} in group ${group.jid}`)
})

group: a group object representing the group where the message was sent

sender: a user object representing the message sender

msg: the received message

Group is Typing
Kik.on("grouptyping", (group, sender, isTyping) => {
    if(isTyping){
        console.log(`${sender.jid} is typing in ${group.jid}`)
    }else{
        console.log(`${sender.jid} stopped typing in ${group.jid}`)
    }
})

group: a group object representing the group where the message was sent

sender: a user object representing the message sender

isTyping: true if the user is typing, false if he stopped

User Left Group
Kik.on("userleftgroup", (group, user, kickedBy) => {
    console.log(`${user.jid} left the group: ${group.jid}`)
})

group: a group object representing the group

user: WIP

kickedBy: WIP

User Joined Group
Kik.on("userjoinedgroup", (group, user, invitedBy) => {
    console.log(`${user.jid} joined the group: ${group.jid}`)
})

group: a group object representing the group

user: WIP

invitedBy: WIP

Private Events
Received Private Message
Kik.on("receivedprivatemsg", (sender, msg) => {
    console.log(`Received message from ${sender.jid}`)
})

sender: a user object representing the message sender

msg: the received message

Private Is Typing
Kik.on("privatetyping", (sender, isTyping) => {
    if(isTyping){
        console.log(`${sender.jid} is typing`)
    }else{
        console.log(`${sender.jid} stopped typing`)
    }
})

sender: a user object representing the message sender

isTyping: true if the user is typing, false if he stopped

Requests

Group Requests

Note that all callback functions can be excluded

Send Group Message
Kik.sendGroupMessage(groupJid, msg, (delivered, read) => {
    if(delivered){
        console.log("Delivered")
    }else if(read){
        console.log("Read")
    }
})
Private Requests
Send Private Message
Kik.sendPrivateMessage(userJid, msg, (delivered, read) => {
    if(delivered){
        console.log("Delivered")
    }else if(read){
        console.log("Read")
    }
})

FAQs

Package last updated on 01 Feb 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc