Build channel¶
-
class
chatfirst.client.
Chatfirst
(token)¶ The Chatfirst class is a wrapper of Chatfirst API This class provides easy access to bots, push, talk, broadcast methods
Parameters: token (str) – user’s token from Chatfirst dashboard -
bots_get
(bot)¶ Fetch and fill Bot object
Parameters: bot (Bot) – empty bot object with name to search Return type: Bot Returns: filled bot object
-
bots_list
()¶ List all user’s bots
Return type: list of Bot Returns: user’s bots
-
talk
(bot, message)¶ Talk to bot and get response based You can use this method to integrate the platform with your own channels
Parameters: Return type: Returns: response object
-
-
class
chatfirst.models.
Bot
(data={})¶ Main class defining Bot entity
Parameters: data (dict) – serialized object -
fancy_name
= None¶ data[“fancy_name”], long name of bot
-
language
= None¶ data[“language”], 0 - Russian, 1 - English
-
name
= None¶ data[“name”], short name of bot
-
scenario
= None¶ data[“scenario”], scenario of bot
-
to_json
()¶ Serialize object to json dict
Returns: dict
-
-
class
chatfirst.models.
Message
(data={})¶ Use this class if you want to integrate your own channel and use talk method. Chatfirst platform accepts incomming talk requests with special json object:
Parameters: data (dict) – serialized object -
first_name
= None¶ data[“FirstName”], first name of talking user
-
id_
= None¶ data[“InterlocutorId”], internal id of talking user
-
last_name
= None¶ data[“LastName”], last name of talking user
-
text
= None¶ data[“Text”], text message that user sent
-
to_json
()¶ Serialize object to json dict
Returns: dict
-
username
= None¶ data[“Username”], username of talking user
-