Skip to content

droduit/webpush-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WebPush API

How to use

const API_URL = "https://dominique.leroduit.com/webpush/api.php";

var bodyObj = {
  subscriber: {
    endpoint: 'https://fcm.googleapis.com/fcm/send/f62gDWNV8No:APA91bHZ5A0tK9HgSEf7Yj_oGNa85lIKeedzucTkZ4dXY4_1GDQMnG1lEnK46aQviptKWjEZnlnPiyrjnatgsvCM3P3ZbXwzcEfVxewqQrLlBH8T1ZbHIcURinQHuyzGQqYe_uCDNM5c',
    authToken: "x2-Wy6YXaGlU5ABWd9YIzA",
    publicKey: "BJq90fq61XXV0tle4eL64g07xtmBscYN6fFHQbOk04anGNlwaQDVRTy7HgHuX_jnCEN7BRrkb-LjYqPffQ5Atvs",
  },
  notification: {
    title: "Titre de la notification",
    body: "Message de la notification"
  }
}

JS

fetch(API_URL, {
    method: 'POST',
    body: JSON.stringify(bodyObj)
}).then(function(response) {
    return response.json();
}).then(function(data) {
    console.log(data.status, data.message);
});

JQuery

$.post(API_URL, bodyObj, function(data) {
  console.log(data);
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors