Created
December 1, 2022 14:20
-
-
Save huanlin/a8be8b01638725ddd5b8e35df6fd5569 to your computer and use it in GitHub Desktop.
Line Notify Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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