{"id":16826611,"url":"https://github.com/dlemstra/line-bot-sdk-dotnet-sample","last_synced_at":"2025-08-23T05:05:45.326Z","repository":{"id":31440251,"uuid":"127797351","full_name":"dlemstra/line-bot-sdk-dotnet-sample","owner":"dlemstra","description":"Sample for https://github.com/dlemstra/line-bot-sdk-dotnet","archived":false,"fork":false,"pushed_at":"2022-05-19T18:44:21.000Z","size":153,"stargazers_count":13,"open_issues_count":0,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-23T05:04:38.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dlemstra.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-02T18:41:00.000Z","updated_at":"2024-07-11T03:39:07.000Z","dependencies_parsed_at":"2022-09-05T09:30:57.533Z","dependency_job_id":null,"html_url":"https://github.com/dlemstra/line-bot-sdk-dotnet-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dlemstra/line-bot-sdk-dotnet-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlemstra%2Fline-bot-sdk-dotnet-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlemstra%2Fline-bot-sdk-dotnet-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlemstra%2Fline-bot-sdk-dotnet-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlemstra%2Fline-bot-sdk-dotnet-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dlemstra","download_url":"https://codeload.github.com/dlemstra/line-bot-sdk-dotnet-sample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dlemstra%2Fline-bot-sdk-dotnet-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271745472,"owners_count":24813499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T11:17:55.779Z","updated_at":"2025-08-23T05:05:45.282Z","avatar_url":"https://github.com/dlemstra.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# line-bot-sdk-dotnet-sample\n\n[![GitHub license](https://img.shields.io/badge/license-Apache%202-green.svg)](https://raw.githubusercontent.com/dlemstra/line-bot-sdk-dotnet/master/License.txt)\n[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/fold_left.svg?style=social\u0026label=Follow%20%40MagickNET)](https://twitter.com/MagickNET)\n\nThis project contains a sample of how [line-bot-sdk-dotnet](https://github.com/dlemstra/line-bot-sdk-dotnet) can be used in a .NET web application.\n\n### What do I need to use this sample in a bot channel?\n\nTo use this sample in a bot channel you will need the following:\n\n- Visual Studio 2017\n- Docker\n- Azure account\n\nThe sample project also works when you run the resulting Docker container on another platform than Azure but because of the integration with Azure inside\nVisual Studio you can run this sample very quickly inside Azure.\n\n\n### How can I use this sample in a bot channel?\n\nThe first step is cloning the repository:\n\n```\nMicrosoft Windows [Version 10.0.16299.309]\n(c) 2017 Microsoft Corporation. All rights reserved.\n\nC:\\line-bot-sdk-dotnet-sample\u003egit clone https://github.com/dlemstra/line-bot-sdk-dotnet-sample.git.\nCloning into '.'...\nremote: Counting objects: 29, done.\nremote: Compressing objects: 100% (19/19), done.\nremote: Total 29 (delta 5), reused 29 (delta 5), pack-reused 0\nUnpacking objects: 100% (29/29), done.\nChecking connectivity... done.\n```\n\nAfter cloning this project you will need to open the solution in the root of the project: `LineBotSample.sln`. This project requires Docker to be installed.\nWhen the projected is opened with Visual Studio 2017 you will receive an examplantion on how to install Docker when this is not yet installed.\n\nThe next step is modifying the file `appsettings.json` in the `LineBotSample` project. This file has the following content:\n\n```json\n{\n  \"LineConfiguration\": {\n    \"ChannelAccessToken\": \"YourChannelAccessToken\",\n    \"ChannelSecret\": \"YourChannelSecret\"\n  }\n}\n```\n\nThe values that need to entered in the `LineConfiguration` block can be found on the settings page of the bot channel:\n\n![settings page](Documentation/channel.png)\n\nThe next step is to publish the `LineBotSample` to Azure. This can be done with a right-click on the LineBotSample project:\n\n![publish project](Documentation/publish.png)\n\nThis will open the following dialog:\n\n![publish target](Documentation/publish-target.png)\n\nOn this dialog the option `App Service Linux` should be picked and the publish button can be pressed that will open the following dialog:\n\n![create app service](Documentation/create-app-service.png)\n\nWhen the create button on that dialog is pressed the App Service will be created in Azure and the following dialog will be shown:\n\n![publish summary](Documentation/publish-summary.png)\n\nOn this page the `Site URL` should be copied and pasted in the appsettings.json. `http` should be changed into `https` and `/resources/` should be added to the end url.\n\n```json\n{\n  \"LineBotSampleConfiguration\": {\n    \"ResourcesUrl\": \"https://linebotsample20180402094740.azurewebsites.net/resources/\"\n  }\n}\n```\n\nAfter setting this value the `Publish` button in the last dialog should be pressed to update the App Service.\n\nAnd the last step is setting the `WebHook` in the channel but to see what is happening when the webhook is verified it is wise to enable diagnostics logs open a Cloud Shell in Azure:\n\n![diagnostics logs](Documentation/diagnostics-logs.png)\n\nIn the Cloud Shell the command below needs to be entered. The value for `--name` should be the name of the App Service, and `-g` the name of the Resource Group.\n\n```\ndirk@Azure:~$ az webapp log tail --name LineBotSample20180402094740 -g cloud-shell-storage-westeurope\n```\n\nThe `WebHook` should also be set on the settings page of the channel.\n\n![webhook](Documentation/webhook.png)\n\nAfter clicking on `Update` the `Verify` button will become visible.\n\n![verify](Documentation/verify.png)\n\nPressing this button will send a message to the bot and this should be shown in the Cloud Shell.\n\n![cloud shell](Documentation/cloud-shell.png)\n\nThis bot now only handles `LineEventType.Message` and responds to 3 messages.\n\n- When the message contains `ping` the bot will reply with `pong`.\n- When the message contains `user` the bot will reply with a message the contains information of the user.\n- When the message contains `logo` the bot will reply with an image that is the logo of this project.\n\nThe code for the event handler can be found in [src/LineBotSample/EventHandlers/MessageEventHandler.cs](src/LineBotSample/EventHandlers/MessageEventHandler.cs). Feel free to modify this\nsample and play around with it. This project is also open to PR's with extra samples.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlemstra%2Fline-bot-sdk-dotnet-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdlemstra%2Fline-bot-sdk-dotnet-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdlemstra%2Fline-bot-sdk-dotnet-sample/lists"}