Release 1.5.0 Kik · The Kik Code creation API is accessed through KikApi.create_code. This...
Transcript of Release 1.5.0 Kik · The Kik Code creation API is accessed through KikApi.create_code. This...
kik-python DocumentationRelease 150
Kik =
Mar 31 2017
Contents
1 User Guide 311 User Guide 3
2 API Documentation 921 API Documentation 9
3 Indices and tables 17
i
ii
kik-python Documentation Release 150
Release v150
kik is a thin wrapper around the Kik API
Contents 1
kik-python Documentation Release 150
2 Contents
CHAPTER 1
User Guide
This part of the documentation provides a simple introduction to the library
User Guide
Ready to get started This page gives an overview of how to install and use kik
Installation
You can install the library though pip either from the command line
$ pip install kik
or add the following line to your projectrsquos requirementstxt file
kik==150
Example Bot
Here is a minimal echo bot using Flask
1 from flask import Flask request Response2
3 from kik import KikApi Configuration4 from kikmessages import messages_from_json TextMessage5
6 app = Flask(__name__)7 kik = KikApi(BOT_USERNAME BOT_API_KEY)8
9 kikset_configuration(Configuration(webhook=YOUR_WEBHOOK))10
3
kik-python Documentation Release 150
11 approute(incoming methods=[POST])12 def incoming()13 if not kikverify_signature(requestheadersget(X-Kik-Signature) requestget_
rarr˓data())14 return Response(status=403)15
16 messages = messages_from_json(requestjson[messages])17
18 for message in messages19 if isinstance(message TextMessage)20 kiksend_messages([21 TextMessage(22 to=messagefrom_user23 chat_id=messagechat_id24 body=messagebody25 )26 ])27
28 return Response(status=200)29
30
31 if __name__ == __main__32 apprun(port=8080 debug=True)
The API Client
The core of the library is the KikApi class which is used to send requests to the Kik API The client needs to beinstantiated with your botrsquos username and API key
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)
Configuration
The Configuration API can be accessed through two functions
KikApiget_configuration retrieves your bots current configuration as a Configuration object
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = kikget_configuration()gtgtgt configwebhookhttpsexamplecomincoming
KikApiset_configuration sets your botrsquos configuration taking a Configuration object
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
4 Chapter 1 User Guide
kik-python Documentation Release 150
Receiving Messages
The library contains two functions that are useful when receiving messages to your webhook
The first is KikApiverify_signature which is takes care of authenticating incoming requests to your web-hook
Just call the method with the provided signature header and the body of the incoming HTTP request
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikverify_signature(SIGNATURE_HEADER REQUEST_BODY)True
If this method returns False you should ignore the incoming request as it may be malicious
Note verify_signature must be called with the raw request body not the parsed JSON
The second important function for receiving messages is messagesmessages_from_json which convertsincoming messages into Python objects After you parse the incoming request as JSON simply pass the array ofmessages in the messages field to the function to get an array of message objects
gtgtgt from kikmessages import messages_from_jsongtgtgt messages_from_json(messages)[ltkikmessagesTextMessagegt ltkikmessagesLinkMessagegt]
For a complete list of message types you might receive see the Kik API Documentation
Sending Messages
Messages are sent using KikApisend_messages for the messaging API
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test ) ])
Similarly messages can be sent through the broadcasting API using KikApisend_broadcast
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test
11 User Guide 5
kik-python Documentation Release 150
)
])
Messages are constructed using the Message subclasses in kikmessages These classes directly mirror the APImessage formats with the exceptions of snake_case naming from being renamed to from_user (as from is a reservedkeyword in Python) and the handling of attribution and keyboards (explained below)
Attribution
All message types that support attribution are subclasses of AttributableMessage To give custom attributionto these messages simply assign their attribution property to a CustomAttribution instance
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution( name=A Name icon_url=httpfoobaranicon )
Additionally there are special attribution values to make a PictureMessage or VideoMessage appear tobe from the camera or gallery To achieve these effects assign the attribution property of the messagePresetAttributionsCAMERA or PresetAttributionsGALLERY
gtgtgt from kikmessages import PresetAttributionsgtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
Keyboards
All message types that support keyboards are subclasses of KeyboardMessage These messages contain akeyboards array holding any number of Keyboard instances
Currently the only supported keyboard types is SuggestedResponseKeyboard which must be assigned aresponses array containing instances of classes subclassing SuggestedResponse (eg TextResponsePictureResponse and FriendPickerResponse)
gtgtgt from kikmessages import TextMessage SuggestedResponseKeyboard TextResponsegtgtgt message = TextMessage()gtgtgt messagekeyboardsappend( SuggestedResponseKeyboard( to=aleem hidden=True responses=[TextResponse(OK)] ) )
Users
The User Profile API is accessed through KikApiget_userltkikKikApiget_user() which retrieves auserrsquos profile from their username
6 Chapter 1 User Guide
kik-python Documentation Release 150
The function returns a User containing the userrsquos profile
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt user = kikget_user(aleem)gtgtgt userfirst_nameJohnny
Kik Codes
The Kik Code creation API is accessed through KikApicreate_code This function takes an optional dataparameter which will be embedded in the Kik Code and returned in the ScanDataMessage you receive when theuser scans the code
create_code returns a Code which allows you to get a URL for the code
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt code = kikcreate_code(some data)gtgtgt codeurl()httpsapikikcomv1code161d764eeebf050fba373ae8cef9f5052524019a
11 User Guide 7
kik-python Documentation Release 150
8 Chapter 1 User Guide
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
Contents
1 User Guide 311 User Guide 3
2 API Documentation 921 API Documentation 9
3 Indices and tables 17
i
ii
kik-python Documentation Release 150
Release v150
kik is a thin wrapper around the Kik API
Contents 1
kik-python Documentation Release 150
2 Contents
CHAPTER 1
User Guide
This part of the documentation provides a simple introduction to the library
User Guide
Ready to get started This page gives an overview of how to install and use kik
Installation
You can install the library though pip either from the command line
$ pip install kik
or add the following line to your projectrsquos requirementstxt file
kik==150
Example Bot
Here is a minimal echo bot using Flask
1 from flask import Flask request Response2
3 from kik import KikApi Configuration4 from kikmessages import messages_from_json TextMessage5
6 app = Flask(__name__)7 kik = KikApi(BOT_USERNAME BOT_API_KEY)8
9 kikset_configuration(Configuration(webhook=YOUR_WEBHOOK))10
3
kik-python Documentation Release 150
11 approute(incoming methods=[POST])12 def incoming()13 if not kikverify_signature(requestheadersget(X-Kik-Signature) requestget_
rarr˓data())14 return Response(status=403)15
16 messages = messages_from_json(requestjson[messages])17
18 for message in messages19 if isinstance(message TextMessage)20 kiksend_messages([21 TextMessage(22 to=messagefrom_user23 chat_id=messagechat_id24 body=messagebody25 )26 ])27
28 return Response(status=200)29
30
31 if __name__ == __main__32 apprun(port=8080 debug=True)
The API Client
The core of the library is the KikApi class which is used to send requests to the Kik API The client needs to beinstantiated with your botrsquos username and API key
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)
Configuration
The Configuration API can be accessed through two functions
KikApiget_configuration retrieves your bots current configuration as a Configuration object
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = kikget_configuration()gtgtgt configwebhookhttpsexamplecomincoming
KikApiset_configuration sets your botrsquos configuration taking a Configuration object
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
4 Chapter 1 User Guide
kik-python Documentation Release 150
Receiving Messages
The library contains two functions that are useful when receiving messages to your webhook
The first is KikApiverify_signature which is takes care of authenticating incoming requests to your web-hook
Just call the method with the provided signature header and the body of the incoming HTTP request
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikverify_signature(SIGNATURE_HEADER REQUEST_BODY)True
If this method returns False you should ignore the incoming request as it may be malicious
Note verify_signature must be called with the raw request body not the parsed JSON
The second important function for receiving messages is messagesmessages_from_json which convertsincoming messages into Python objects After you parse the incoming request as JSON simply pass the array ofmessages in the messages field to the function to get an array of message objects
gtgtgt from kikmessages import messages_from_jsongtgtgt messages_from_json(messages)[ltkikmessagesTextMessagegt ltkikmessagesLinkMessagegt]
For a complete list of message types you might receive see the Kik API Documentation
Sending Messages
Messages are sent using KikApisend_messages for the messaging API
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test ) ])
Similarly messages can be sent through the broadcasting API using KikApisend_broadcast
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test
11 User Guide 5
kik-python Documentation Release 150
)
])
Messages are constructed using the Message subclasses in kikmessages These classes directly mirror the APImessage formats with the exceptions of snake_case naming from being renamed to from_user (as from is a reservedkeyword in Python) and the handling of attribution and keyboards (explained below)
Attribution
All message types that support attribution are subclasses of AttributableMessage To give custom attributionto these messages simply assign their attribution property to a CustomAttribution instance
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution( name=A Name icon_url=httpfoobaranicon )
Additionally there are special attribution values to make a PictureMessage or VideoMessage appear tobe from the camera or gallery To achieve these effects assign the attribution property of the messagePresetAttributionsCAMERA or PresetAttributionsGALLERY
gtgtgt from kikmessages import PresetAttributionsgtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
Keyboards
All message types that support keyboards are subclasses of KeyboardMessage These messages contain akeyboards array holding any number of Keyboard instances
Currently the only supported keyboard types is SuggestedResponseKeyboard which must be assigned aresponses array containing instances of classes subclassing SuggestedResponse (eg TextResponsePictureResponse and FriendPickerResponse)
gtgtgt from kikmessages import TextMessage SuggestedResponseKeyboard TextResponsegtgtgt message = TextMessage()gtgtgt messagekeyboardsappend( SuggestedResponseKeyboard( to=aleem hidden=True responses=[TextResponse(OK)] ) )
Users
The User Profile API is accessed through KikApiget_userltkikKikApiget_user() which retrieves auserrsquos profile from their username
6 Chapter 1 User Guide
kik-python Documentation Release 150
The function returns a User containing the userrsquos profile
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt user = kikget_user(aleem)gtgtgt userfirst_nameJohnny
Kik Codes
The Kik Code creation API is accessed through KikApicreate_code This function takes an optional dataparameter which will be embedded in the Kik Code and returned in the ScanDataMessage you receive when theuser scans the code
create_code returns a Code which allows you to get a URL for the code
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt code = kikcreate_code(some data)gtgtgt codeurl()httpsapikikcomv1code161d764eeebf050fba373ae8cef9f5052524019a
11 User Guide 7
kik-python Documentation Release 150
8 Chapter 1 User Guide
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
ii
kik-python Documentation Release 150
Release v150
kik is a thin wrapper around the Kik API
Contents 1
kik-python Documentation Release 150
2 Contents
CHAPTER 1
User Guide
This part of the documentation provides a simple introduction to the library
User Guide
Ready to get started This page gives an overview of how to install and use kik
Installation
You can install the library though pip either from the command line
$ pip install kik
or add the following line to your projectrsquos requirementstxt file
kik==150
Example Bot
Here is a minimal echo bot using Flask
1 from flask import Flask request Response2
3 from kik import KikApi Configuration4 from kikmessages import messages_from_json TextMessage5
6 app = Flask(__name__)7 kik = KikApi(BOT_USERNAME BOT_API_KEY)8
9 kikset_configuration(Configuration(webhook=YOUR_WEBHOOK))10
3
kik-python Documentation Release 150
11 approute(incoming methods=[POST])12 def incoming()13 if not kikverify_signature(requestheadersget(X-Kik-Signature) requestget_
rarr˓data())14 return Response(status=403)15
16 messages = messages_from_json(requestjson[messages])17
18 for message in messages19 if isinstance(message TextMessage)20 kiksend_messages([21 TextMessage(22 to=messagefrom_user23 chat_id=messagechat_id24 body=messagebody25 )26 ])27
28 return Response(status=200)29
30
31 if __name__ == __main__32 apprun(port=8080 debug=True)
The API Client
The core of the library is the KikApi class which is used to send requests to the Kik API The client needs to beinstantiated with your botrsquos username and API key
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)
Configuration
The Configuration API can be accessed through two functions
KikApiget_configuration retrieves your bots current configuration as a Configuration object
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = kikget_configuration()gtgtgt configwebhookhttpsexamplecomincoming
KikApiset_configuration sets your botrsquos configuration taking a Configuration object
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
4 Chapter 1 User Guide
kik-python Documentation Release 150
Receiving Messages
The library contains two functions that are useful when receiving messages to your webhook
The first is KikApiverify_signature which is takes care of authenticating incoming requests to your web-hook
Just call the method with the provided signature header and the body of the incoming HTTP request
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikverify_signature(SIGNATURE_HEADER REQUEST_BODY)True
If this method returns False you should ignore the incoming request as it may be malicious
Note verify_signature must be called with the raw request body not the parsed JSON
The second important function for receiving messages is messagesmessages_from_json which convertsincoming messages into Python objects After you parse the incoming request as JSON simply pass the array ofmessages in the messages field to the function to get an array of message objects
gtgtgt from kikmessages import messages_from_jsongtgtgt messages_from_json(messages)[ltkikmessagesTextMessagegt ltkikmessagesLinkMessagegt]
For a complete list of message types you might receive see the Kik API Documentation
Sending Messages
Messages are sent using KikApisend_messages for the messaging API
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test ) ])
Similarly messages can be sent through the broadcasting API using KikApisend_broadcast
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test
11 User Guide 5
kik-python Documentation Release 150
)
])
Messages are constructed using the Message subclasses in kikmessages These classes directly mirror the APImessage formats with the exceptions of snake_case naming from being renamed to from_user (as from is a reservedkeyword in Python) and the handling of attribution and keyboards (explained below)
Attribution
All message types that support attribution are subclasses of AttributableMessage To give custom attributionto these messages simply assign their attribution property to a CustomAttribution instance
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution( name=A Name icon_url=httpfoobaranicon )
Additionally there are special attribution values to make a PictureMessage or VideoMessage appear tobe from the camera or gallery To achieve these effects assign the attribution property of the messagePresetAttributionsCAMERA or PresetAttributionsGALLERY
gtgtgt from kikmessages import PresetAttributionsgtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
Keyboards
All message types that support keyboards are subclasses of KeyboardMessage These messages contain akeyboards array holding any number of Keyboard instances
Currently the only supported keyboard types is SuggestedResponseKeyboard which must be assigned aresponses array containing instances of classes subclassing SuggestedResponse (eg TextResponsePictureResponse and FriendPickerResponse)
gtgtgt from kikmessages import TextMessage SuggestedResponseKeyboard TextResponsegtgtgt message = TextMessage()gtgtgt messagekeyboardsappend( SuggestedResponseKeyboard( to=aleem hidden=True responses=[TextResponse(OK)] ) )
Users
The User Profile API is accessed through KikApiget_userltkikKikApiget_user() which retrieves auserrsquos profile from their username
6 Chapter 1 User Guide
kik-python Documentation Release 150
The function returns a User containing the userrsquos profile
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt user = kikget_user(aleem)gtgtgt userfirst_nameJohnny
Kik Codes
The Kik Code creation API is accessed through KikApicreate_code This function takes an optional dataparameter which will be embedded in the Kik Code and returned in the ScanDataMessage you receive when theuser scans the code
create_code returns a Code which allows you to get a URL for the code
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt code = kikcreate_code(some data)gtgtgt codeurl()httpsapikikcomv1code161d764eeebf050fba373ae8cef9f5052524019a
11 User Guide 7
kik-python Documentation Release 150
8 Chapter 1 User Guide
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
Release v150
kik is a thin wrapper around the Kik API
Contents 1
kik-python Documentation Release 150
2 Contents
CHAPTER 1
User Guide
This part of the documentation provides a simple introduction to the library
User Guide
Ready to get started This page gives an overview of how to install and use kik
Installation
You can install the library though pip either from the command line
$ pip install kik
or add the following line to your projectrsquos requirementstxt file
kik==150
Example Bot
Here is a minimal echo bot using Flask
1 from flask import Flask request Response2
3 from kik import KikApi Configuration4 from kikmessages import messages_from_json TextMessage5
6 app = Flask(__name__)7 kik = KikApi(BOT_USERNAME BOT_API_KEY)8
9 kikset_configuration(Configuration(webhook=YOUR_WEBHOOK))10
3
kik-python Documentation Release 150
11 approute(incoming methods=[POST])12 def incoming()13 if not kikverify_signature(requestheadersget(X-Kik-Signature) requestget_
rarr˓data())14 return Response(status=403)15
16 messages = messages_from_json(requestjson[messages])17
18 for message in messages19 if isinstance(message TextMessage)20 kiksend_messages([21 TextMessage(22 to=messagefrom_user23 chat_id=messagechat_id24 body=messagebody25 )26 ])27
28 return Response(status=200)29
30
31 if __name__ == __main__32 apprun(port=8080 debug=True)
The API Client
The core of the library is the KikApi class which is used to send requests to the Kik API The client needs to beinstantiated with your botrsquos username and API key
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)
Configuration
The Configuration API can be accessed through two functions
KikApiget_configuration retrieves your bots current configuration as a Configuration object
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = kikget_configuration()gtgtgt configwebhookhttpsexamplecomincoming
KikApiset_configuration sets your botrsquos configuration taking a Configuration object
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
4 Chapter 1 User Guide
kik-python Documentation Release 150
Receiving Messages
The library contains two functions that are useful when receiving messages to your webhook
The first is KikApiverify_signature which is takes care of authenticating incoming requests to your web-hook
Just call the method with the provided signature header and the body of the incoming HTTP request
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikverify_signature(SIGNATURE_HEADER REQUEST_BODY)True
If this method returns False you should ignore the incoming request as it may be malicious
Note verify_signature must be called with the raw request body not the parsed JSON
The second important function for receiving messages is messagesmessages_from_json which convertsincoming messages into Python objects After you parse the incoming request as JSON simply pass the array ofmessages in the messages field to the function to get an array of message objects
gtgtgt from kikmessages import messages_from_jsongtgtgt messages_from_json(messages)[ltkikmessagesTextMessagegt ltkikmessagesLinkMessagegt]
For a complete list of message types you might receive see the Kik API Documentation
Sending Messages
Messages are sent using KikApisend_messages for the messaging API
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test ) ])
Similarly messages can be sent through the broadcasting API using KikApisend_broadcast
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test
11 User Guide 5
kik-python Documentation Release 150
)
])
Messages are constructed using the Message subclasses in kikmessages These classes directly mirror the APImessage formats with the exceptions of snake_case naming from being renamed to from_user (as from is a reservedkeyword in Python) and the handling of attribution and keyboards (explained below)
Attribution
All message types that support attribution are subclasses of AttributableMessage To give custom attributionto these messages simply assign their attribution property to a CustomAttribution instance
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution( name=A Name icon_url=httpfoobaranicon )
Additionally there are special attribution values to make a PictureMessage or VideoMessage appear tobe from the camera or gallery To achieve these effects assign the attribution property of the messagePresetAttributionsCAMERA or PresetAttributionsGALLERY
gtgtgt from kikmessages import PresetAttributionsgtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
Keyboards
All message types that support keyboards are subclasses of KeyboardMessage These messages contain akeyboards array holding any number of Keyboard instances
Currently the only supported keyboard types is SuggestedResponseKeyboard which must be assigned aresponses array containing instances of classes subclassing SuggestedResponse (eg TextResponsePictureResponse and FriendPickerResponse)
gtgtgt from kikmessages import TextMessage SuggestedResponseKeyboard TextResponsegtgtgt message = TextMessage()gtgtgt messagekeyboardsappend( SuggestedResponseKeyboard( to=aleem hidden=True responses=[TextResponse(OK)] ) )
Users
The User Profile API is accessed through KikApiget_userltkikKikApiget_user() which retrieves auserrsquos profile from their username
6 Chapter 1 User Guide
kik-python Documentation Release 150
The function returns a User containing the userrsquos profile
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt user = kikget_user(aleem)gtgtgt userfirst_nameJohnny
Kik Codes
The Kik Code creation API is accessed through KikApicreate_code This function takes an optional dataparameter which will be embedded in the Kik Code and returned in the ScanDataMessage you receive when theuser scans the code
create_code returns a Code which allows you to get a URL for the code
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt code = kikcreate_code(some data)gtgtgt codeurl()httpsapikikcomv1code161d764eeebf050fba373ae8cef9f5052524019a
11 User Guide 7
kik-python Documentation Release 150
8 Chapter 1 User Guide
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
2 Contents
CHAPTER 1
User Guide
This part of the documentation provides a simple introduction to the library
User Guide
Ready to get started This page gives an overview of how to install and use kik
Installation
You can install the library though pip either from the command line
$ pip install kik
or add the following line to your projectrsquos requirementstxt file
kik==150
Example Bot
Here is a minimal echo bot using Flask
1 from flask import Flask request Response2
3 from kik import KikApi Configuration4 from kikmessages import messages_from_json TextMessage5
6 app = Flask(__name__)7 kik = KikApi(BOT_USERNAME BOT_API_KEY)8
9 kikset_configuration(Configuration(webhook=YOUR_WEBHOOK))10
3
kik-python Documentation Release 150
11 approute(incoming methods=[POST])12 def incoming()13 if not kikverify_signature(requestheadersget(X-Kik-Signature) requestget_
rarr˓data())14 return Response(status=403)15
16 messages = messages_from_json(requestjson[messages])17
18 for message in messages19 if isinstance(message TextMessage)20 kiksend_messages([21 TextMessage(22 to=messagefrom_user23 chat_id=messagechat_id24 body=messagebody25 )26 ])27
28 return Response(status=200)29
30
31 if __name__ == __main__32 apprun(port=8080 debug=True)
The API Client
The core of the library is the KikApi class which is used to send requests to the Kik API The client needs to beinstantiated with your botrsquos username and API key
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)
Configuration
The Configuration API can be accessed through two functions
KikApiget_configuration retrieves your bots current configuration as a Configuration object
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = kikget_configuration()gtgtgt configwebhookhttpsexamplecomincoming
KikApiset_configuration sets your botrsquos configuration taking a Configuration object
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
4 Chapter 1 User Guide
kik-python Documentation Release 150
Receiving Messages
The library contains two functions that are useful when receiving messages to your webhook
The first is KikApiverify_signature which is takes care of authenticating incoming requests to your web-hook
Just call the method with the provided signature header and the body of the incoming HTTP request
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikverify_signature(SIGNATURE_HEADER REQUEST_BODY)True
If this method returns False you should ignore the incoming request as it may be malicious
Note verify_signature must be called with the raw request body not the parsed JSON
The second important function for receiving messages is messagesmessages_from_json which convertsincoming messages into Python objects After you parse the incoming request as JSON simply pass the array ofmessages in the messages field to the function to get an array of message objects
gtgtgt from kikmessages import messages_from_jsongtgtgt messages_from_json(messages)[ltkikmessagesTextMessagegt ltkikmessagesLinkMessagegt]
For a complete list of message types you might receive see the Kik API Documentation
Sending Messages
Messages are sent using KikApisend_messages for the messaging API
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test ) ])
Similarly messages can be sent through the broadcasting API using KikApisend_broadcast
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test
11 User Guide 5
kik-python Documentation Release 150
)
])
Messages are constructed using the Message subclasses in kikmessages These classes directly mirror the APImessage formats with the exceptions of snake_case naming from being renamed to from_user (as from is a reservedkeyword in Python) and the handling of attribution and keyboards (explained below)
Attribution
All message types that support attribution are subclasses of AttributableMessage To give custom attributionto these messages simply assign their attribution property to a CustomAttribution instance
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution( name=A Name icon_url=httpfoobaranicon )
Additionally there are special attribution values to make a PictureMessage or VideoMessage appear tobe from the camera or gallery To achieve these effects assign the attribution property of the messagePresetAttributionsCAMERA or PresetAttributionsGALLERY
gtgtgt from kikmessages import PresetAttributionsgtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
Keyboards
All message types that support keyboards are subclasses of KeyboardMessage These messages contain akeyboards array holding any number of Keyboard instances
Currently the only supported keyboard types is SuggestedResponseKeyboard which must be assigned aresponses array containing instances of classes subclassing SuggestedResponse (eg TextResponsePictureResponse and FriendPickerResponse)
gtgtgt from kikmessages import TextMessage SuggestedResponseKeyboard TextResponsegtgtgt message = TextMessage()gtgtgt messagekeyboardsappend( SuggestedResponseKeyboard( to=aleem hidden=True responses=[TextResponse(OK)] ) )
Users
The User Profile API is accessed through KikApiget_userltkikKikApiget_user() which retrieves auserrsquos profile from their username
6 Chapter 1 User Guide
kik-python Documentation Release 150
The function returns a User containing the userrsquos profile
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt user = kikget_user(aleem)gtgtgt userfirst_nameJohnny
Kik Codes
The Kik Code creation API is accessed through KikApicreate_code This function takes an optional dataparameter which will be embedded in the Kik Code and returned in the ScanDataMessage you receive when theuser scans the code
create_code returns a Code which allows you to get a URL for the code
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt code = kikcreate_code(some data)gtgtgt codeurl()httpsapikikcomv1code161d764eeebf050fba373ae8cef9f5052524019a
11 User Guide 7
kik-python Documentation Release 150
8 Chapter 1 User Guide
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
CHAPTER 1
User Guide
This part of the documentation provides a simple introduction to the library
User Guide
Ready to get started This page gives an overview of how to install and use kik
Installation
You can install the library though pip either from the command line
$ pip install kik
or add the following line to your projectrsquos requirementstxt file
kik==150
Example Bot
Here is a minimal echo bot using Flask
1 from flask import Flask request Response2
3 from kik import KikApi Configuration4 from kikmessages import messages_from_json TextMessage5
6 app = Flask(__name__)7 kik = KikApi(BOT_USERNAME BOT_API_KEY)8
9 kikset_configuration(Configuration(webhook=YOUR_WEBHOOK))10
3
kik-python Documentation Release 150
11 approute(incoming methods=[POST])12 def incoming()13 if not kikverify_signature(requestheadersget(X-Kik-Signature) requestget_
rarr˓data())14 return Response(status=403)15
16 messages = messages_from_json(requestjson[messages])17
18 for message in messages19 if isinstance(message TextMessage)20 kiksend_messages([21 TextMessage(22 to=messagefrom_user23 chat_id=messagechat_id24 body=messagebody25 )26 ])27
28 return Response(status=200)29
30
31 if __name__ == __main__32 apprun(port=8080 debug=True)
The API Client
The core of the library is the KikApi class which is used to send requests to the Kik API The client needs to beinstantiated with your botrsquos username and API key
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)
Configuration
The Configuration API can be accessed through two functions
KikApiget_configuration retrieves your bots current configuration as a Configuration object
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = kikget_configuration()gtgtgt configwebhookhttpsexamplecomincoming
KikApiset_configuration sets your botrsquos configuration taking a Configuration object
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
4 Chapter 1 User Guide
kik-python Documentation Release 150
Receiving Messages
The library contains two functions that are useful when receiving messages to your webhook
The first is KikApiverify_signature which is takes care of authenticating incoming requests to your web-hook
Just call the method with the provided signature header and the body of the incoming HTTP request
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikverify_signature(SIGNATURE_HEADER REQUEST_BODY)True
If this method returns False you should ignore the incoming request as it may be malicious
Note verify_signature must be called with the raw request body not the parsed JSON
The second important function for receiving messages is messagesmessages_from_json which convertsincoming messages into Python objects After you parse the incoming request as JSON simply pass the array ofmessages in the messages field to the function to get an array of message objects
gtgtgt from kikmessages import messages_from_jsongtgtgt messages_from_json(messages)[ltkikmessagesTextMessagegt ltkikmessagesLinkMessagegt]
For a complete list of message types you might receive see the Kik API Documentation
Sending Messages
Messages are sent using KikApisend_messages for the messaging API
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test ) ])
Similarly messages can be sent through the broadcasting API using KikApisend_broadcast
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test
11 User Guide 5
kik-python Documentation Release 150
)
])
Messages are constructed using the Message subclasses in kikmessages These classes directly mirror the APImessage formats with the exceptions of snake_case naming from being renamed to from_user (as from is a reservedkeyword in Python) and the handling of attribution and keyboards (explained below)
Attribution
All message types that support attribution are subclasses of AttributableMessage To give custom attributionto these messages simply assign their attribution property to a CustomAttribution instance
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution( name=A Name icon_url=httpfoobaranicon )
Additionally there are special attribution values to make a PictureMessage or VideoMessage appear tobe from the camera or gallery To achieve these effects assign the attribution property of the messagePresetAttributionsCAMERA or PresetAttributionsGALLERY
gtgtgt from kikmessages import PresetAttributionsgtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
Keyboards
All message types that support keyboards are subclasses of KeyboardMessage These messages contain akeyboards array holding any number of Keyboard instances
Currently the only supported keyboard types is SuggestedResponseKeyboard which must be assigned aresponses array containing instances of classes subclassing SuggestedResponse (eg TextResponsePictureResponse and FriendPickerResponse)
gtgtgt from kikmessages import TextMessage SuggestedResponseKeyboard TextResponsegtgtgt message = TextMessage()gtgtgt messagekeyboardsappend( SuggestedResponseKeyboard( to=aleem hidden=True responses=[TextResponse(OK)] ) )
Users
The User Profile API is accessed through KikApiget_userltkikKikApiget_user() which retrieves auserrsquos profile from their username
6 Chapter 1 User Guide
kik-python Documentation Release 150
The function returns a User containing the userrsquos profile
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt user = kikget_user(aleem)gtgtgt userfirst_nameJohnny
Kik Codes
The Kik Code creation API is accessed through KikApicreate_code This function takes an optional dataparameter which will be embedded in the Kik Code and returned in the ScanDataMessage you receive when theuser scans the code
create_code returns a Code which allows you to get a URL for the code
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt code = kikcreate_code(some data)gtgtgt codeurl()httpsapikikcomv1code161d764eeebf050fba373ae8cef9f5052524019a
11 User Guide 7
kik-python Documentation Release 150
8 Chapter 1 User Guide
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
11 approute(incoming methods=[POST])12 def incoming()13 if not kikverify_signature(requestheadersget(X-Kik-Signature) requestget_
rarr˓data())14 return Response(status=403)15
16 messages = messages_from_json(requestjson[messages])17
18 for message in messages19 if isinstance(message TextMessage)20 kiksend_messages([21 TextMessage(22 to=messagefrom_user23 chat_id=messagechat_id24 body=messagebody25 )26 ])27
28 return Response(status=200)29
30
31 if __name__ == __main__32 apprun(port=8080 debug=True)
The API Client
The core of the library is the KikApi class which is used to send requests to the Kik API The client needs to beinstantiated with your botrsquos username and API key
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)
Configuration
The Configuration API can be accessed through two functions
KikApiget_configuration retrieves your bots current configuration as a Configuration object
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = kikget_configuration()gtgtgt configwebhookhttpsexamplecomincoming
KikApiset_configuration sets your botrsquos configuration taking a Configuration object
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
4 Chapter 1 User Guide
kik-python Documentation Release 150
Receiving Messages
The library contains two functions that are useful when receiving messages to your webhook
The first is KikApiverify_signature which is takes care of authenticating incoming requests to your web-hook
Just call the method with the provided signature header and the body of the incoming HTTP request
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikverify_signature(SIGNATURE_HEADER REQUEST_BODY)True
If this method returns False you should ignore the incoming request as it may be malicious
Note verify_signature must be called with the raw request body not the parsed JSON
The second important function for receiving messages is messagesmessages_from_json which convertsincoming messages into Python objects After you parse the incoming request as JSON simply pass the array ofmessages in the messages field to the function to get an array of message objects
gtgtgt from kikmessages import messages_from_jsongtgtgt messages_from_json(messages)[ltkikmessagesTextMessagegt ltkikmessagesLinkMessagegt]
For a complete list of message types you might receive see the Kik API Documentation
Sending Messages
Messages are sent using KikApisend_messages for the messaging API
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test ) ])
Similarly messages can be sent through the broadcasting API using KikApisend_broadcast
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test
11 User Guide 5
kik-python Documentation Release 150
)
])
Messages are constructed using the Message subclasses in kikmessages These classes directly mirror the APImessage formats with the exceptions of snake_case naming from being renamed to from_user (as from is a reservedkeyword in Python) and the handling of attribution and keyboards (explained below)
Attribution
All message types that support attribution are subclasses of AttributableMessage To give custom attributionto these messages simply assign their attribution property to a CustomAttribution instance
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution( name=A Name icon_url=httpfoobaranicon )
Additionally there are special attribution values to make a PictureMessage or VideoMessage appear tobe from the camera or gallery To achieve these effects assign the attribution property of the messagePresetAttributionsCAMERA or PresetAttributionsGALLERY
gtgtgt from kikmessages import PresetAttributionsgtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
Keyboards
All message types that support keyboards are subclasses of KeyboardMessage These messages contain akeyboards array holding any number of Keyboard instances
Currently the only supported keyboard types is SuggestedResponseKeyboard which must be assigned aresponses array containing instances of classes subclassing SuggestedResponse (eg TextResponsePictureResponse and FriendPickerResponse)
gtgtgt from kikmessages import TextMessage SuggestedResponseKeyboard TextResponsegtgtgt message = TextMessage()gtgtgt messagekeyboardsappend( SuggestedResponseKeyboard( to=aleem hidden=True responses=[TextResponse(OK)] ) )
Users
The User Profile API is accessed through KikApiget_userltkikKikApiget_user() which retrieves auserrsquos profile from their username
6 Chapter 1 User Guide
kik-python Documentation Release 150
The function returns a User containing the userrsquos profile
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt user = kikget_user(aleem)gtgtgt userfirst_nameJohnny
Kik Codes
The Kik Code creation API is accessed through KikApicreate_code This function takes an optional dataparameter which will be embedded in the Kik Code and returned in the ScanDataMessage you receive when theuser scans the code
create_code returns a Code which allows you to get a URL for the code
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt code = kikcreate_code(some data)gtgtgt codeurl()httpsapikikcomv1code161d764eeebf050fba373ae8cef9f5052524019a
11 User Guide 7
kik-python Documentation Release 150
8 Chapter 1 User Guide
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
Receiving Messages
The library contains two functions that are useful when receiving messages to your webhook
The first is KikApiverify_signature which is takes care of authenticating incoming requests to your web-hook
Just call the method with the provided signature header and the body of the incoming HTTP request
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikverify_signature(SIGNATURE_HEADER REQUEST_BODY)True
If this method returns False you should ignore the incoming request as it may be malicious
Note verify_signature must be called with the raw request body not the parsed JSON
The second important function for receiving messages is messagesmessages_from_json which convertsincoming messages into Python objects After you parse the incoming request as JSON simply pass the array ofmessages in the messages field to the function to get an array of message objects
gtgtgt from kikmessages import messages_from_jsongtgtgt messages_from_json(messages)[ltkikmessagesTextMessagegt ltkikmessagesLinkMessagegt]
For a complete list of message types you might receive see the Kik API Documentation
Sending Messages
Messages are sent using KikApisend_messages for the messaging API
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test ) ])
Similarly messages can be sent through the broadcasting API using KikApisend_broadcast
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([ TextMessage( to=aleem chat_id=8c595a879e4140dbecb60f6c6933348bfd940cd9cbd6014e8fa51f24b5c8f74ararr˓ body=Test
11 User Guide 5
kik-python Documentation Release 150
)
])
Messages are constructed using the Message subclasses in kikmessages These classes directly mirror the APImessage formats with the exceptions of snake_case naming from being renamed to from_user (as from is a reservedkeyword in Python) and the handling of attribution and keyboards (explained below)
Attribution
All message types that support attribution are subclasses of AttributableMessage To give custom attributionto these messages simply assign their attribution property to a CustomAttribution instance
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution( name=A Name icon_url=httpfoobaranicon )
Additionally there are special attribution values to make a PictureMessage or VideoMessage appear tobe from the camera or gallery To achieve these effects assign the attribution property of the messagePresetAttributionsCAMERA or PresetAttributionsGALLERY
gtgtgt from kikmessages import PresetAttributionsgtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
Keyboards
All message types that support keyboards are subclasses of KeyboardMessage These messages contain akeyboards array holding any number of Keyboard instances
Currently the only supported keyboard types is SuggestedResponseKeyboard which must be assigned aresponses array containing instances of classes subclassing SuggestedResponse (eg TextResponsePictureResponse and FriendPickerResponse)
gtgtgt from kikmessages import TextMessage SuggestedResponseKeyboard TextResponsegtgtgt message = TextMessage()gtgtgt messagekeyboardsappend( SuggestedResponseKeyboard( to=aleem hidden=True responses=[TextResponse(OK)] ) )
Users
The User Profile API is accessed through KikApiget_userltkikKikApiget_user() which retrieves auserrsquos profile from their username
6 Chapter 1 User Guide
kik-python Documentation Release 150
The function returns a User containing the userrsquos profile
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt user = kikget_user(aleem)gtgtgt userfirst_nameJohnny
Kik Codes
The Kik Code creation API is accessed through KikApicreate_code This function takes an optional dataparameter which will be embedded in the Kik Code and returned in the ScanDataMessage you receive when theuser scans the code
create_code returns a Code which allows you to get a URL for the code
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt code = kikcreate_code(some data)gtgtgt codeurl()httpsapikikcomv1code161d764eeebf050fba373ae8cef9f5052524019a
11 User Guide 7
kik-python Documentation Release 150
8 Chapter 1 User Guide
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
)
])
Messages are constructed using the Message subclasses in kikmessages These classes directly mirror the APImessage formats with the exceptions of snake_case naming from being renamed to from_user (as from is a reservedkeyword in Python) and the handling of attribution and keyboards (explained below)
Attribution
All message types that support attribution are subclasses of AttributableMessage To give custom attributionto these messages simply assign their attribution property to a CustomAttribution instance
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution( name=A Name icon_url=httpfoobaranicon )
Additionally there are special attribution values to make a PictureMessage or VideoMessage appear tobe from the camera or gallery To achieve these effects assign the attribution property of the messagePresetAttributionsCAMERA or PresetAttributionsGALLERY
gtgtgt from kikmessages import PresetAttributionsgtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
Keyboards
All message types that support keyboards are subclasses of KeyboardMessage These messages contain akeyboards array holding any number of Keyboard instances
Currently the only supported keyboard types is SuggestedResponseKeyboard which must be assigned aresponses array containing instances of classes subclassing SuggestedResponse (eg TextResponsePictureResponse and FriendPickerResponse)
gtgtgt from kikmessages import TextMessage SuggestedResponseKeyboard TextResponsegtgtgt message = TextMessage()gtgtgt messagekeyboardsappend( SuggestedResponseKeyboard( to=aleem hidden=True responses=[TextResponse(OK)] ) )
Users
The User Profile API is accessed through KikApiget_userltkikKikApiget_user() which retrieves auserrsquos profile from their username
6 Chapter 1 User Guide
kik-python Documentation Release 150
The function returns a User containing the userrsquos profile
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt user = kikget_user(aleem)gtgtgt userfirst_nameJohnny
Kik Codes
The Kik Code creation API is accessed through KikApicreate_code This function takes an optional dataparameter which will be embedded in the Kik Code and returned in the ScanDataMessage you receive when theuser scans the code
create_code returns a Code which allows you to get a URL for the code
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt code = kikcreate_code(some data)gtgtgt codeurl()httpsapikikcomv1code161d764eeebf050fba373ae8cef9f5052524019a
11 User Guide 7
kik-python Documentation Release 150
8 Chapter 1 User Guide
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
The function returns a User containing the userrsquos profile
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt user = kikget_user(aleem)gtgtgt userfirst_nameJohnny
Kik Codes
The Kik Code creation API is accessed through KikApicreate_code This function takes an optional dataparameter which will be embedded in the Kik Code and returned in the ScanDataMessage you receive when theuser scans the code
create_code returns a Code which allows you to get a URL for the code
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt code = kikcreate_code(some data)gtgtgt codeurl()httpsapikikcomv1code161d764eeebf050fba373ae8cef9f5052524019a
11 User Guide 7
kik-python Documentation Release 150
8 Chapter 1 User Guide
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
8 Chapter 1 User Guide
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
CHAPTER 2
API Documentation
Complete documentation for specific classes and methods
API Documentation
API Client
Client for interacting with the Kik API
class kikKikApi(bot api_key)Generic API Client for all Kik API features
Parameters
bull bot (str) ndash Your botrsquos username
bull api_key (str) ndash Your botrsquos API key
create_code(data=None)Creates a Kik Code for your bot
Parameters data (dict str) ndash (optional) Data to embed in the code which will be re-turned in a scan-data message when the code is scanned
Returns A Code representing the code
Return type kikCode
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikcreate_code(data=somedata)ltkikCodegt
9
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
get_configuration()Retrieves your botrsquos configuration
Returns A Configuration representing the configuration data
Return type kikConfiguration
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_configuration()ltkikConfigurationgt
get_user(username)Gets a userrsquos profile data
Parameters username (str) ndash List of Message to be sent
Returns A User containing the userrsquos profile data
Return type kikUser
Note In order to fetch a userrsquos profile the user must be a subscriber to your bot
Usage
gtgtgt from kik import KikApigtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kikget_user(aleem)ltkikUsergt
send_broadcast(messages)Sends a batch of messages though the broadcast API
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingbroadcasting
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_broadcast([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
10 Chapter 2 API Documentation
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
send_messages(messages)Sends a batch of messages
Parameters messages (list[kikmessagesMessage]) ndash List of Message to besent
Returns A dict containing the response from the API
Return type dict
Note Subject to limits on the number of messages sent documented at httpsdevkikcomdocsmessagingsending-messages
Usage
gtgtgt from kik import KikApigtgtgt from kikmessages import TextMessagegtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt kiksend_messages([gtgtgt TextMessage(gtgtgt to=ausernamegtgtgt chat_id=rarr˓2e566cf66b07d9622053b2f0e44dd14926d89a6d61adf496844781876d62cca6gtgtgt body=Some Textgtgtgt )gtgtgt ])
set_configuration(config)Sets your botrsquos configuration
Parameters config (kikConfiguration) ndash A Configuration containing your botrsquosnew configuration
Returns A Configuration containing your botrsquos new configuration as confirmed by
the server rtype kikConfiguration
Usage
gtgtgt from kik import KikApi Configurationgtgtgt kik = KikApi(BOT_USERNAME BOT_API_KEY)gtgtgt config = Configuration(webhook=httpsexamplecomincoming)gtgtgt kikset_configuration(config)ltkikConfigurationgt
verify_signature(signature body)Verifies that a request body correctly matches the header signature For more on signatures see httpsdevkikcomdocsmessagingreceiving-messages
In Python 3 body must be a bytestring
User Model
Model for working with user profiles
21 API Documentation 11
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
class kikUser(first_name last_name profile_pic_url=None profile_pic_last_modified=None time-zone=None kwargs)
Model representing a Kik userrsquos profie information Created using kikKikApiget_user()
Variables
bull first_name (str) ndash The userrsquos first name
bull last_name (str) ndash The userrsquos last name
bull profile_pic_url (str) ndash URL for the usersrsquos profile picture
bull profile_pic_last_modified ndash Timestamp indicating when the userrsquos profile pic-ture was last modified to allow for caching
bull timezone ndash String indicating the timezone of the user (ex AmericaToronto)
Vartype profile_last_modified int
Vartype timezone str
Code Model
Model for working with Kik Codes
class kikCode(id kwargs)Model representing a Kik Code Can be instantiated with a Kik Code ID or created using kikKikApicreate_code()
Variables id (str) ndash The ID for the Kik Code
class ColorsKik Code color mapping taken from httpsdevkikcomdocsmessagingkik-code-colors
Codeurl(color=None)Returns the URL for the Kik Code
Parameters color (int) ndash (optional) Sets the color of the Kik Code For options see kikCodeColors
Configuration Model
Model for working with your botrsquos configuration
class kikConfiguration(webhook features=None static_keyboard=None)Model for your botrsquos configuration
Parameters
bull webhook (str) ndash URL the API will send incoming messages to
bull features (dict) ndash Feature flags to set
bull static_keyboard (kikmessageskeyboardsKeyboard) ndash The static key-board to set
Messages
These classes directly mirror the message types used by the API
12 Chapter 2 API Documentation
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
class kikmessagesMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None metadata=None)
Parent class for all messages
class kikmessagesTextMessage(to=None chat_id=None body=None keyboards=None men-tion=None delay=None type_time=None kwargs)
A full link message object as documented at httpsdevkikcomdocsmessagingtext
class kikmessagesLinkMessage(to=None chat_id=None url=None title=None text=Nonepic_url=None no_forward=None kik_js_data=None key-boards=None attribution=None mention=None delay=Nonekwargs)
A full link message object as documented at httpsdevkikcomdocsmessaginglink
class kikmessagesPictureMessage(to=None chat_id=None pic_url=None keyboards=None at-tribution=None mention=None delay=None kwargs)
A full picture message object as documented at httpsdevkikcomdocsmessagingpicture
class kikmessagesVideoMessage(to=None chat_id=None video_url=None loop=Nonemuted=None autoplay=None no_save=None keyboards=Noneattribution=None mention=None delay=None kwargs)
A full video message object as documented at httpsdevkikcomdocsmessagingvideo
class kikmessagesStartChattingMessage(chat_type=None kwargs)A full start-chatting message object as documented at httpsdevkikcomdocsmessagingstart-chatting
class kikmessagesScanDataMessage(data=None chat_type=None kwargs)A full scan-data message object as documented at httpsdevkikcomdocsmessagingscan-data
class kikmessagesStickerMessage(sticker_pack_id=None sticker_url=None chat_type=Nonekwargs)
A full sticker message object as documented at httpsdevkikcomdocsmessagingsticker
class kikmessagesIsTypingMessage(is_typing=None chat_type=None kwargs)A full is-typing message object as documented at httpsdevkikcomdocsmessagingis-typing
class kikmessagesReceiptMessage(message_ids=None kwargs)Parent class for all receipts
class kikmessagesDeliveryReceiptMessage(kwargs)A full delivery-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesReadReceiptMessage(kwargs)A full read-receipt message object as documented at httpsdevkikcomdocsmessagingreceipts
class kikmessagesFriendPickerMessage(picked=None chat_type=None kwargs)A friend picker message as documented at httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesUnknownMessage(type to=None id=None chat_id=None mention=Noneparticipants=None from_user=None delay=Noneread_receipt_requested=None timestamp=None meta-data=None)
This message type is returned by the message factory when it encounters an unknown message type
Itrsquos type attribute is set to the type of the message and itrsquos raw_message attribute contains the raw JSON messagereceived
21 API Documentation 13
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
Message Utilities
kikmessagesmessages_from_json(messages)Converts incoming JSON format messages into message objects
Parameters messages (list[dict]) ndash A list of messages in JSON format
Returns A list of messages as Python classes
Return type list[kikmessagesMessage]
Attribution
class kikmessagesattributionAttributionParent class for all attribution types
class kikmessagesCustomAttribution(name=None icon_url=None)Bases kikmessagesattributionAttribution
Attribution class for custom attributions as documented at httpsdevkikcomdocsmessagingattribution
Usage
gtgtgt from kikmessages import CustomAttribution LinkMessagegtgtgt message = LinkMessage()gtgtgt messageattribution = CustomAttribution(gtgtgt name=A Namegtgtgt icon_url=httpfoobaranicongtgtgt )
class kikmessagesattributionPresetAttribution(preset_name)Bases kikmessagesattributionAttribution
Attribution class for the preset attribution types (eg ldquogalleryrdquo or ldquocamerardquo)
class kikmessagesattributionPresetAttributionsList of preset attribution types
Valid only on PictureMessage and VideoMessage
Variables
bull GALLERY (kikmessageattributionPresetAttribution) ndash Makes themessage appear to be from a userrsquos gallery
bull CAMERA (kikmessageattributionPresetAttribution) ndash Makes the mes-sage appear to be from a camera
Usage
gtgtgt from kikmessages import PresetAttributions PictureMessagegtgtgt message = PictureMessage()gtgtgt messageattribution = PresetAttributionsCAMERA
class kikmessagesattributable_messageAttributableMessage(attribution=Nonekwargs)
Parent class for messages that support attribution
14 Chapter 2 API Documentation
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
Keyboards and Responses
class kikmessageskeyboardsKeyboard(type to=None hidden=None)Parent class for all keyboards
class kikmessagesSuggestedResponseKeyboard(to=None hidden=None responses=None)Bases kikmessageskeyboardsKeyboard
A suggested response keyboard as documented at httpsdevkikcomdocsmessagingkeyboards
Parameters
bull to (str) ndash (optional) User who will see this keyboard If None the keyboard will be shownto all users who donrsquot have another keyboard set
bull hidden (bool) ndash (optional) If True this keyboard will be hidden until the user chooses tosee suggested responses
bull responses (list[kikmessageresponsesSuggestedResponse]) ndash (op-tional) A list of SuggestedResponse Defaults to an empty list
class kikmessagesresponsesSuggestedResponse(type metadata=None)Base class for all responses for SuggestedResponseKeyboard
class kikmessagesTextResponse(body)Bases kikmessagesresponsesSuggestedResponse
A text response as documented at httpsdevkikcomdocsmessagingsuggested-response-keyboard
class kikmessagesFriendPickerResponse(body=None min=None max=None prese-lected=None)
Bases kikmessagesresponsesSuggestedResponse
A friend picker response as documented on httpsdevkikcomdocsmessagingfriend-picker-response-object
class kikmessagesPictureResponse(pic_url metadata)Bases kikmessagesresponsesSuggestedResponse
A picture response as documented on httpsdevkikcomdocsmessagingpicture-response-object
class kikmessageskeyboard_messageKeyboardMessage(keyboards=None chat_type=Nonekwargs)
Parent class for messages that support keyboards
Exceptions
exception kikKikError(message status_code content=None)Exception raised by all API errors The exception message is set to the serverrsquos response
Parameters
bull status_code (int) ndash Status code returned by the API call
bull content (string) ndash Content returned by the API call
21 API Documentation 15
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
16 Chapter 2 API Documentation
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
CHAPTER 3
Indices and tables
bull genindex
17
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
kik-python Documentation Release 150
18 Chapter 3 Indices and tables
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-
Index
AAttributableMessage (class in
kikmessagesattributable_message) 14Attribution (class in kikmessagesattribution) 14
CCode (class in kik) 12CodeColors (class in kik) 12Configuration (class in kik) 12create_code() (kikKikApi method) 9CustomAttribution (class in kikmessages) 14
DDeliveryReceiptMessage (class in kikmessages) 13
FFriendPickerMessage (class in kikmessages) 13FriendPickerResponse (class in kikmessages) 15
Gget_configuration() (kikKikApi method) 9get_user() (kikKikApi method) 10
IIsTypingMessage (class in kikmessages) 13
KKeyboard (class in kikmessageskeyboards) 15KeyboardMessage (class in
kikmessageskeyboard_message) 15KikApi (class in kik) 9KikError 15
LLinkMessage (class in kikmessages) 13
MMessage (class in kikmessages) 12
messages_from_json() (in module kikmessages) 14
PPictureMessage (class in kikmessages) 13PictureResponse (class in kikmessages) 15PresetAttribution (class in kikmessagesattribution) 14PresetAttributions (class in kikmessagesattribution) 14
RReadReceiptMessage (class in kikmessages) 13ReceiptMessage (class in kikmessages) 13
SScanDataMessage (class in kikmessages) 13send_broadcast() (kikKikApi method) 10send_messages() (kikKikApi method) 11set_configuration() (kikKikApi method) 11StartChattingMessage (class in kikmessages) 13StickerMessage (class in kikmessages) 13SuggestedResponse (class in kikmessagesresponses) 15SuggestedResponseKeyboard (class in kikmessages) 15
TTextMessage (class in kikmessages) 13TextResponse (class in kikmessages) 15
UUnknownMessage (class in kikmessages) 13url() (kikCode method) 12User (class in kik) 11
Vverify_signature() (kikKikApi method) 11VideoMessage (class in kikmessages) 13
19
- User Guide
-
- User Guide
-
- API Documentation
-
- API Documentation
-
- Indices and tables
-