Skip to content

Instantly share code, notes, and snippets.

@huanlin
Created December 1, 2022 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huanlin/a8be8b01638725ddd5b8e35df6fd5569 to your computer and use it in GitHub Desktop.
Save huanlin/a8be8b01638725ddd5b8e35df6fd5569 to your computer and use it in GitHub Desktop.
Line Notify Example
namespace ConsoleApp1
{
internal class Program
{
static async Task Main(string[] args)
{
var secretToken = "XYZ"; // <--- Replace with your token.
HttpClient httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", secretToken);
var content = new Dictionary<string, string>();
content.Add("message", "\r\nThis is just a test message.");
await httpClient.PostAsync("https://notify-api.line.me/api/notify", new FormUrlEncodedContent(content));
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment