Kik Node API
!NPM Versionnpm-imagenpm-url !Build Statustravis-imagetravis-url !Coverage Statuscoveralls-imagecoveralls-urlGetting Started
Use this library to communicate with the Kik API to develop a bot for Kik Messengerkik-url. Got to dev.kik.comdev-kik-url to learn more and start building a bot.- Install with
npm install @kikinteractive/kik
npm-url
Contributing
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.Getting Help
Here are other resources for using Kik node:- stackoverflow.comstackoverflow-url is a great place to get answers about building a Kik chat bot.
- Go to dev.kik.comdev-kik-url to get started building a bot, scan the code at dev.kik.com and talk to Botsworth.
License
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.How To
Creating a basic Kik bot is simple:- Import
@kikinteractive/kik
- Create a bot with the username and API key you got from https://dev.kik.com/
- Configure your bot as described in the documentationdev-config-kik-url
- Add the bot as middleware to your server with
bot.incoming()
- Start your web server
You can use any node-style web server to host your Kik bot. Add handlers to your bot by calling
bot.onTextMessage(...)
and get notified whenever a user messages you. Take action on the messages as they come in and call message.reply(...)
to respond to the message within the chat the message was sent from.Check out the full API documentation for more advanced uses.
Your first echo bot
'use strict';
let util = require('util');
let http = require('http');
let Bot = require('@kikinteractive/kik');
// Configure the bot API endpoint, details for your bot
let bot = new Bot({
username: 'echo.bot',
apiKey: '7b939d69-e840-4d22-aab8-4188c2198f8a',
baseUrl: 'https://kik-echobot.ngrok.io/'
});
bot.updateBotConfiguration();
bot.onTextMessage((message) => {
message.reply(message.body);
});
// Set up your server and start listening
let server = http
.createServer(bot.incoming())
.listen(process.env.PORT || 8080);
Sending a message to a specific user
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 callbot.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');
Sending a picture message
If you want to send a photo to a user you can send apicture
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');
Greeting a user by name
Whenever a user subscribes to your bot, your bot will receive astart-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}!`);
});
});
Adding multiple handlers
Separating different states into multiple message handlers can keep your bot logic under control. If you callnext
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);
});
});
Setting a static keyboard
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'])
});
API Documentation
Bot
Parses user messages sent from Kik's server. Use the .incoming() method to return the middleware in a form offunction (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
* [new Bot()](#new_Bot_new)
* [.use(handler)](#Bot+use)
* [.updateBotConfiguration()](#Bot+updateBotConfiguration)
* [.onTextMessage([text], handler)](#Bot+onTextMessage)
* [.onLinkMessage(handler)](#Bot+onLinkMessage)
* [.onPictureMessage(handler)](#Bot+onPictureMessage)
* [.onVideoMessage(handler)](#Bot+onVideoMessage)
* [.onStartChattingMessage(handler)](#Bot+onStartChattingMessage)
* [.onScanDataMessage(handler)](#Bot+onScanDataMessage)
* [.onFriendPickerMessage(handler)](#Bot+onFriendPickerMessage)
* [.onStickerMessage(handler)](#Bot+onStickerMessage)
* [.onIsTypingMessage(handler)](#Bot+onIsTypingMessage)
* [.onDeliveryReceiptMessage(handler)](#Bot+onDeliveryReceiptMessage)
* [.onReadReceiptMessage(handler)](#Bot+onReadReceiptMessage)
* [.getKikCodeUrl()](#Bot+getKikCodeUrl) ⇒ <code>promise.<string></code>
* [.getUserProfile()](#Bot+getUserProfile) ⇒ <code>[promise.<UserProfile>](#UserProfile)</code>
* [.broadcast(messages, recipients)](#Bot+broadcast)
* [.send(messages, recipient, [chatId])](#Bot+send)
* [.incoming()](#Bot+incoming)
* [.outgoing(handler)](#Bot+outgoing)
new Bot()
| 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 |bot.use(handler)
Kind: instance method ofBot
| Param | Type | | --- | --- | | handler |
MessageHandlerCallback
|bot.updateBotConfiguration()
Kind: instance method ofBot
bot.onTextMessage(text, handler)
Kind: instance method ofBot
| 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}`);
});
Examplebot.onTextMessage((incoming, next) => {
if (incoming.body !== 'Hi') {
// we only handle welcoming, let someone else deal with this
// message
return next();
}
// say hello...
});
Examplebot.onTextMessage(/^hi|hello|bonjour$/i, (incoming, next) => {
// say hello...
});
bot.onLinkMessage(handler)
Kind: instance method ofBot
| Param | Type | | --- | --- | | handler |
MessageHandlerCallback
|bot.onPictureMessage(handler)
Kind: instance method ofBot
| Param | Type | | --- | --- | | handler |
MessageHandlerCallback
|bot.onVideoMessage(handler)
Kind: instance method ofBot
| Param | Type | | --- | --- | | handler |
MessageHandlerCallback
|bot.onStartChattingMessage(handler)
Kind: instance method ofBot
| Param | Type | | --- | --- | | handler |
MessageHandlerCallback
|bot.onScanDataMessage(handler)
Kind: instance method ofBot
| Param | Type | | --- | --- | | handler |
MessageHandlerCallback
|
bot.onFriendPickerMessage(handler)
Kind: instance method ofBot
| Param | Type | | --- | --- | | handler |
MessageHandlerCallback
|bot.onStickerMessage(handler)
Kind: instance method ofBot
| Param | Type | | --- | --- | | handler |
MessageHandlerCallback
|bot.onIsTypingMessage(handler)
Kind: instance method ofBot
| Param | Type | | --- | --- | | handler |
MessageHandlerCallback
|bot.onDeliveryReceiptMessage(handler)
Kind: instance method ofBot
| Param | Type | | --- | --- | | handler |
MessageHandlerCallback
|bot.onReadReceiptMessage(handler)
Kind: instance method ofBot
| Param | Type | | --- | --- | | handler |
MessageHandlerCallback
|bot.getKikCodeUrl() ⇒ promise.<string>
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
bot.broadcast(messages, recipients)
Kind: instance method ofBot
| Param | Type | | --- | --- | | messages |
array
|
| recipients | array
|bot.send(messages, recipient, chatId)
Kind: instance method ofBot
| Param | Type | | --- | --- | | messages |
array
|
| recipient | string
|
| chatId | string
|bot.incoming()
Handles the incoming requests for messages configuration.Kind: instance method of
Bot
bot.outgoing(handler)
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();
});
IncomingMessage
Object that allows you to send a response to user messages or ignore them.Kind: global class
* [.reply(messages)](#IncomingMessage+reply) ⇒ <code>promise.<object></code>
* [.markRead()](#IncomingMessage+markRead) ⇒ <code>promise.<object></code>
* [.startTyping()](#IncomingMessage+startTyping) ⇒ <code>promise.<object></code>
* [.stopTyping()](#IncomingMessage+stopTyping) ⇒ <code>promise.<object></code>
* [.ignore()](#IncomingMessage+ignore)
incomingMessage.reply(messages) ⇒ promise.<object>
Kind: instance method of IncomingMessage
| Param | Type | | --- | --- | | messages |
Message
| array.<Message>
|incomingMessage.markRead() ⇒ promise.<object>
Kind: instance method of IncomingMessage
incomingMessage.startTyping() ⇒ promise.<object>
Kind: instance method of IncomingMessage
incomingMessage.stopTyping() ⇒ promise.<object>
Kind: instance method of IncomingMessage
incomingMessage.ignore()
Kind: instance method ofIncomingMessage
UserProfile
See https://dev.kik.com/#/docs/messaging#user-profilesKind: global class
* [.displayName](#UserProfile+displayName) ⇒ <code>string</code>
* [.username](#UserProfile+username) ⇒ <code>string</code>
* [.firstName](#UserProfile+firstName) ⇒ <code>string</code>
* [.lastName](#UserProfile+lastName) ⇒ <code>string</code>
* [.profilePicUrl](#UserProfile+profilePicUrl) ⇒ <code>string</code>
* [.profilePicLastModified](#UserProfile+profilePicLastModified) ⇒ <code>number</code>
* [.timezone](#UserProfile+timezone) ⇒ <code>string</code>
userProfile.displayName ⇒ string
Kind: instance property of UserProfile
userProfile.username ⇒ string
Kind: instance property of UserProfile
userProfile.firstName ⇒ string
Kind: instance property of UserProfile
userProfile.lastName ⇒ string
Kind: instance property of UserProfile
userProfile.profilePicUrl ⇒ string
Kind: instance property of UserProfile
userProfile.profilePicLastModified ⇒ number
Kind: instance property of UserProfile
userProfile.timezone ⇒ string
Kind: instance property of UserProfile
Message
Object that stores a specific message that can be sent to/received from a user. The static methods ofMessage
are factories that generate a specific kind of message.Kind: global class
* _static_
* [.text()](#Message.text) ⇒ <code>[Message](#Message)</code>
* [.link()](#Message.link) ⇒ <code>[Message](#Message)</code>
* [.picture()](#Message.picture) ⇒ <code>[Message](#Message)</code>
* [.video()](#Message.video) ⇒ <code>[Message](#Message)</code>
* [.isTyping()](#Message.isTyping) ⇒ <code>[Message](#Message)</code>
* [.readReceipt()](#Message.readReceipt) ⇒ <code>[Message](#Message)</code>
* [.fromJSON(json)](#Message.fromJSON) ⇒ <code>[Message](#Message)</code>
* _instance_
* [.from](#Message+from) ⇒ <code>string</code>
* [.id](#Message+id) ⇒ <code>string</code>
* [.chatId](#Message+chatId) ⇒ <code>string</code>
* [.messageIds](#Message+messageIds) ⇒ <code>array</code>
* [.readReceiptRequested](#Message+readReceiptRequested) ⇒ <code>boolean</code>
* [.stickerPackId](#Message+stickerPackId) ⇒ <code>string</code>
* [.scanData](#Message+scanData) ⇒ <code>string</code>
* [.stickerUrl](#Message+stickerUrl) ⇒ <code>string</code>
* [.timestamp](#Message+timestamp) ⇒ <code>number</code>
* [.type](#Message+type) ⇒ <code>string</code>
* [.kikJsData](#Message+kikJsData) ⇒ <code>object</code>
* [.picUrl](#Message+picUrl) ⇒ <code>string</code>
* [.noForward](#Message+noForward) ⇒ <code>boolean</code>
* [.isTyping](#Message+isTyping) ⇒ <code>boolean</code>
* [.body](#Message+body) ⇒ <code>string</code>
* [.text](#Message+text) ⇒ <code>string</code>
* [.title](#Message+title) ⇒ <code>string</code>
* [.url](#Message+url) ⇒ <code>string</code>
* [.videoUrl](#Message+videoUrl) ⇒ <code>string</code>
* [.delay](#Message+delay) ⇒ <code>number</code>
* [.typeTime](#Message+typeTime) ⇒ <code>number</code>
* [.attributionName](#Message+attributionName) ⇒ <code>string</code>
* [.attributionIcon](#Message+attributionIcon) ⇒ <code>string</code>
* [.loop](#Message+loop) ⇒ <code>boolean</code>
* [.muted](#Message+muted) ⇒ <code>boolean</code>
* [.autoplay](#Message+autoplay) ⇒ <code>boolean</code>
* [.noSave](#Message+noSave) ⇒ <code>boolean</code>
* [.participants](#Message+participants) ⇒ <code>array</code>
* [.chatType](#Message+chatType) ⇒ <code>string</code>
* [.mention](#Message+mention) ⇒ <code>string</code>
* [.picked](#Message+picked) ⇒ <code>array</code>
* [.metadata](#Message+metadata) ⇒ <code>object</code>
* [.isInPublicChat()](#Message+isInPublicChat) ⇒ <code>boolean</code>
* [.isInPrivateChat()](#Message+isInPrivateChat) ⇒ <code>boolean</code>
* [.isInDirectChat()](#Message+isInDirectChat) ⇒ <code>boolean</code>
* [.isTextMessage()](#Message+isTextMessage) ⇒ <code>boolean</code>
* [.isLinkMessage()](#Message+isLinkMessage) ⇒ <code>boolean</code>
* [.isPictureMessage()](#Message+isPictureMessage) ⇒ <code>boolean</code>
* [.isVideoMessage()](#Message+isVideoMessage) ⇒ <code>boolean</code>
* [.isStartChattingMessage()](#Message+isStartChattingMessage) ⇒ <code>boolean</code>
* [.isScanDataMessage()](#Message+isScanDataMessage) ⇒ <code>boolean</code>
* [.isFriendPickerMessage()](#Message+isFriendPickerMessage) ⇒ <code>boolean</code>
* [.isStickerMessage()](#Message+isStickerMessage) ⇒ <code>boolean</code>
* [.isIsTypingMessage()](#Message+isIsTypingMessage) ⇒ <code>boolean</code>
* [.isDeliveryReceiptMessage()](#Message+isDeliveryReceiptMessage) ⇒ <code>boolean</code>
* [.isReadReceiptMessage()](#Message+isReadReceiptMessage) ⇒ <code>boolean</code>
* [.isMention()](#Message+isMention) ⇒ <code>boolean</code>
* [.toJSON()](#Message+toJSON) ⇒ <code>object</code>
* [.addTextResponse(text)](#Message+addTextResponse) ⇒ <code>[Message](#Message)</code>
* [.addResponseKeyboard(suggestions, [isHidden], [user])](#Message+addResponseKeyboard) ⇒ <code>[Message](#Message)</code>
* [.setKikJsData(kikJsData)](#Message+setKikJsData) ⇒ <code>[Message](#Message)</code>
* [.setPicUrl(picUrl)](#Message+setPicUrl) ⇒ <code>[Message](#Message)</code>
* [.setNoForward(noForward)](#Message+setNoForward) ⇒ <code>[Message](#Message)</code>
* [.setIsTyping(isTyping)](#Message+setIsTyping) ⇒ <code>[Message](#Message)</code>
* [.setMessageIds(messageIds)](#Message+setMessageIds) ⇒ <code>[Message](#Message)</code>
* [.setBody(body)](#Message+setBody) ⇒ <code>[Message](#Message)</code>
* [.setText(text)](#Message+setText) ⇒ <code>[Message](#Message)</code>
* [.setTitle(title)](#Message+setTitle) ⇒ <code>[Message](#Message)</code>
* [.setUrl(url)](#Message+setUrl) ⇒ <code>[Message](#Message)</code>
* [.setVideoUrl(videoUrl)](#Message+setVideoUrl) ⇒ <code>[Message](#Message)</code>
* [.setDelay(delay)](#Message+setDelay) ⇒ <code>[Message](#Message)</code>
* [.setTypeTime(typeTime)](#Message+setTypeTime) ⇒ <code>[Message](#Message)</code>
* [.setAttributionName(attributionName)](#Message+setAttributionName) ⇒ <code>[Message](#Message)</code>
* [.setAttributionIcon(attributionIcon)](#Message+setAttributionIcon) ⇒ <code>[Message](#Message)</code>
* [.setLoop(loop)](#Message+setLoop) ⇒ <code>[Message](#Message)</code>
* [.setMuted(muted)](#Message+setMuted) ⇒ <code>[Message](#Message)</code>
* [.setAutoplay(autoplay)](#Message+setAutoplay) ⇒ <code>[Message](#Message)</code>
* [.setNoSave(noSave)](#Message+setNoSave) ⇒ <code>[Message](#Message)</code>
* [.setMention(noSave)](#Message+setMention) ⇒ <code>[Message](#Message)</code>
message.from ⇒ string
See https://dev.kik.com/#/docs/messaging#receiving-messagesKind: instance property of
Message
message.id ⇒ string
See https://dev.kik.com/#/docs/messaging#receiving-messagesKind: instance property of
Message
message.chatId ⇒ string
See https://dev.kik.com/#/docs/messaging#receiving-messagesKind: instance property of
Message
message.messageIds ⇒ array
See https://dev.kik.com/#/docs/messaging#receiptsKind: instance property of
Message
message.readReceiptRequested ⇒ boolean
See https://dev.kik.com/#/docs/messaging#receiptsKind: instance property of
Message
message.stickerPackId ⇒ string
See https://dev.kik.com/#/docs/messaging#stickerKind: instance property of
Message
message.scanData ⇒ string
See https://dev.kik.com/#/docs/messaging#kik-codes-apiKind: instance property of
Message
message.stickerUrl ⇒ string
See https://dev.kik.com/#/docs/messaging#stickerKind: instance property of
Message
message.timestamp ⇒ number
See https://dev.kik.com/#/docs/messaging#common-fieldsKind: instance property of
Message
message.type ⇒ string
See https://dev.kik.com/#/docs/messaging#message-formatsKind: instance property of
Message
message.kikJsData ⇒ object
See https://dev.kik.com/#/docs/messaging#linkKind: instance property of
Message
message.picUrl ⇒ string
See https://dev.kik.com/#/docs/messaging#linkKind: instance property of
Message
message.noForward ⇒ boolean
See https://dev.kik.com/#/docs/messaging#linkKind: instance property of
Message
message.isTyping ⇒ boolean
See https://dev.kik.com/#/docs/messaging#is-typingKind: instance property of
Message
message.body ⇒ string
See https://dev.kik.com/#/docs/messaging#textKind: instance property of
Message
message.text ⇒ string
See https://dev.kik.com/#/docs/messaging#linkKind: instance property of
Message
message.title ⇒ string
See https://dev.kik.com/#/docs/messaging#linkKind: instance property of
Message
message.url ⇒ string
See https://dev.kik.com/#/docs/messaging#linkKind: instance property of
Message
message.videoUrl ⇒ string
See https://dev.kik.com/#/docs/messaging#videoKind: instance property of
Message
message.delay ⇒ number
See https://dev.kik.com/#/docs/messaging#common-fieldsKind: instance property of
Message
message.typeTime ⇒ number
See https://dev.kik.com/#/docs/messaging#textKind: instance property of
Message
message.attributionName ⇒ string
See https://dev.kik.com/#/docs/messaging#attributionKind: instance property of
Message
message.attributionIcon ⇒ string
See https://dev.kik.com/#/docs/messaging#attributionKind: instance property of
Message
message.loop ⇒ boolean
See https://dev.kik.com/#/docs/messaging#videoKind: instance property of
Message
message.muted ⇒ boolean
See https://dev.kik.com/#/docs/messaging#videoKind: instance property of
Message
message.autoplay ⇒ boolean
See https://dev.kik.com/#/docs/messaging#videoKind: instance property of
Message
message.noSave ⇒ boolean
See https://dev.kik.com/#/docs/messaging#videoKind: instance property of
Message
message.participants ⇒ array
See https://dev.kik.com/#/docs/messaging#participantsKind: instance property of
Message
message.chatType ⇒ array
See https://dev.kik.com/#/docs/messaging#all-received-chat-messages-excluding-receipts (will be undefined
for receipt messages)Kind: instance property of
Message
message.mention ⇒ string
See https://dev.kik.com/#/docs/messaging#mentionKind: instance property of
Message
message.picked ⇒ string
See https://dev.kik.com/#/docs/messaging#friend-pickerKind: instance property of
Message
message.metadata ⇒ object
Kind: instance property of Message
message.isTextMessage() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#textKind: instance method of
Message
message.isInPublicChat() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#all-received-chat-messages-excluding-receiptsKind: instance method of
Message
message.isInPrivateChat() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#all-received-chat-messages-excluding-receiptsKind: instance method of
Message
message.isInDirectChat() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#all-received-chat-messages-excluding-receiptsKind: instance method of
Message
message.isLinkMessage() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#linkKind: instance method of
Message
message.isPictureMessage() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#pictureKind: instance method of
Message
message.isVideoMessage() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#videoKind: instance method of
Message
message.isStartChattingMessage() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#start-chattingKind: instance method of
Message
message.isScanDataMessage() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#scan-dataKind: instance method of
Message
message.isFriendPickerMessage() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#friend-pickerKind: instance method of
Message
message.isStickerMessage() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#stickerKind: instance method of
Message
message.isIsTypingMessage() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#is-typingKind: instance method of
Message
message.isDeliveryReceiptMessage() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#receiptsKind: instance method of
Message
message.isReadReceiptMessage() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#receiptsKind: instance method of
Message
message.isMention() ⇒ boolean
See https://dev.kik.com/#/docs/messaging#mentionsKind: instance method of
Message
message.toJSON() ⇒ object
Constructs a JSON payload ready to be sent to the
bot messaging APIKind: instance method of
Message
message.addTextResponse(text) ⇒ Message
See https://dev.kik.com/#/docs/messaging#keyboardsKind: instance method of
Message
| Param | Type | | --- | --- | | text |
string
|message.addResponseKeyboard(suggestions, isHidden, user) ⇒ Message
See https://dev.kik.com/#/docs/messaging#keyboardsKind: 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#textKind: static method of
Message
Message.link() ⇒ Message
See https://dev.kik.com/#/docs/messaging#linkKind: static method of
Message
Message.picture() ⇒ Message
See https://dev.kik.com/#/docs/messaging#pictureKind: static method of
Message
Message.video() ⇒ Message
See https://dev.kik.com/#/docs/messaging#videoKind: static method of
Message
Message.isTyping() ⇒ Message
See https://dev.kik.com/#/docs/messaging#is-typingKind: static method of
Message
Message.readReceipt() ⇒ Message
See https://dev.kik.com/#/docs/messaging#receiptsKind: static method of
Message
Message.fromJSON(json) ⇒ Message
Constructs a new {Message} object from a JSON-encoded payload
See https://dev.kik.com/#/docsKind: static method of
Message
| Param | Type | | --- | --- | | json |
object
|ResponseKeyboard
* [new Bot.ResponseKeyboard(responses, hidden, to)](#new_Bot_ResponseKeyboard)
* [.addResponse(resonse)](#ResponseKeyboard+addResponse)
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');
KikCode
See https://dev.kik.com/#/docs/messaging#kik-codes-apiKind: global class
KikCode.Colors : enum
See https://dev.kik.com/#/docs/messaging#kik-code-colorsKind: 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 |Response
See https://dev.kik.com/#/docs/messaging#suggested-response-keyboardKind: 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
|