Bot config¶
Main configuration¶
The configuration of the bot can be specified in several ways.
Config¶
Create a Config instance:
from signalbot import SignalBot, Config
config = Config(phone_number="+1234567890")
bot = SignalBot(config)
bot.start()
Dictionary¶
Create a python dictionary:
from signalbot import SignalBot, Config
config = {"phone_number": "+1234567890"}
bot = SignalBot(config)
bot.start()
Yaml file¶
Create a YAML configuration file:
Then load it:
Json file¶
Create a JSON configuration file:
Then load it:
Storage type options¶
There are also several storage backends that can be used to handle data persistance.
In-memory¶
Stores data in memory only. Data is lost when the bot restarts. Useful for development and testing.
SQLite¶
Persists data to a local SQLite database. See the SQLiteStorage API reference for details.
Redis¶
Persists data to Redis database. See the RedisStorage API reference for details.
Authentication¶
Enables usage of an auth-enabled signal-cli-rest-api instance (behind a proxy).
User and password¶
Username and password based authentication using the BasicAuthConfig class.
from signalbot import BasicAuthConfig, Config, SignalBot
config = Config(
phone_number="+1234567890",
auth=BasicAuthConfig(username="user", password="password"),
)
bot = SignalBot(config)
bot.start()
Token¶
Token based authentication using the BearerAuthConfig class.