Skip to content

charles96/LineDevelopers.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

dotnet version Nuget Nuget downloads

LINE Developers.Net

This C# Library is implemented of the LINE Developers APIs. and This is an unofficial LINE Developers library. There are so many features in LINE Developers APIs. However couldn't test such of features which are not offer in KOREA and some of pay features. but It'll works well. I hope it's helpful to develop message send and chatbot via LINE Messenger.

install from nuget

Since v1.1.20, It communicates based on HTTP/2.0 between LineDevelopers.NET and LINE APIs.
And it's not necessary to any migrate(such as code change) for the update.
so I strongly recommend to update v1.1.20

Install-Package LineDevelopers -Version 1.1.20 

1. Getting started

2. Library introduction

2-1. LineMessagingClient class

There are exists each class by unit of feature. for instance, it offer same features both a LineMessaingClient.Insight and a LineInsightClient class. but I recommend that you should use a LineMessagingClient class instead of each class.

  • example)
    using Line.Message;
    
    using (var client = new LineMessagingClient("your access token"))
    {
        await client.Message.SendBroadcastMessageAsync(new TextMessage("hello world"));
        await client.Message.SendReplyMessageAsync("reply token", new TextMessage("hello world"));
        await client.Insight.GetNumberOfMessageDeliveriesAsync(new DateOnly(2022, 10, 31));
        await client.RichMenu.DownloadRichMenuImageAsync("test richmenu id", @"c:\temp\test.jpg");
    }

2-1-1. LineMessageClient class

LINE Developers Methods Tested
Send reply message SendReplyMessageAsync βœ”
Send push message SendPushMessageAsync βœ”
Send multicast message SendMulticastMessageAsync βœ”
Send narrowcast message SendNarrowcastMessageAsync ❌
Send broadcast message SendBroadcastMessageAsync βœ”
Get the target limit for sending messages this month GetTheTargetLimitForSendingMessagesThisMonthAsync βœ”
Get number of messages sent this month GetNumberOfMessagesSentThisMonthAsync βœ”
Get number of sent reply messages GetNumberOfSentMessagesAsync βœ”
Get number of sent push messages GetNumberOfSentMessagesAsync βœ”
Get number of sent multicast messages GetNumberOfSentMessagesAsync βœ”
Get number of sent broadcast messages GetNumberOfSentMessagesAsync βœ”
Validate message objects of a reply message ValidateMessageObjectsOfMessageAsync βœ”
Validate message objects of a push message ValidateMessageObjectsOfMessageAsync βœ”
Validate message objects of a multicast message ValidateMessageObjectsOfMessageAsync βœ”
Validate message objects of a narrowcast message ValidateMessageObjectsOfMessageAsync ❌
Validate message objects of a broadcast message ValidateMessageObjectsOfMessageAsync βœ”
Get number of units used this month GetNumberOfUnitsUsedThisMonthAsync βœ”
Get name list of units used this month GetNameListOfUnitsUsedThisMonthAsync βœ”

2-1-2. LineInsightClient class

LINE Developers Methods Tested
Get number of message deliveries GetNumberOfMessageDeliveriesAsync βœ”
Get number of followers GetNumberOfFollowersAsync βœ”
Get friend demographics GetFriendsDemographicsAsync ❌
Get user interaction statistics GetUserInteractionStatisticsAsync ❌
Get statistics per unit GetStatisticsPerUnitAsync ❌

2-1-3. LineRichMenuClient class

LINE Developers Methods Tested
Create rich menu CreateRichMenuAsync βœ”
Validate rich menu object ValidateRichMenuAsync βœ”
Upload rich menu image UploadRichMenuImageAsync βœ”
Download rich menu image DownloadRichMenuImageAsync βœ”
Get rich menu list GetRichMenuListAsync βœ”
Get rich menu GetRichMenuAsync βœ”
Delete rich menu DeleteRichMenuAsync βœ”
Set default rich menu SetDefaultRichMenuAsync βœ”
Get default rich menu ID GetDefaultRichMenuIdAsync βœ”
Cancel default rich menu CancelDefaultRichMenuAsync βœ”
Create rich menu alias CreateRichMenuAliasAsync βœ”
Delete rich menu alias DeleteRichMenuAliasAsync βœ”
Update rich menu alias UpdateRichMenuAliasAsync βœ”
Get rich menu alias information GetRichMenuAliasInformationAsync βœ”
Get list of rich menu alias GetListOfRichMenuAliasAsync βœ”
Link rich menu to user LinkRichMenuToUserAsync βœ”
Link rich menu to multiple users LinkRichMenuToMultipleUsersAsync βœ”
Get rich menu ID of user GetRichMenuIdOfUserAsync βœ”
Unlink rich menu from user UnlinkRichMenuFromUserAsync βœ”
Unlink rich menus from multiple users UnlinkRichMenusFromMultipleUsersAsync βœ”
Replace or unlink the linked rich menus in batches ReplaceOrUnlinkTheLinkedRichMenusInBatchesAsync βœ”
Get the status of rich menu batch control GetStatusOfRichMenuBatchControlAsync ❌
Validate a request of rich menu batch control ValidateRequestOfRichMenuBatchControlAsync βœ”

