Code Monkey home page Code Monkey logo

linechannelconnector's Introduction

LINEChannelConnector

LINE Channel Connector for BotBuilder v4 You can find BotBuilder v3 version in v3 branch

The original idea and many source codes are from BotBuilderChannelConnector which "Allows to diretly interface channels without using the Microsoft Bot Development portal."

There are several reasons that I couldn't simply add LINE Channel to the repository, thus I created new one.

This is yet early beta version.

How to use

This channel connector works as part of OWIN pipeline. You need to tweak several places but See LineChannelConnectorV4Test project for how to use.

  1. Update LINE Channel Secret and Channel Access Token in appsettings.json.

  2. Update Startup.cs to include ASP.NET Core middleware in Configure method.

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    _loggerFactory = loggerFactory;

    // UserLINEChannel middleware converts incoming LINE event to BotFramework Activity
    app.UseDefaultFiles()
        .UseLINEChannel(new LINEConfig()
        {
            ChannelSecret = Configuration.GetSection("ChannelSecret")?.Value,
            ChannelAccessToken = Configuration.GetSection("ChannelAccessToken")?.Value,
            Uri = Configuration.GetSection("Uri")?.Value,
        })
        .UseStaticFiles()
        .UseBotFramework();
}
  1. Update Bot middleware in ConfigureServices method.
services.AddBot<EchoWithCounterBot>(options =>
{
    // This bot middleware replace ConnectorClient and use LINEConnectorClient
    options.Middleware.Add(new LINEAdapterMiddleware(new LINEConfig()
    {
        ChannelSecret = Configuration.GetSection("ChannelSecret")?.Value,
        ChannelAccessToken = Configuration.GetSection("ChannelAccessToken.Value,
        Uri = Configuration.GetSection("Uri")?.Value,
    }));
...

How this works.

There are two things this connector does.

Convert incoming LINE request to BotBuilder Activity Obviously, when LINE sends request to the bot, it has LINE format. The connector works as ASP.NET core OWIN middleware to convert LINE format to BotBuilder Activity.

Convert outgoing BotBuilder Activity to LINE reply This is implemented in LINEClient but specify LINEConnectorClient as IConnectorClient in TurnContext if it comes from LINE. See LineAdapterMiddleware.cs for detail.

Limitation

  • You need to use either Developer mode or paid mode as it uses push a lot.
  • LINE unique capabilities are not imeplemented yet.

Future plans

There are many future plans if some people actually using this.

  • Support LINE specific features, such as URL Schema, LIFF, etc.
  • Support Flex Messages.

linechannelconnector's People

Contributors

kenakamu avatar

Watchers

Kiwamu ISHII avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.