이 라이브러리는 LINE Developers의 API를 C# 라이브러리로 개발한 것이며, LINE Developers와 관련없는 비공식 라이브러리 임을 밝힙니다. 한국에서는 지원하지 않거나 유료 기반의 기능들은 테스트를 완료하지 못했습니다. 참고하시기 바라며 LINE Messenger 기반 메시지 발송 또는 챗봇을 개발하시는 분들께 도움이 되길 바랍니다.
v1.1.20부터 LINE API와 HTTP/2로 통신을 합니다.
하위 버전에서 1.1.20버전으로 코드 수정없이 업데이트 가능하니 업데이트 권고드립니다.
Install-Package LineDevelopers -Version 1.1.20각 기능 별로 개별 class들이 아래와 같이 존재합니다. 하지만 LineMessagingClient를 통해 아래의 모든 기능들을 사용 할 수 있으며 LineMessagingClient를 통해 구현하는 것을 권장합니다.
- 예시)
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 | ✔ |