Universal
This section describes how to integrate a Universal channel with Botanalytics.
This section is designed for the the latest version of Botanalytics, which is currently on private beta.
If you would like to join the beta and use the latest version of Botanalytics, follow the instructions.
Please check available channels before adding a universal channel, If the channel you're about to add is available please use native channel and integration.
Integration
Integrating Botanalytics into your in-app bot, web bot, SMS bot, voice application, or other conversational interface, is quick and easy.
Include Botanalytics
from botanalytics.universal import Universal
Create the client
client = Universal(api_key=BOTANALYTICS_API_KEY)
Configuration options
Option | Required | Default | Description | Environment Variable |
---|---|---|---|---|
api_key | Yes | Has no default | API key that is provided when a Universal channel is added to a project. | BA_API_KEY |
debug | No | False | Enables logging. Set this to true or True to enable. | BA_DEBUG |
base_url | No | https://api.beta.botanalytics.co/v2 | Base URL to be used for sending requests. Do not change this unless instructed by the Botanalytics team. | BA_BASE_URL |
is_async | No | False | Whether client should use async workers. Set this to true or True to enable. | BA_IS_ASYNC |
thread_workers | No | cpu count * 2 | The number of thread workers for the async client | BA_THREAD_WORKERS |
Additional environment variables/options
Name | Required | Default | Description | Environment Variable |
---|---|---|---|---|
Could only be set via environment variable. | No | INFO | Log level for the logger. Could be set one of following options TRACE , DEBUG , INFO , SUCCESS , WARNING , ERROR , CRITICAL . | BA_LOG_LEVEL |
request_retry_limit | No | 10 | Request retry limit for the client | BA_REQUEST_RETRY_LIMIT |
request_timeout | No | 30000 | Request timeout for the client | BA_REQUEST_TIMEOUT |
Log single message with Botanalytics client
Message is structured json object. Please see RESTful api for message object.
client.log_message(message)
Log messages with Botanalytics client
Messages is array of structured message json object. Please see RESTful api for message object.
client.log_messages(messages)