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 *.yaml.example, removing the .example at the end.

Supplier Example:

cp camino-messenger-bot-supplier.yaml.example camino-messenger-bot-supplier.yaml

Distributor Example:

cp camino-messenger-bot-distributor.yaml.example camino-messenger-bot-distributor.yaml

Example Supplier Bot Config File:

# Lower level logging for local development
developer_mode: true

### Tracing
#tracing_enabled: true
#tracing_host: localhost
#tracing_port: 4317
#tracing_insecure: true
#tracing_cert_file: server-cert.pem
#tracing_key_file: server-key.pem

### Matrix

# Private key to be used to login to Matrix Server
matrix_key: PrivateKey-YOUR_PRIVATE_KEY

# Hostname of the Matrix Server
matrix_host: matrix.camino.network

# Local DB file to store Matrix data
matrix_store: supplier-matrix.db

# Timeout in milliseconds to wait for responses on Matrix Server
response_timeout: 10000

### Bot RPC Configuration

# Listen on this port for RPC requests from the partner plugin (or Postman during
# development)
rpc_server_port: 9090
# TLS configuration
rpc_unencrypted: true
rpc_server_cert_file: server-cert.pem
rpc_server_key_file: server-key.pem

### 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
partner_plugin_host: localhost
partner_plugin_port: 50051
# TLS configuration
partner_plugin_unencrypted: true
# Required if partner_plugin_unencrypted is false
partner_plugin_ca_file: ca-cert.pem

### Supported Request Types for this supplier.
supported_request_types:
- ActivitySearchRequest
- ActivityProductListRequest
- AccommodationProductInfoRequest
- AccommodationProductListRequest
- AccommodationSearchRequest
- GetNetworkFeeRequest
- GetPartnerConfigurationRequest
- MintRequest
- ValidationRequest
- PingRequest
- TransportSearchRequest

### C-Chain (EVM)

# Used for signing transactions on the c-chain, can be same as the matrix_key.
# This address needs to have some funds to pay for transaction fees on the C-Chain.
evm_private_key: PrivateKey-YOUR_PRIVATE_KEY

# C-Chain RPC URL
rpc_url: https://columbus.camino.network/ext/bc/C/rpc

### Booking Token

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

# ABI file that will be used during minting, buying of Booking Tokens
booking_token_abi_file: abi/BookingTokenV0.abi

# Supplier name to be used for registering to the BookingToken smart contract.
# Should be a short name, it will be saved on-chain.
supplier_name: SUPPLIER_NAME

# Default expiration time (in seconds) for BookingToken mints.
#
# The supplier bot creates booking tokens and sets an expiration timestamp on each token.
# Once this time has passed, the token is no longer available for purchase by the distributor.
# The default value is 600 seconds.
buyable_until_default: 600

Example Distributor Bot Config File:

# Lower level logging for local development
developer_mode: true

### Tracing
#tracing_enabled: true
#tracing_host: localhost
#tracing_port: 4317
#tracing_insecure: true
#tracing_cert_file: server-cert.pem
#tracing_key_file: server-key.pem

### Matrix

# Private key to be used to login to Matrix Server
matrix_key: PrivateKey-YOUR_PRIVATE_KEY

# Hostname of the Matrix Server
matrix_host: matrix.camino.network

# Local DB file to store Matrix data
matrix_store: distributor-matrix.db

# Timeout in milliseconds to wait for responses on Matrix Server
response_timeout: 10000

### Bot RPC Configuration

# Listen on this port for RPC requests from the partner plugin (or Postman during
# development)
rpc_server_port: 9090
# TLS configuration
rpc_unencrypted: true
rpc_server_cert_file: server-cert.pem
rpc_server_key_file: server-key.pem

### Partner Plugin (NOT USED FOR DISTRIBUTOR BOT)
# 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
#partner_plugin_host: localhost
#partner_plugin_port: 50051
# TLS configuration
#partner_plugin_unencrypted: true
# Required if partner_plugin_unencrypted is false
#partner_plugin_ca_file: ca-cert.pem

### Supported Request Types for this distributor.
# Only requests that does not talk to the partner plugin can be enabled here.
supported_request_types:
- GetNetworkFeeRequest
- GetPartnerConfigurationRequest
- PingRequest

### C-Chain (EVM)

# Used for signing transactions on the c-chain, can be same as the matrix_key.
# This address needs to have some funds to pay for transaction fees on the C-Chain.
evm_private_key: PrivateKey-YOUR_PRIVATE_KEY

# C-Chain RPC URL
rpc_url: https://columbus.camino.network/ext/bc/C/rpc

### Booking Token

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

# ABI file that will be used during minting, buying of Booking Tokens
booking_token_abi_file: abi/BookingTokenV0.abi
# Supplier name to be used for registering to the BookingToken smart contract.
# Should be a short name, it will be saved on-chain. Not used with distributor bot.
#supplier_name: SUPPLIER_NAME

# Default expiration time (in seconds) for BookingToken mints.
#
# The supplier bot creates booking tokens and sets an expiration timestamp on each token.
# Once this time has passed, the token is no longer available for purchase by the distributor.
# The default value is 600 seconds.
#buyable_until_default: 600
BOOKING TOKEN ADDRESS

Please note that the BookingToken address is subject to change in upcoming releases.

Configuration Options​

