Skip to content

Instantly share code, notes, and snippets.

@the-takeo
Created June 29, 2019 11:50
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 the-takeo/21930f63c097b0a33f4b20dd9a6ea0c3 to your computer and use it in GitHub Desktop.
Save the-takeo/21930f63c097b0a33f4b20dd9a6ea0c3 to your computer and use it in GitHub Desktop.
LineNotify
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
namespace LineNotifyForFamily
{
public static class LineNotify
{
static string token = "Your Token";
public static void SendMessage(string message)
{
var result = sendMessage(message);
result.Wait();
}
private static async Task sendMessage(string message)
{
using (var client = new HttpClient())
{
var content = new FormUrlEncodedContent(new Dictionary<string, string>
{
{ "message", message },
});
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var result = await client.PostAsync("https://notify-api.line.me/api/notify", content);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment