Giter Club home page Giter Club logo

wp-push-notifications-for-posts's Introduction

Push Notifications For Posts (pn4p)

WordPress plugin for handling devices registration and sending push notifications when posts are added/updated

Building

Before using the plugin build the actual sender component (push-notif-sender, you'll need Go SDK):

go build push-notif-sender.go

Installation

Zip the folder containing index.html, push-notif-for-posts.php and push-notif-sender binary and upload/install it on WordPress. You may need to enable uploading large files in PHP config for your server.

Configuration

After installation and activation, plugin is available in WordPress side menu.

Before using the plugin, you should provide your FCM Server Key.

Usage (Mobile apps)

After installation and activation, plugin exposes endpoint that mobile apps use for registration. App can call this endpoint whenever it wants.

POST http://www.example.com/?rest_route=/pn4p/v1/token

Parameters:

Parameter Value
token Device token
platform ios or android
device Device Name, e.g. Galay S8

Successful registration response:

{
	"success": true,
	"message": "Token registration successful"
}

Error response:

{
	"code": "rest_invalid_param",
	"message": "Invalid parameter(s): platform",
	"data": {
		"status": 400,
		"params": {
			"platform": "Invalid parameter."
		}
	}
}

Push notification delivered to a device will have payload like this:

{
	"type": "post_notification",
	"post": {
		"id": 55,
		"slug": "some-post-title",
		"title": "Some Post Title",
		"summary": "Post sumarry here",
		"photo": "http://example.com/wor2-07-16-29-12.png"
	}
}

Usage (Plugin UI)

  • Settings tab exposes plugin settings.
  • Registrations tab shows list of registrations.
  • Log tab shows message log from push-notif-sender binary after post is created or updated.

When creating or editing post, check Send Push Notifications option in the Publish WordPress menu if you want to send push notifications for that post. Note that failed deliveries of push notifications to certain devices (e.g. due to expired token) will remove that devices from registrations untill devices register again.

wp-push-notifications-for-posts's People

Contributors

ealih avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.