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.
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
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"); }
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 | ✔ |
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 | ❌ |
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 | ✔ |
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 | ✔ |
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 | ❌ |
LINE Developers | Methods | Tested |
---|---|---|
Get profile | GetUserProfileAsync | ✔ |
Get a list of users who added your LINE Official Account as a friend | GetFollowersAsync | ❌ |
LINE Developers | Methods | Tested |
---|---|---|
Issue link token | IssueLinkTokenAsync | ✔ |
LINE Developers | Methods | Tested |
---|---|---|
Set webhook endpoint URL | SetEndpointUrlAsync | ✔ |
Get webhook endpoint information | GetEndpointInformationAsync | ✔ |
Test webhook endpoint | TestEndpointAsync | ✔ |
LINE Developers | Methods | Tested |
---|---|---|
Get bot info | GetBotInformationAsync | ✔ |
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 | ✔ |
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 | ✔ |
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 | ✔ |