OptionDescription
developer_modeActivates developer mode, enabling DEBUG level logging for troubleshooting.
matrix_keySpecifies the private key for authenticating with the Matrix server.
matrix_hostDesignates the host address of the Matrix server.
matrix_storeDefines the path to the Matrix OLM data store (SQLite3 database path).
rpc_server_portSpecifies the port number for the RPC server; the bot listens for requests on this port.
rpc_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
partner_plugin_hostSets the host address for the partner plugin's RPC server.
partner_plugin_portDesignates the port number 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
response_timeoutTimeout in milliseconds for waiting for a response from the Matrix server.
supported_request_typesLists the request types that the bot supports, as defined by the Camino Messenger Protocol.
evm_private_keyPrivate key that is used for the operation on C-Chain like BookingToken mint and buy operations.
rpc_urlRPC URL to interact with the EVM APIs
booking_token_addressBookingToken smart contract address
booking_token_abi_filePath for the BookingToken smart contract ABI file
supplier_nameSupplier name to be used for the registration on BookingToken. Provide a short name.
buyable_until_defaultDefault expiration time (in seconds) for BookingToken mints. Default 600 seconds
SUPPORTED REQUEST TYPES

The configuration for supported request types is particularly relevant for provider bots offering specific services, such as accommodation search or transport search. However, it is recommended that all bots enable PingRequest messages, with the exception of PingRequest being the universal function every bot should support.

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 evm_private_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, configure your environment variables as shown below.

docker run --rm --env-file bot.env camino-messenger-bot

Your bot.env file should contain the following settings:

Supplier Example:

CMB_DEVELOPER_MODE=true
CMB_MATRIX_KEY=PrivateKey-REST_OF_THE_PRIVE_KEY
CMB_MATRIX_HOST=matrix.camino.network
CMB_MATRIX_STORE=supplier-matrix.db
CMB_RPC_SERVER_PORT=9090
CMB_RPC_UNENCRYPTED=true
CMB_PARTNER_PLUGIN_HOST=supplier-plugin-host
CMB_PARTNER_PLUGIN_PORT=50051
CMB_PARTNER_PLUGIN_UNENCRYPTED=true
CMB_RESPONSE_TIMEOUT=10000
CMB_SUPPORTED_REQUEST_TYPES=ActivitySearchRequest,ActivityProductListRequest,AccommodationProductInfoRequest,AccommodationProductListRequest,AccommodationSearchRequest,GetNetworkFeeRequest,GetPartnerConfigurationRequest,MintRequest,ValidationRequest,PingRequest,TransportSearchRequest
CMB_RPC_URL=https://columbus.camino.network/ext/bc/C/rpc
CMB_BOOKING_TOKEN_ABI_FILE=abi/BookingTokenV0.abi
CMB_BOOKING_TOKEN_ADDRESS=0xd4e2D76E656b5060F6f43317E8d89ea81eb5fF8D
CMB_SUPPLIER_NAME=SUPPLIER_NAME
CMB_EVM_PRIVATE_KEY=PrivateKey-THE_REST_OF_THE_KEY
CMB_BUYABLE_UNTIL_DEFAULT=600

Distributor Example:

CMB_DEVELOPER_MODE=true
CMB_MATRIX_KEY=PrivateKey-REST_OF_THE_PRIVE_KEY
CMB_MATRIX_HOST=matrix.camino.network
CMB_MATRIX_STORE=distributor-matrix.db
CMB_RPC_SERVER_PORT=9090
CMB_RPC_UNENCRYPTED=true
CMB_RESPONSE_TIMEOUT=10000
CMB_SUPPORTED_REQUEST_TYPES=GetNetworkFeeRequest,GetPartnerConfigurationRequest,PingRequest
CMB_RPC_URL=https://columbus.camino.network/ext/bc/C/rpc
CMB_BOOKING_TOKEN_ABI_FILE=abi/BookingTokenV0.abi
CMB_BOOKING_TOKEN_ADDRESS=0xd4e2D76E656b5060F6f43317E8d89ea81eb5fF8D
CMB_EVM_PRIVATE_KEY=PrivateKey-THE_REST_OF_THE_KEY
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:

2024-02-06T01:03:03.218Z        INFO    app/app.go:50   Starting gRPC client...
2024-02-06T01:03:03.218Z INFO app/app.go:62 Starting message receiver...
2024-02-06T01:03:03.218Z WARN server/server.go:65 Running gRPC server without TLS!
github.com/chain4travel/camino-messenger-bot/internal/rpc/server.NewServer
/camino-messenger-bot/internal/rpc/server/server.go:65
github.com/chain4travel/camino-messenger-bot/internal/app.(*App).Run
/camino-messenger-bot/internal/app/app.go:82
main.main
/camino-messenger-bot/cmd/camino-messenger-bot/main.go:22
runtime.main
/usr/local/go/src/runtime/proc.go:250
2024-02-06T01:03:03.219Z INFO app/app.go:84 Starting gRPC server...
2024-02-06T01:03:03.570Z INFO matrix/matrix_messenger.go:126 Successfully logged in as: @t-kopernikus1uknuxrgqtxfd4yk08v24m9pn0j9gvt6wav8gc7:matrix.camino.network
2024-02-06T01:03:03.570Z INFO app/app.go:77 Starting message processor...