Code:
require './api_client.rb'    ###  place this very file "send-BM.rb" and api_client.rb into the same subdir or adapt the path in this line

api = BitMessage::ApiClient.new 'http://username00:password00@127.0.0.1:8442/'

to   = "BM-2cW67GEKkHGonXKZLCzouLLxnLym3azS8r" # chan general
from = api.list_addresses.first.address

api.send_message to, from, "This is about Ruby subject", "This is a message ruby wise."



#   release site  :   http://bitmessage.mybb.rocks/viewtopic.php?id=26

## use api_client.rb  from      https://github.com/robzon/bitmessage-api-ruby

## gen BM-2cW67GEKkHGonXKZLCzouLLxnLym3azS8r

##    "BM-orkCbppXWSqPpAxnz6jnfTZ2djb5pJKDb" # echo service

#    keys.dat   should contain  : ( remove the # )

#apienabled = true
#apiport = 8442
#apiinterface = 127.0.0.1
#apiusername = username00      same as above
#apipassword = password00

#daemon = true

#tor only:

#socksproxytype = SOCKS5  
#onionhostname = abcdefgh.onion  
#onionbindip = 127.0.0.1  
#onionport = 8444  
#sockslisten = false