Skip to content
Thomas Howe edited this page Jun 16, 2016 · 3 revisions

Network Addresses

Generally, there are two parts to how bots are addressed in GreenBot. The network name, and the network handle. For instance, for @howethomas, the network name would be twitter, and the network handle is @howethomas.

When these two elements are put together, it will typically look like network::handle. As an example, if we attached a Nexmo number, say 15085551212, to Greenbot, it would have an address of nexmo::15085551212. New networks are added by adding network adapters in the server/network_adapters directory. When loaded by node, they register themselves in the Network collection in mongo.

Keywords

The first word of a conversation is the keyword. Keywords identify the bot that starts the new conversation. Sending 'hello' to nexmo::15085551212, Greenbot would search for the bot listening on nexmo::15085551212 for the word 'hello'. If it didn't find any, it would then look for a bot listening on nexmo::15085551212 listening for the word 'default'. If neither are found, the message is ignored.

Multiple Addresses and Keywords

A bot can listen to any number of addresses, attached to any number of networks. This also extends to keywords. The combination of keyword and destination address uniquely identifies the equivalent of the TCP 'ip - port pair' for bots.

If you wanted the same bot to answer any keyword sent to a network address, have it listen for the 'default' keyword. This is a pretty good 'directory' strategy; have the bot listen to all keywords, so that it is the first bot to answer the text. This first bot could then interact with the customer, trying to ascertain the intent of the texter. Once identified, the bot can then transfer the caller to the appropriate endpoint - for instance 'sales'. The bot would then transfer the caller with by sending him '/sales', which selects and transfers to the bot as if the first message carried the 'sales' keyword.