Skip to content

Instantly share code, notes, and snippets.

@kouheiszk
Created April 28, 2020 07:00
Show Gist options
  • Save kouheiszk/715e6bf3cee13e6aa613b0fff587bcc2 to your computer and use it in GitHub Desktop.
Save kouheiszk/715e6bf3cee13e6aa613b0fff587bcc2 to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
require "fcm"
require "pry"
server_key = ENV.fetch("FCM_SERVER_KEY")
fmc_token = ENV.fetch("FCM_TOKEN")
client = FCM.new(server_key)
result = client.send_with_notification_key(
fmc_token,
data: {},
notification: {
title: "今日の天気予報",
body: "今日は地域によっては夕方から雨になるそうです。",
sound: :default,
},
content_available: true,
mutable_content: true,
priority: :high,
)
puts result
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "fcm"
gem "pry"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment