LineBotKit.Client 1.0.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package LineBotKit.Client --version 1.0.7
NuGet\Install-Package LineBotKit.Client -Version 1.0.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LineBotKit.Client" Version="1.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LineBotKit.Client --version 1.0.7
#r "nuget: LineBotKit.Client, 1.0.7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LineBotKit.Client as a Cake Addin
#addin nuget:?package=LineBotKit.Client&version=1.0.7

// Install LineBotKit.Client as a Cake Tool
#tool nuget:?package=LineBotKit.Client&version=1.0.7

LineBotKit

GitHub license Build status NuGet NuGet

Summary :

Provide functions which integrate with Line Messaging api

Pre-prepare

Developer need to apply line api token first , you can reference the following link :

Where apply the token :https://at.line.me
How to apply and setup instruction : https://dotblogs.com.tw/rexhuang/2017/07/02/120455
Installation

Install-Package LineBotKit.Client -Version 1.0.0

How to initial line bot :

The token string come from we setup above

   ILineClientManager clientManager = new LineClientManager("token");
Easy sample for send text message :

The token string come from we setup above

   ILineClientManager clientManager = new LineClientManager("token");
   clientManager.PushTextMessage("user id","message");
Provide interface to implement IoC like following
  container.RegisterType<ILineClientManager, LineClientManager>(
                  new InjectionConstructor("token"));
What functionalities do we have
//Send message related functions:
Task<ResponseItem> PushTextMessage(string to , string message);
Task<ResponseItem> PushImageMessage(string to, string imageContentUrl, string imagePreviewUrl);
Task<ResponseItem> PushStickerMessage(string to, int packageId, int stickerId);
Task<ResponseItem> PushAudioMessage(string to, string originalContentUrl, int duration);
Task<ResponseItem> PushVideoMessage(string to, string originalContentUrl, string previewImageUrl);
Task<ResponseItem> PushLocationMessage(string to, string title, string address , decimal latitude , decimal longitude);
Task<ResponseItem> PushMessage(PushMessageRequest pushMessageRequest);
Task<ResponseItem> MulticastMessage(List<string> to, List<Message> messages);

//Reply message related functions:
Task<ResponseItem> ReplyTextMessage(string to, string message);
Task<ResponseItem> ReplyImageMessage(string to, string imageContentUrl, string imagePreviewUrl);
Task<ResponseItem> ReplyStickerMessage(string to, int packageId, int stickerId);
Task<ResponseItem> ReplyMessage(ReplyMessageRequest reply);

//Room related functions:
Task<Profile> GetRoomMemberProfile(string userId, string groupId);
Task<MemberIdensResponse> GetRoomMemberIds(string roomId);

//Group related functions:
Task<ResponseItem> LeaveGroup(string groupId);
Task<Profile> GetGroupMemberProfile(string userId, string groupId);
Task<MemberIdensResponse> GetGroupMemberIds(string groupId);

//Profile related functions:
Task<Profile> GetProfile(string userId);

//Rich menu related functions:
Task<RichMenu> GetRichMenu(string richMenuId);
Task<RichMenuIdResponse> CreateRichMenu(RichMenu richMenu);
Task<ResponseItem> DeleteRichMenu(string richMenuId);
Task<RichMenuIdResponse> GetRichMenuByUserId(string userId);
Task<ResponseItem> LinkRichMenuWithUser(string userId, string richMenuId);
Task<ResponseItem> UnLinkRichMenuWithUser(string userId);
Task<RichMenuListResponse> GetRichMenuList();
Task<ResponseItem> SetRichMenuImage(string richMenuId , byte[] image);
Stream GetRichMenuImage(string richMenuId);

//Others : 
Stream GetMessageContent(string messageId);

Examples :

//multiple message with different message type

var response = await lineManager.PushMessage(
new PushMessageRequest()
{
  to = "User Iden",
  messages = new List<Message>() {
             new TextMessage("Test first message"),
             new ImageMessage("Orginally Content Url","Preview Image Url")
  }

});
            

//buttons template message

 ResponseItem response = await lineManager.PushMessage(
 new PushMessageRequest()
 {
   to = "User Iden",
   messages = new List<Message>() {
              new TemplateMessage(){
                  altText = "altText",
                  template = new ButtonsTemplate(){
                  text = "text",
                  thumbnailImageUrl = "Thumbnail Image Url",
                  title = "title",
                  actions = new List<TemplateAction>(){
                            new UriAction(){
                                label = "test",
                                uri = "http://www.yahoo.com.tw"
                            }
                  }
              }
              }
  }
});

// Confirm template message

ResponseItem response = await lineManager.PushMessage(
new PushMessageRequest()
{
    to = "User Iden",
    messages = new List<Message>() {
            new TemplateMessage(){
                altText = "altText",
                template = new ConfirmTemplate(){
                    text = "text",
                    actions = new List<TemplateAction>(){
                        new MessageAction(){
                            label = "test",
                            text = "text"
                        },
                            new MessageAction(){
                            label = "test",
                            text = "text"
                        }
                    }
                }
            }
    }
});

//Carousel template message

 ResponseItem response = await lineManager.PushMessage(
 new PushMessageRequest()
 {
     to = "User Iden",
     messages = new List<Message>() {
          new TemplateMessage(){
               altText = "altText",
               template = new CarouselTemplate(){
                    columns = new List<TemplateColumn>(){
                         new TemplateColumn(){
                              title = "title",
                              text = "text",
                              ThumbnailImageUrl = "Thumbnail image url",
                              actions = new  List<TemplateAction>(){
                                     new MessageAction(){
                                          label = "label",
                                          text = "text"
                                     }
                              }
                         }
                    }
               }
          }
     }
 });


Quick glimpse what the result looks like

1. Open the application which under "Simulator"  file
2. Excute the application and change the url with like "http://localhost:port/swagger"
3. You will see the following page

![2018-03-08_225107](https://user-images.githubusercontent.com/4464354/37158499-7baf8904-2326-11e8-9970-310c0f0c9a44.jpg)

Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 1,096 4/18/2018
2.0.0 874 4/5/2018
1.0.9 917 4/2/2018
1.0.8 1,125 4/1/2018
1.0.7 1,040 3/30/2018
1.0.6 815 3/29/2018
1.0.5 934 3/21/2018
1.0.4 975 3/17/2018
1.0.3 1,030 3/15/2018
1.0.2 915 3/13/2018
1.0.1 1,638 3/12/2018
1.0.0 927 3/4/2018

Add default actions in Buttons template and Carousel template