ericlathrop
Firebase_cloud_messaging_http_v1_api - Send Firebase Cloud Messaging Push Notifications via the FCM HTTP v1 API
I needed to send push notifications to a mobile app from my elixir server. I wanted to use Firebase Cloud Messaging’s “topics” so I didn’t have to keep track of every individiual device’s token, which requires using the newer FCM HTTP v1 API. All the other libraries I found on hex (like Pigeon) used the deprecated Legacy HTTP protocol. Versions of this code have been in production since April 2019.
From the README:
FirebaseCloudMessagingHttpV1Api
Send Firebase Cloud Messaging Push Notifications via the FCM HTTP v1 API.
Use goth to acquire authentication tokens.
Example
{:ok, %Goth.Token{token: token}} =
Goth.Token.for_scope("https://www.googleapis.com/auth/firebase.messaging")
%Google.Firebase.FCM.V1.Message{
notification: %Google.Firebase.FCM.V1.Notification{
title: "notification title",
body: "notification body"
},
android: %Google.Firebase.FCM.V1.AndroidConfig{
priority: "HIGH",
ttl: "86400s",
notification: %Google.Firebase.FCM.V1.AndroidNotification{
channel_id: "my-android-channel"
}
},
topic: "my-topic"
}
|> Google.Firebase.FCM.V1.Message.send("projects/my-firebase-project", token)
Popular in Libraries
I feel kind of stuck with the absence of a proper xml library for Elixir. Currently I use SweetXML which was ok for me more or less to pa...
New
Hello there,
I would like to share a feature toggles library (AKA feature flags) I’ve been working on.
The main package is FunWithFlags...
New
Dune is a sandbox for Elixir and aims to safely evaluate user-provided code.
You can try it out using this basic Elixir playground made ...
New
Leverage Open Api 3.0 (Swagger) to document, test, validate and explore your Plug and Phoenix APIs.
Generate and serve a JSON Open API ...
New
What is ContEx?
A pure Elixir server-side data plotting/charting library outputting SVG.
It has nice barcharts in particular and works g...
New
Only 650 LOC, wrote for fun :slight_smile:
New
Experimenting with this code.
OK.try do
user <- fetch_user(1)
cart <- fetch_cart(1)
order = checkout(cart, user)
save_or...
New
Bandit is an HTTP server for Plug and WebSock apps.
Bandit is written entirely in Elixir and is built atop Thousand Island. It can serve...
New
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application.
This library uses Erlang esaml to provide
plug enabl...
New
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components.
We also have a boi...
New
Other popular topics
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
New
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Hi,
I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New