2-1-4. LineGroupChatClient class

LINE Developers Methods Tested
Get group chat summary GetSummaryAsync βœ”
Get number of users in a group chat GetNumberOfUsersAsync βœ”
Get group chat member user IDs GetMemberUserIdsAsync βœ”
Get group chat member profile GetChatMemberProfileAsync βœ”
Leave group chat LeaveAsync βœ”

2-1-5. LineMultiPersonChatClient class

LINE Developers Methods Tested
Get number of users in a multi-person chat GetNumberOfUsersAsync ❌
Get multi-person chat member user IDs GetMemberUserIdsAsync ❌
Get multi-person chat member profile GetMemberProfileAsync ❌
Leave multi-person chat LeaveAsync ❌

2-1-6. LineUserClient class

LINE Developers Methods Tested
Get profile GetUserProfileAsync βœ”
Get a list of users who added your LINE Official Account as a friend GetFollowersAsync ❌

2-1-7. LineAccountLinkClient class

LINE Developers Methods Tested
Issue link token IssueLinkTokenAsync βœ”

2-1-8. LineWebhookSettingClient class

LINE Developers Methods Tested
Set webhook endpoint URL SetEndpointUrlAsync βœ”
Get webhook endpoint information GetEndpointInformationAsync βœ”
Test webhook endpoint TestEndpointAsync βœ”

2-1-9. LineBotClient class

LINE Developers Methods Tested
Get bot info GetBotInformationAsync βœ”

2-2. LineChannelAccessTokenClient class

using Line;

using (var client = new LineChannelAccessTokenClient())
{
    try
    {
        var result = await client.IssueShortLivedChannelAccessTokenAsync("client id", "secret");

        await client.VerifyShortLonglivedChannelAccessTokenAsync(result.AccessToken);
    }
    catch (LineCredentialException ex)
    {
        Console.WriteLine($"error : {ex.Message}");
        Console.WriteLine($"error_description : {ex.Detail}");
    }
}
LINE Developers Methods Tested
Issue channel access token v2.1 IssueChannelAccessTokenAsync ❌
Verify the validity of the channel access token v2.1 VerifyChannelAccessTokenAsync ❌
Get all valid channel access token key IDs v2.1 GetAllValidChannelAccessTokenKeyIDsAsync ❌
Revoke channel access token v2.1 RevokeChannelAccessTokenAsync ❌
Issue short-lived channel access token IssueShortLivedChannelAccessTokenAsync βœ”
Verify the validity of short-lived and long-lived channel access tokens VerifyShortLonglivedChannelAccessTokenAsync βœ”
Revoke short-lived or long-lived channel access token RevokeShortLongLivedChannelAccessTokenAsync βœ”

2-3 LineLiffClient class

using Line;
using Line.Liff;

using (var client = new LineLiffClient("access token"))
{
    try
    {
        var liffs = await client.GetAllLiffAppsAsync();

        foreach (var liff in liffs)
        {
            await client.DeleteLiffAppsFromChannelAsync(liff.LiffId);
        }
    }
    catch (LineException ex)
    {
        Console.WriteLine(ex.Message);

        foreach (var detail in ex.Details ?? Enumerable.Empty<Detail>())
        {
            Console.WriteLine(detail.Message);
            Console.WriteLine(detail.Property);
        }
    }
}
LINE Developers Methods Tested
Adding the LIFF app to a channel AddLiffAppToChannelAsync βœ”
Update LIFF app settings UpdateLiffAppSettingAsync βœ”
Get all LIFF apps GetAllLiffAppsAsync βœ”
Delete LIFF app from a channel DeleteLiffAppsFromChannelAsync βœ”

2-4 LineLoginClient

using Line.Login;

using (LineLoginClient client = new LineLoginClient())
{
    var issued = await client.OAuth2dot1.IssueAccessTokenAsync("code", "redirectUrl", "clientId", "secret");
    var profile = await client.GetUserProfileAsync(issued.AccessToken);
}
LINE Developers Methods Tested
Issue access token OAuth2dot1.IssueAccessTokenAsync βœ”
Verify access token validity OAuth2dot1.VerifyAccessTokenValidityAsync βœ”
Refresh access token OAuth2dot1.RefreshAccessTokenAsync βœ”
Revoke access token OAuth2dot1.RevokeAccessTokenAsync βœ”
Verify ID token OAuth2dot1.VerifyIdTokenAsync βœ”
Get user information OAuth2dot1.GetUserInformationAsync βœ”
Get user profile GetUserProfileAsync βœ”
Get friendship status GetFriendshipStatusAsync βœ”

3. reference doc

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages