Skip to main content

Camino Messenger Bot Configuration

DRAFT DOCUMENTATION NOTICE

Please be aware that this document is currently a draft and is undergoing active development. Content, guidelines, and instructions may be subject to change.

🚧 ALPHA CODE NOTICE 🚧

This application is in the alpha phase of development. It is important to note that during this stage, breaking changes may occur without advance notice. Users should proceed with caution.

Copy the Example Configuration File

After you've installed Camino Messenger Bot (CMB), copy the example configuration files from https://github.com/chain4travel/camino-messenger-bot

Supplier Example:

./examples/config/camino-messenger-bot-supplier-columbus.yaml
./examples/config/camino-messenger-bot-supplier-camino.yaml

Distributor Example:

./examples/config/camino-messenger-bot-distributor-columbus.yaml
./examples/config/camino-messenger-bot-distributor-camino.yaml

Example Supplier Bot Config File:

# The documentation example is made for development purposes - for production see docker-compose.yml

### General

# Lower level logging for local development
developer_mode: true

# Timeout in milliseconds to wait for responses to message sent via Matrix
response_timeout: 10000

# Booking Token contract address. This address will be used for minting, buying of Booking Tokens
booking_token_address: 0xe2b8c92B6519d1A2020dA0A5fBbA99a43A2c0922

# C-Chain RPC URL
chain_rpc_url: wss://api.camino.network/ext/bc/C/ws

### Bot identity

# Private key of the bot in hex format without the 0x prefix.
# Used for signing transactions on the c-chain, also used to log in into Matrix. This
# address needs to have some funds to pay for transaction fees on the C-Chain.
bot_key: YOUR_PRIVATE_KEY_HEX

# Address of the CM Account that the bot belongs to
cm_account_address: 0xYOUR_CM_ACCOUNT_ADDRESS

### Cheque handling

cheque_expiration_time: 18144000 # 7 months

min_cheque_duration_until_expiration: 15552000 # 6 months

cash_in_period: 86400 # 1 day

# matrix application service bot address
network_fee_recipient_bot_address: 0xbeb027D2f439805E17EAA16Da26c1FCa68a30232

# matrix application service cm account address
network_fee_recipient_cm_account: 0x16DFfB3911BB0b1B53eF4d774804381f0B38B5d7

### Database
db:
# Path to migrations dir with sql up/down scripts. Schema is mandatory.
migrations_path: file://./migrations

# Path to database file.
path: supplier-bot.db

### Matrix
matrix:
# Hostname of the Matrix server
host: messenger.chain4travel.com

### Partner Plugin
partner_plugin:
# Partner Plugin hostname and port, should be reachable from this machine.
# Bot tries to connect to this host and port to relay messages that it receives from
# the distributors through Matrix Server
host: localhost:50051

# TLS configuration
unencrypted: true

# Required if partner_plugin_unencrypted is false
ca_file: ca-cert.pem

### RPC server
rpc_server:
# Listen on this port for incoming RPC requests
port: 9090

# TLS configuration
unencrypted: true

cert_file: server-cert.pem
key_file: server-key.pem
### Tracing
# tracing:
# cert_file: server-cert.pem
# enabled: true
# host: localhost:4317
# insecure: true
# key_file: server-key.pem

Example Distributor Bot Config File:

# This example is made for development purposes - for production see docker-compose.yml

### General

# Lower level logging for local development
developer_mode: true

# Timeout in milliseconds to wait for responses to message sent via Matrix
response_timeout: 10000

# Booking Token contract address. This address will be used for minting, buying of Booking Tokens
booking_token_address: 0xe2b8c92B6519d1A2020dA0A5fBbA99a43A2c0922

# C-Chain RPC URL
chain_rpc_url: wss://api.camino.network/ext/bc/C/ws

### Bot identity

# Private key of the bot in hex format without the 0x prefix.
# Used for signing transactions on the c-chain, also used to log in into Matrix. This
# address needs to have some funds to pay for transaction fees on the C-Chain.
bot_key: YOUR_PRIVATE_KEY_HEX

# Address of the CM Account that the bot belongs to
cm_account_address: 0xYOUR_CM_ACCOUNT_ADDRESS

### Cheque handling

cheque_expiration_time: 18144000 # 7 months

min_cheque_duration_until_expiration: 15552000 # 6 months

cash_in_period: 86400 # 1 day

# matrix application service bot address
network_fee_recipient_bot_address: 0xbeb027D2f439805E17EAA16Da26c1FCa68a30232

# matrix application service cm account address
network_fee_recipient_cm_account: 0x16DFfB3911BB0b1B53eF4d774804381f0B38B5d7

### Database
db:
# Path to migrations dir with sql up/down scripts. Schema is mandatory.
migrations_path: file://./migrations

# Path to database file.
path: distributor-bot.db

### Matrix
matrix:
# Hostname of the Matrix server
host: messenger.chain4travel.com

### Partner Plugin (NOT USED FOR DISTRIBUTOR BOT)
# partner_plugin:
# # Partner Plugin hostname and port, should be reachable from this machine.
# # Bot tries to connect to this host and port to relay messages that it receives from
# # the distributors through Matrix Server
# host: localhost:50051

# # TLS configuration
# unencrypted: true

# # Required if partner_plugin_unencrypted is false
# ca_file: ca-cert.pem

### RPC server
rpc_server:
# Listen on this port for incoming RPC requests
port: 9090

# TLS configuration
unencrypted: true

