This library is a Node wrapper for the Kik Bot API to help you develop a bot for Kik Messenger in Node.js. To learn more about the Kik Bot platform check out dev.kik.com or follow the steps below to get started.
This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to bots@kik.com.
If you're looking to contribute to the kik
package, check out the Contributing Guide.
Creating a basic Kik bot is simple:
Go over to dev.kik.com.
...and in Kik, hit the plus button in the top right corner and then hit 'scan a Kik code'.
(the above scan code is only an example, you must go to the link above for a valid scan code)
Pointing your camera at the code will allow Kik to scan the code and introduce you to Botsworth, the bot maker bot. Follow the prompts to configure your bot.
Botsworth will ask you to give your bot a name which, is the first step. Choose wisely! Your bot should be cleverly and descriptively named - it should provide relatively clear indication as to the function of your bot. Hint: Avoid numbers and special characters in your bot's name.
Once you've chosen your bot's name, Botsworth will ask you to confirm, and will then log you into the Kik Bot Dashboard. You will be prompted to agree to the Kik API Terms of Use.
Next step: Setting up your development environment!
Make sure you're running at least npm 2.2.1 and Node 8.0.0. We'll be using npm version 5.5.1 and Node version 8.9.0 today on Linux / MacOS X.
Go ahead and open terminal and install the Kik Node Package:
- Install with
npm install @kikinteractive/kik
We're going to be using this sample javascript to create a basic echo bot. Go ahead and create a new .js file and name it 'MyFirstEchoBot.js'. Paste in the sample code below:
'use strict';
// We are gonna need to import the http library and the kikBot SDK
// so that we can use them to make our bot work
let util = require('util');
let http = require('http');
let Bot = require('@kikinteractive/kik');
// We are first gonna create a new bot object with all of
// the information we just filled in on dev.kik.com
let bot = new Bot({
username: 'BOT_USERNAME_HERE', // The username you gave BotsWorth on Kik
apiKey: 'BOT_API_KEY_HERE', // The API Key you can find on your profile on dev.kik.com
baseUrl: 'WEBHOOK_HERE' // THIS IS YOUR WEBHOOK! make sure this maches the web tunnel or host you have running
});
// Send the configuration to kik to update the bot with the information above
bot.updateBotConfiguration();
// The onTextMessage(message) handler. This is run everytime your bot gets a message.
// The method takes a message object as a parameter.
bot.onTextMessage((message) => {
// We take the message and call the reply method with the body of the message we recieved
// this is the "echo" functionality of our bot
message.reply(message.body);
// print out the message so we can see on the server what's being sent
console.log(message.body);
});
// We want to set up our start chatting message. This will be the first message the user gets when they start
// chatting with your bot. This message is only sent once.
bot.onStartChattingMessage((message) => {
bot.getUserProfile(message.from)
.then((user) => {
message.reply(`Hey ${user.firstName}! I'm your new echo bot. Send me a message and I'll send it right back!`);
});
});
// Set up your server and start listening
let server = http
.createServer(bot.incoming())
.listen(8000, (err) => {
if (err) {
return console.log('something bad happened', err)
}
console.log(`server is listening on 8000`)
});
Next step: Filling in your information
Kik bots talk to the Kik infrastructure via HTTP requests: When sending a message, you send a request to us, and for messages to be received by your bot, Kik will make requests to your endpoint. In other words, Kik must be able to call your URL on your web server.
For our bot to work, we need to have an address that's accessible from the internet. Many production Kik bots run in cloud based services such as Heroku, Google App Engine or Amazon Web Services - or in their own data center infrastructure.
However, for development purposes you can use ngrok to provide access to your bot running in your local network. Ngrok is easy to setup and use, and has excellent documentation.
Ngrok is a handy tool and service that allows you tunnel requests from the wide open Internet to your local machine when it's behind a NAT or firewall. It's commonly used to develop web services and webhooks.
If you're using ngrok, launch it now in a new terminal window:
$ ngrok http 8080
When it launches, you will see a screen similar to the following:
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Account A Bot Developer (Plan: Free)
Version 2.1.18
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://ABCDEFG123.ngrok.io -> localhost:8080
Forwarding https://ABCDEFG123.ngrok.io -> localhost:8080
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00
Note the "Forwarding" address (https://ABCDEFG123.ngrok.io), as this will become part of your 'webhook' address.
To get the bot running, you're going to need your bot's username, and the API key. This is all available from dev.kik.com. It will be similar to the following screenshot:
Here you can set the display name and "profile picture" for your bot. You'll need to copy/paste your API key into the bot's source code.
We'll also need to set the webhook to the URL of your bot's "incoming messages" route on your web server. This is where Kik will send all the messages that users send to your bot. In the example code, the route for incoming messages is /incoming
In your 'MyFirstEchoBot.js' file, change:
let bot = new Bot({
username: 'BOT_USERNAME_HERE',
apiKey: 'BOT_API_KEY_HERE',
baseUrl: 'WEBHOOK_HERE'
});
so that your bot's username and your API key are passed to Kik API's Bot constructor. For example, if we named our bot ademobot
, and according the bot configuration panel our API key is 5a888dcb-4c6e-1973-b15t-308e1854f0ba
, then we would change the above line to:
let bot = new Bot({
username: 'ademobot',
apiKey: '5a888dcb-4c6e-1973-b15t-308e1854f0ba',
baseUrl: 'WEBHOOK_HERE'
});
Now for your webhook, Kik will send messages to this path upon receipt. So, if your web address is https://www.example.com then you'll set your webhook to https://www.example.com/incoming, as shown below.
let bot = new Bot({
username: 'ademobot',
apiKey: '5a888dcb-4c6e-1973-b15t-308e1854f0ba',
baseUrl: 'https://www.example.com/incoming'
});
If you're using ngrok as shown above, you would set the webhook as follows:
let bot = new Bot({
username: 'ademobot',
apiKey: '5a888dcb-4c6e-1973-b15t-308e1854f0ba',
baseUrl: 'https://ABCDEFG123.ngrok.io/incoming'
});
once you've got your 'MyFirstEchoBot.js' file ready, were going to open up terminal and run our Node server. cd to the directory that you saved your '.js' file in.
$ cd MyFirstEchoBot
Start the bot by running the file as shown below:
$ node 'MyFirstEchoBot'.js
* server is listening on 8000
With your bot up and running, you'll be able to chat with it in Kik. New users can click on the magnifying glass in their messages list to search for your bot. Once found, they can click on "Start Chatting" to subscribe to your bot and start interacting!
Here are other resources for using Kik node:
- stackoverflow.com is a great place to get answers about building a Kik chat bot.
- Go to dev.kik.com to get started building a bot, scan the code at dev.kik.com and talk to Botsworth.
The Kik bot library is released under the terms of the MIT license. See License for more information or see https://opensource.org/licenses/MIT.
You can send a targeted message to a user once they have subscribed to your bot. If you want to send someone a message, just call bot.send(...)
with their username. You don't need to specify a chat ID here since you are sending it directly to the user, not within a specific chat.
// To one user (a.username)
bot.send(Bot.Message.text('Hey, nice to meet you!'), 'a.username');
// You can use a shorthand for text messages to keep things a bit cleaner
bot.send('Getting started is super easy!', 'a.username');
If you want to send a photo to a user you can send a picture
message. The API will download the image you supply and pass it along. You have to set the attribution name and icon for the message so the knows where the content came from even if it's forwarded later.
bot.send(Bot.Message.picture('http://i.imgur.com/oalyVlU.jpg')
.setAttributionName('Imgur')
.setAttributionIcon('http://s.imgur.com/images/favicon-96x96.png'),
'a.username');
Whenever a user subscribes to your bot, your bot will receive a start-chatting
message. This message gives you the chance to say hello to the user and let them know what your bot is about.
You might want to greet your new user by name. You can use the bot.getUserProfile(...)
method to request information about users who have subscribed to your bot.
bot.onStartChattingMessage((message) => {
bot.getUserProfile(message.from)
.then((user) => {
message.reply(`Hey ${user.firstName}!`);
});
});
Separating different states into multiple message handlers can keep your bot logic under control. If you call next
from within your handler, you allow the next handler in the chain to run, otherwise, handling of the incoming message will end with the current handler.
bot.onTextMessage((message, next) => {
const userState = getUserState(message.from);
if (!userState.inIntroState) {
// Send the user the intro state
// ...
return;
}
// Allow the next handler take over
next();
});
bot.onTextMessage((message) => {
searchFor(message.body)
.then((result) => {
message.reply(result);
});
});
You can specify a static keyboard for your bot when a user starts mentioning it in a conversation:
let bot = new Bot({
username: 'echo.bot',
apiKey: '7b939d69-e840-4d22-aab8-4188c2198f8a',
baseUrl: 'https://kik-echobot.ngrok.io/',
staticKeyboard: new Bot.ResponseKeyboard(['Option 1', 'Option 2'])
});
Parses user messages sent from Kik's server. Use the .incoming() method to return the middleware in a form of function (req, res, next) {}
. The middleware will automatically decode the request, and call the appropriate on
functions based on the content type. Additional middleware can be used by calling the .use(handler) method.
Kind: global class
See: https://bots.kik.com
- Bot
- new Bot()
- .use(handler)
- .updateBotConfiguration()
- .onTextMessage([text], handler)
- .onLinkMessage(handler)
- .onPictureMessage(handler)
- .onVideoMessage(handler)
- .onStartChattingMessage(handler)
- .onScanDataMessage(handler)
- .onFriendPickerMessage(handler)
- .onStickerMessage(handler)
- .onIsTypingMessage(handler)
- .onDeliveryReceiptMessage(handler)
- .onReadReceiptMessage(handler)
- .getKikCodeUrl() ⇒
promise.<string>
- .getUserProfile() ⇒
promise.<UserProfile>
- .broadcast(messages, recipients)
- .send(messages, recipient, [chatId])
- .incoming()
- .outgoing(handler)
Param | Type | Description |
---|---|---|
options.username | string |
|
options.apiKey | string |
|
[options.baseUrl] | string |
|
[options.incomingPath] | string |
Set true to enable polling or set options |
[options.manuallySendReadReceipts] | boolean |
|
[options.receiveReadReceipts] | boolean |
|
[options.receiveDeliveryReceipts] | boolean |
|
[options.receiveIsTyping] | boolean |
|
[options.skipSignatureCheck] | boolean |
Verify the authenticity of inbound requests. For testing only, do not disable for a bot in production. |
[options.staticKeyboard] | ResponseKeyboard |
Static keyboard for your bot |
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Kind: instance method of Bot
Kind: instance method of Bot
Param | Type |
---|---|
[text] | string | regexp |
handler | MessageHandlerCallback |
Example
bot.onTextMessage((incoming, next) => {
// reply handles the message and stops other handlers
// from being called for this message
incoming.reply(`Hi I'm ${bot.username}`);
});
Example
bot.onTextMessage((incoming, next) => {
if (incoming.body !== 'Hi') {
// we only handle welcoming, let someone else deal with this
// message
return next();
}
// say hello...
});
Example
bot.onTextMessage(/^hi|hello|bonjour$/i, (incoming, next) => {
// say hello...
});
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Creates a Kik Code with the intended options and returns the URL of the Kik Code image. If the options specify a data Kik Code this will hit the Kik Code service and store that data for you.
Kind: instance method of Bot
Param | Type | Description |
---|---|---|
[options.data] | string | object |
The data to be sent back to this bot after the user scans |
[options.width] | number |
Width of the Kik code in the PNG image |
[options.height] | number |
Height of the Kik code in the PNG image |
[options.size] | number |
Helper for the width and height in the PNG image |
[options.color] | number |
The color which the user will see after scanning. See {KikCode.Colors} |
bot.getUserProfile() ⇒ promise.<UserProfile>
Kind: instance method of Bot
Kind: instance method of Bot
Param | Type |
---|---|
messages | array |
recipients | array |
Kind: instance method of Bot
Param | Type |
---|---|
messages | array |
recipient | string |
[chatId] | string |
Handles the incoming requests for messages configuration.
Kind: instance method of Bot
Adds a post processing handler for all outgoing messages. Messages passed to this handler will be JSON objects.
Kind: instance method of Bot
Param | Type |
---|---|
handler | MessageHandlerCallback |
Example
bot.outgoing((outgoing, next) => {
console.log('Outgoing message:', outgoing);
next();
});
Object that allows you to send a response to user messages or ignore them.
Kind: global class
- IncomingMessage
- .reply(messages) ⇒
promise.<object>
- .markRead() ⇒
promise.<object>
- .startTyping() ⇒
promise.<object>
- .stopTyping() ⇒
promise.<object>
- .ignore()
- .reply(messages) ⇒
Kind: instance method of IncomingMessage
Param | Type |
---|---|
messages | Message | array.<Message> |
Kind: instance method of IncomingMessage
Kind: instance method of IncomingMessage
Kind: instance method of IncomingMessage
Kind: instance method of IncomingMessage
See https://dev.kik.com/#/docs/messaging#user-profiles
Kind: global class
- UserProfile
- .displayName ⇒
string
- .username ⇒
string
- .firstName ⇒
string
- .lastName ⇒
string
- .profilePicUrl ⇒
string
- .profilePicLastModified ⇒
number
- .timezone ⇒
string
- .displayName ⇒
Kind: instance property of UserProfile
Kind: instance property of UserProfile
Kind: instance property of UserProfile
Kind: instance property of UserProfile
Kind: instance property of UserProfile
Kind: instance property of UserProfile
Kind: instance property of UserProfile
Object that stores a specific message that can be sent to/received from a user. The static methods of Message
are factories that generate a specific kind of message.
Kind: global class
- Message
- static
- instance
- .from ⇒
string
- .id ⇒
string
- .chatId ⇒
string
- .messageIds ⇒
array
- .readReceiptRequested ⇒
boolean
- .stickerPackId ⇒
string
- .scanData ⇒
string
- .stickerUrl ⇒
string
- .timestamp ⇒
number
- .type ⇒
string
- .kikJsData ⇒
object
- .picUrl ⇒
string
- .noForward ⇒
boolean
- .isTyping ⇒
boolean
- .body ⇒
string
- .text ⇒
string
- .title ⇒
string
- .url ⇒
string
- .videoUrl ⇒
string
- .delay ⇒
number
- .typeTime ⇒
number
- .attributionName ⇒
string
- .attributionIcon ⇒
string
- .loop ⇒
boolean
- .muted ⇒
boolean
- .autoplay ⇒
boolean
- .noSave ⇒
boolean
- .participants ⇒
array
- .chatType ⇒
string
- .mention ⇒
string
- .picked ⇒
array
- .metadata ⇒
object
- .isInPublicChat() ⇒
boolean
- .isInPrivateChat() ⇒
boolean
- .isInDirectChat() ⇒
boolean
- .isTextMessage() ⇒
boolean
- .isLinkMessage() ⇒
boolean
- .isPictureMessage() ⇒
boolean
- .isVideoMessage() ⇒
boolean
- .isStartChattingMessage() ⇒
boolean
- .isScanDataMessage() ⇒
boolean
- .isFriendPickerMessage() ⇒
boolean
- .isStickerMessage() ⇒
boolean
- .isIsTypingMessage() ⇒
boolean
- .isDeliveryReceiptMessage() ⇒
boolean
- .isReadReceiptMessage() ⇒
boolean
- .isMention() ⇒
boolean
- .toJSON() ⇒
object
- .addTextResponse(text) ⇒
Message
- .addResponseKeyboard(suggestions, [isHidden], [user]) ⇒
Message
- .setKikJsData(kikJsData) ⇒
Message
- .setPicUrl(picUrl) ⇒
Message
- .setNoForward(noForward) ⇒
Message
- .setIsTyping(isTyping) ⇒
Message
- .setMessageIds(messageIds) ⇒
Message
- .setBody(body) ⇒
Message
- .setText(text) ⇒
Message
- .setTitle(title) ⇒
Message
- .setUrl(url) ⇒
Message
- .setVideoUrl(videoUrl) ⇒
Message
- .setDelay(delay) ⇒
Message
- .setTypeTime(typeTime) ⇒
Message
- .setAttributionName(attributionName) ⇒
Message
- .setAttributionIcon(attributionIcon) ⇒
Message
- .setLoop(loop) ⇒
Message
- .setMuted(muted) ⇒
Message
- .setAutoplay(autoplay) ⇒
Message
- .setNoSave(noSave) ⇒
Message
- .setMention(noSave) ⇒
Message
- .from ⇒
See https://dev.kik.com/#/docs/messaging#receiving-messages
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#receiving-messages
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#receiving-messages
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#receipts
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#receipts
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#sticker
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#kik-codes-api
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#sticker
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#common-fields
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#message-formats
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#link
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#link
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#link
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#is-typing
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#text
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#link
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#link
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#link
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#video
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#common-fields
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#text
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#attribution
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#attribution
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#video
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#video
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#video
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#video
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#participants
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#all-received-chat-messages-excluding-receipts (will be undefined
for receipt messages)
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#mention
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#friend-picker
Kind: instance property of Message
Kind: instance property of Message
See https://dev.kik.com/#/docs/messaging#text
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#all-received-chat-messages-excluding-receipts
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#all-received-chat-messages-excluding-receipts
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#all-received-chat-messages-excluding-receipts
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#link
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#picture
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#video
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#start-chatting
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#scan-data
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#friend-picker
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#sticker
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#is-typing
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#receipts
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#receipts
Kind: instance method of Message
See https://dev.kik.com/#/docs/messaging#mentions
Kind: instance method of Message
Constructs a JSON payload ready to be sent to the bot messaging API
Kind: instance method of Message
message.addTextResponse(text) ⇒ Message
See https://dev.kik.com/#/docs/messaging#keyboards
Kind: instance method of Message
Param | Type |
---|---|
text | string |
message.addResponseKeyboard(suggestions, [isHidden], [user]) ⇒ Message
See https://dev.kik.com/#/docs/messaging#keyboards
Kind: instance method of Message
Param | Type |
---|---|
suggestions | array |
[isHidden] | boolean |
[user] | string |
message.setKikJsData(kikJsData) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
kikJsData | object |
message.setPicUrl(picUrl) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
picUrl | string |
message.setNoForward(noForward) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
noForward | boolean |
message.setIsTyping(isTyping) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
isTyping | boolean |
message.setMessageIds(messageIds) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
messageIds | array |
message.setBody(body) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
body | string |
message.setText(text) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
text | string |
message.setTitle(title) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
title | string |
message.setUrl(url) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
url | string |
message.setVideoUrl(videoUrl) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
videoUrl | string |
message.setDelay(delay) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
delay | number |
message.setTypeTime(typeTime) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
typeTime | number |
message.setAttributionName(attributionName) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
attributionName | string |
message.setAttributionIcon(attributionIcon) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
attributionIcon | string |
message.setLoop(loop) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
loop | boolean |
message.setMuted(muted) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
muted | boolean |
message.setAutoplay(autoplay) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
autoplay | boolean |
message.setNoSave(noSave) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
noSave | boolean |
message.setMention(mention) ⇒ Message
Kind: instance method of Message
Param | Type |
---|---|
mention | string |
Message.text() ⇒ Message
See https://dev.kik.com/#/docs/messaging#text
Kind: static method of Message
Message.link() ⇒ Message
See https://dev.kik.com/#/docs/messaging#link
Kind: static method of Message
Message.picture() ⇒ Message
See https://dev.kik.com/#/docs/messaging#picture
Kind: static method of Message
Message.video() ⇒ Message
See https://dev.kik.com/#/docs/messaging#video
Kind: static method of Message
Message.isTyping() ⇒ Message
See https://dev.kik.com/#/docs/messaging#is-typing
Kind: static method of Message
Message.readReceipt() ⇒ Message
See https://dev.kik.com/#/docs/messaging#receipts
Kind: static method of Message
Message.fromJSON(json) ⇒ Message
Constructs a new {Message} object from a JSON-encoded payload See https://dev.kik.com/#/docs
Kind: static method of Message
Param | Type |
---|---|
json | object |
new Bot.ResponseKeyboard([responses], [hidden], [to])
Param | Type |
---|---|
[responses] | array |
[hidden] | boolean |
[to] | string |
Example
let keyboard = new Bot.ResponseKeyboard(['Option 1', 'Option 2']);
Example
let keyboard = new Bot.ResponseKeyboard(['Option 1', 'Option 2'], true, 'kikteam');
message.addResponse(response) ⇒ ResponseKeyboard
Kind: instance method of ResponseKeyboard
Param | Type |
---|---|
response | string | object |
Example
let keyboard = new Bot.ResponseKeyboard();
keyboard.addResponse(Bot.Response.friendPicker('Pick a friend'));
keyboard.addResponse('Option 1');
keyboard.addResponse('Option 2');
See https://dev.kik.com/#/docs/messaging#kik-codes-api
Kind: global class
See https://dev.kik.com/#/docs/messaging#kik-code-colors
Kind: static enum property of KikCode
Properties
Name | Type | Default | Description |
---|---|---|---|
KikBlue | number |
0 |
#42B4E6 |
Turquoise | number |
1 |
#42DFD8 |
Mint | number |
2 |
#24D7A7 |
Forest | number |
3 |
#25912B |
KikGreen | number |
4 |
#87D300 |
Sunshine | number |
5 |
#F8CB1C |
OrangeCreamsicle | number |
6 |
#FC971B |
BloodOrange | number |
7 |
#F9703A |
CandyAppleRed | number |
8 |
#F7373C |
Salmon | number |
9 |
#F88585 |
Coral | number |
10 |
#F767C3 |
Cranberry | number |
11 |
#940D65 |
Lavender | number |
12 |
#CB94FF |
RoyalPurple | number |
13 |
#8737F8 |
Marine | number |
14 |
#353CD4 |
Steel | number |
15 |
#5D7687 |
See https://dev.kik.com/#/docs/messaging#suggested-response-keyboard
Kind: global class
Response.text(body) ⇒ Response
Kind: static method of Response
Param | Type |
---|---|
body | string |
Response.friendPicker([body], [min], [max], [preselected]) ⇒ Response
Kind: static method of Response
Param | Type | Description |
---|---|---|
[body] | string |
|
[min] | int |
|
[max] | int |
|
[preselected] | array |
array of strings |
Response.picture(picUrl, metadata) ⇒ Response
Kind: static method of Response
Param | Type |
---|---|
picUrl | string |
metadata | object |