Current section

Files

Jump to
line_message lib line-message push.ex
Raw

lib/line-message/push.ex

defmodule LineMessage.Push do
@api_url "https://api.line.me/v2/bot/message/push"
def to(messages, user_id) when messages != [] do
{:ok, body} = %{
to: user_id,
messages: messages
} |> Poison.encode
HTTPotion.post Application.get_env(:line_message, :url), [
body: body,
headers: [
"Content-Type": "application/json",
"Authorization": "Bearer " <> @api_url
]]
end
end