Skip to content

Python API for writing unoffical Kik bots that act like humans

License

Notifications You must be signed in to change notification settings

phahim1/kik-bot-api-unofficial

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kik Bot API

Use this library to develop bots for Kik Messenger that are essentially automated humans.

It basically lets you do the same things as the offical Kik app by pretending to be a real smartphone client; It communicates with Kik's servers at talk1110an.kik.com:5223 over a modified version of the XMPP protocol.

This is the new branch of this project and is recommended.

Installation and dependencies

First, make sure you are using Python 3.6+, not python 2.7. Second, just install it directly from GitHub:

git clone -b new https://github.com/Mac0r0ni/kik-bot-api-unofficial
pip3 install ./kik-bot-api-unofficial

Usage

Examples are a great way to understand things. A good place to start is the examples/ directory.

It is as simple as:

from kik_unofficial.client import KikClient
from kik_unofficial.callbacks import KikClientCallback
import kik_unofficial.datatypes.xmpp.chatting as chatting

class EchoBot(KikClientCallback):
    def __init__(self):
        self.client = KikClient(self, "your_kik_username", "your_kik_password")

    def on_authenticated(self):
        self.client.request_roster() # request list of chat partners

    def on_chat_message_received(self, chat_message: chatting.IncomingChatMessage):
        self.client.send_chat_message(chat_message.from_jid, 'You said "{}"!'.format(chat_message.body))

Currently Supported Operations:

  • Log in with kik username and password, retrieve user information (such as email, name, etc).
  • Fetch chat partners information
  • Send text messages to users/groups and listen for incoming messages
  • Send and receive 'is-typing' status
  • Send and receive read receipts
  • Fetch group information (name, participants, etc.)
  • Fetch past message history
  • Admin groups (add, remove or ban members, etc)
  • Search for groups and join them [Experimental]
  • Receive media content: camera, gallery, stickers
  • Add a kik user as a friend
  • Send images (including GIFs, using a tendor.com API key)

Sending videos or recordings is not supported yet.

More functionality

Before investigating the format of certain requests/responses, it's worth checking if they are already documented in the Message Formats wiki page.

Troubleshooting

If you are on Windows and you are unable to install the lxml package, use the binary installers from PyPi here.

If you are using Termux, then use pkg install libxml2 libxslt to install lxml and pkg install zlib libpng libjpeg-turbo to install pillow dependencies.

About

Python API for writing unoffical Kik bots that act like humans

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.6%
  • Shell 0.4%