Skip to content
/ fcm Public

Common Lisp Client for FCM - Firebase Cloud Messaging

License

Notifications You must be signed in to change notification settings

Junker/fcm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FCM

Common Lisp client for FCM - Firebase Cloud Messaging.

Installation

This system can be installed from UltraLisp like this:

(ql-dist:install-dist "http:https://dist.ultralisp.org/"
                      :prompt nil)
(ql:quickload "fcm")

Usage

(defvar *fcm* (fcm:make-client-with-service-account  "config/firebase.json"))
(defvar *token* "some-device-token")
(defvar *message*
  (list :|token| *token*
        :|notification| (list :|title| "Message Title"
                              :|body| "Message body"
                              :|image| "https://example.org/logo.jpg")))

(handler-case (fcm:send *fcm* *message*)
  (fcm:fcm-error (err)
    (case (intern (fcm:fcm-error-status err))
      ('NOT_FOUND
       (log:warn "unregistered FCM token: ~A" *token*))
      (t
       (log:error "FCM error: ~A: ~A; token: ~A" (type-of err) err *token*)))))

Documentation