cert_file: server-cert.pem
key_file: server-key.pem
### Tracing
# tracing:
# cert_file: server-cert.pem
# enabled: true
# host: localhost:4317
# insecure: true
# key_file: server-key.pem

:::

Configuration Options

OptionDescription
developer_modeActivates developer mode, enabling DEBUG level logging for troubleshooting.
response_timeoutTimeout in milliseconds for waiting for a response from the Messaging server.
booking_token_addressBookingToken smart contract address, fixed per environment.
chain_rpc_urlRPC URL to interact with the EVM APIs
bot_keyPrivate key that is used to identify the bot in the messenger network and for the operation on C-Chain like BookingToken mint and buy operations.
cm_account_addressAddress of the CM Account that the bot belongs to
cheque_expiration_timeThe time until when the check expires. Default: 18144000 # 7 months
min_cheque_duration_until_expirationThe minimum time until when the check expires. Default: 5552000 # 6 months
cash_in_periodFrequency of initiating the cash-in of the cheques: Default 86400 # 1 day
network_fee_recipient_bot_addressFixed address per environment: for Camino 0xbeb027D2f439805E17EAA16Da26c1FCa68a30232
network_fee_recipient_cm_accountFixed address per environment: for Camino 0x16DFfB3911BB0b1B53eF4d774804381f0B38B5d7
db:migrations_pathPath to migrations dir with sql up/down scripts. Schema is mandatory.
db:pathPath to database file, for example: distributor-bot.db
matrix:hostDesignates the host address of the Matrix server.
partner_plugin:hostSets the host address for the partner plugin's RPC server.
partner_plugin:unencryptedDetermines if the Partner Plugin RPC should establish an unencrypted connection to the server.
partner_plugin:ca_filePath to the CA certificate file for the partner plugin RPC server. Required only if partner_plugin_unencrypted=false
rpc_server:portSpecifies the port number for the RPC server; the bot listens for requests on this port.
rpc_server:unencryptedIndicates if the RPC server communication should remain unencrypted.
rpc_server:cert_fileFile path to the server's TLS certificate for encrypted communication. Required only if rpc_unencrypted=false
rpc_server:key_fileFile path to the server's SSL key for encrypted communication. Required only if rpc_unencrypted=false
SUPPORTED REQUEST TYPES

The supported request types and the applicable service fee are taken from the CM account. The bot will not start-up when a message type is specified in the CM Account but not supported by the current version of the bot. Please make sure that the CM-Account and the running version of the bot are aligned with the supported versions of the services. The bot does always support the latest 3 versions of each service.

Creating a Wallet for the Bot

Navigate to Camino Wallet and create a wallet for use with your bot deployment. Once you have logged into your wallet, proceed to the "Manage Keys" tab. Here, click on "View Private Key" next to your key listed under the "My Keys" section.

Enter this private key into the configuration file for your bot.

Configuring for Development

To set up your environment for development, default example config files should be enough. Note that the default files have omitted certificate-related fields to allow for unencrypted communication.

PARTNER PLUGIN HOST & PORT

Please ensure that the partner plugin host & port align with the active partner plugin settings. For further details, refer to the partner plugin page.

TRANSACTION FEES

Ensure that your wallet, associated with the bot_key, contains CAM tokens to cover transaction fees. Your C-Chain address will be displayed when you run the bot.

Run

Run the bot with the command below, change the config file name file accordingly.

./bot -config camino-messenger-bot.yaml

Configuring the Docker Container

For those utilizing Docker for bot installation, load the configuration as shown below:

docker run -v ./cmb-config/:/cmb-config camino-messenger-bot --config /cmb-config/config.yaml

where: -v local_path:container_path - in this example the local directory ./cmb-config is mounted in the container into /cmb-config to be accessible from inside the container by the started process. camino-messenger-bot - the image name --config /cmb-config/config.yaml - parameters

CHECK DOCKER COMPOSE FILE

For more detailed configuration, refer to the docker-compose.yaml file provided in the repository.

Example Output

After launching the bot, you can expect to see an output similar to the following (developer mode):

❯ docker run -v ./cmb-config/:/cmb-config camino-messenger-bot --config /cmb-config/config.yaml
2024-10-17T11:39:19.090Z INFO cmd/camino_messenger_bot.go:67 App version: (git: )
2024-10-17T11:39:19.179Z INFO storage/storage.go:72 Performing db migrations...
2024-10-17T11:39:19.190Z INFO storage/storage.go:94 Migration version: 0
2024-10-17T11:39:19.199Z INFO storage/storage.go:112 New migration version: 1
2024-10-17T11:39:19.199Z INFO storage/storage.go:115 Finished preforming db migrations
2024-10-17T11:39:19.221Z INFO messaging/service_registry.go:69
Supported services:
cmp.services.accommodation.v1.AccommodationSearchService
cmp.services.book.v1.MintService
cmp.services.book.v1.ValidationService
cmp.services.accommodation.v1.AccommodationProductInfoService
cmp.services.accommodation.v1.AccommodationProductListService


2024-10-17T11:39:19.241Z INFO app/app.go:211 Starting start-up cash-in status check...
2024-10-17T11:39:19.241Z INFO app/app.go:230 Starting message receiver...
2024-10-17T11:39:19.241Z INFO app/app.go:219 Starting scheduler...
2024-10-17T11:39:19.241Z INFO app/app.go:242 Starting message processor...
2024-10-17T11:39:19.348Z INFO matrix/matrix_messenger.go:145 Successfully logged in as: @0xef9005c1b423a3fbbb1b5139c648f306da7a0ed4:messenger.chain4travel.com