bump_server/lib/bump/firebase.ex
raphael 745b0dc4f2 adds Firebase communication stump
- Firebase connection via Pigeon library
- sends bump to a single token at the moment
- encrypted test is sent as notification message
2021-12-30 13:06:26 +01:00

15 lines
453 B
Elixir

defmodule Bump.Firebase do
def test() do
IO.puts "Hello, world!"
end
def push(sender, message) do
IO.puts "Pushing #{message} to #{sender}"
n = Pigeon.FCM.Notification.new({:token, "dTm8S2bfTdKYQTjrxnwFFg:APA91bHGgM7IdRS5uxD0ljmwmP6cAec2icX0VBs69iRB2ApsohyOWzTzontO7cBkjNYbWV87zvxrXIs5jHkJ-8mSWa_-RiU2Y8-XEy3g-Fep3z6dhDeM3KazP58jDRgbdB5cVpDcIEWL"}, %{"body" => message})
Bump.FCM.push(n)
%{status: 'cheese'}
end
end