Search code examples
botframeworkdirect-line-botframeworkweb-chat

Bot Framework Service vs Bot Connector Service


Are both Bot Framework Service and Bot Connector Service same ? Or Bot Framework Service is a layer on the top of Bot Connector Service ? I am confused as these are used interchangeably.

I understand that Bot Framework Web Chat component uses direct line api to communicate with the bot through Bot Framework Service/Bot Connector Service. But does Bot Framework Service implements direct line protocol to understand the requests from Web Chat ? Can somebody give me a complete/ end to end picture ?

Thanks!


Solution

  • I agree the documentation is pretty confusing and the terms are used interchangeably. Actually, the Bot Framework Service and Bot Connector Service are two different terms when you dig deeper into how things are handled at the Bot Framework end. If you look at the documentation already available on the website,

    The Bot Connector service enables your bot to exchange messages with channels configured in the Bot Framework Portal. It uses industry-standard REST and JSON over HTTPS and enables authentication with JWT Bearer tokens.

    The Bot Framework Service, which is a component of the Azure Bot Service, sends information between the user's bot-connected app (such as Facebook, Skype, Slack, etc. which we call the channel) and the bot.

    Now coming to the difference,

    The Bot Framework Service lives in the cloud and takes on the role of translating the data from the APIs of multiple supported Channels into the Bot Framework protocol in a form that your local bot code can understand. This allows your bot to communicate with multiple channels, without having to understand which Channel the data is coming from. The client actually makes the REST calls to the Bot Framework Service, specifically the CreateConnectorClient() method in the BotFrameworkAdapter class which sends the outbound request back towards the Bot Framework Service, which eventually talks to the channel.

    The Bot Framework Service works both inbound and outbound whereas the Bot Connector Service works only outbound. The Bot Connector Service exchanges information between between bot and channel (user) by passing an Activity object. When your bot sends a request to the Bot Connector Service, it must include information that the Connector service can use to verify its identity. Likewise, when the Connector service sends a request to your bot, it must include information that the bot can use to verify its identity.

    If you have a look at this flow diagram, it will explain the main bot logic.

    enter image description here

    This diagram explains the steps for bot-to-connector authentication.

    enter image description here

    This diagram explains the steps for connector-to-bot authentication.

    enter image description here

    Note: We are currently working on updating our documentation with more detailed information and flow diagrams to help the users understand each and every component of Azure Bot Service. I will update the thread with the updated links once they are published.

    Hope this helps.