To send a push notification through your WordPress site, you must have AppPush activated and configured.  You must also have your app configured for push notifications, and a Pushwoosh account with API access. 

Sending notifications on publish of selected post types

Note: You will need to have your Pushwoosh credentials set up before metaboxes on your selected post types will show up.

Once you have set up your Pushwoosh account and have your API credentials saved, you'll be able to start sending out push notifications on new postings of your selected post types. When you go to add a new post, you will see a new meta box in the upper right portion of your screen. The meta box is not going to show up on already published posts.

The contents of the push notification depends on what parts you have set in the post. The primary part of the notification content is going to be the post title, and will always be included as part of it. If your post type supports excerpts, you can set the post_excerpt value and that will be appended to the title as part of the resulting notification.


AppPush New Post screenshot


New post with a meta box to send a notification, upon publish, in the upper right.


Sending segmented notifications


To allow users to receive notifications from only certain categories or taxonomies, you can enable 'Segmented Notfications' from the AppPresser settings page > Notification tab.



[appp-notification-signup] shortcode


When segmented notifications is enabled, sending notifications from new posts will now only send notifications to users who have elected to do so.  You will now need a why to allow users to select which categories to subscribe.


Add this shortcode you any page:


[appp-notification-signup show_headers="yes"]


To send a notification to a specific category, visit AppPresser->Notifications and choose a category before publishing your notification. (You can also choose to send the push to everyone instead.)



Sending custom notifications

If you are needing to send out a notification that isn't tied to any specific content publishing, there is a post type available under AppPresser->Notifications that you can publish to or programmatically hook into with an extension. There will only be a title field and an excerpt meta box available. Upon publish of a post in this post type, the notification will be sent out.



You can add a title, body text, and an optional custom url.


Custom URL

If you leave this field blank, clicking a notification will open the app homepage.

External url - if you add an external url, such as http://google.com, this url will open in an external web browser.

App url - if you add a url to a page in your app, clicking the notification will open a specific page in the app. For example, if your app is on the domain http://myapp.com, you could add the url http://myapp.com/pageand it would open that page in the app.  Be sure that your URL includes your domain and you are not using a relative path.


Filter Push Content

You filter the content by using the filter add_filter( 'send_push_post_content' )

Example on customizing the push content for a specific custom post type:


function send_custom_push( $message, $post_id, $post ) {      
if( 'apppush' === $post->post_type ) {         
$message = 'My custom push message';     
}      
return $message;  
} 
add_filter( 'send_push_post_content', 'send_custom_push', 10, 3 );

This filter overrides the content of the push notification, only when sent through WordPress. This will not affect pushes sent through Pushwoosh.