Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

πŸ“¦ Creating payloads

Matthijs Logemann edited this page Apr 13, 2017 · 1 revision

After you have the VaporAPNS instance, we can go ahead and create an notification payload. There are multiple quick ways to create a push notification payload. Let's look at a few of them down below.

πŸ’‘ Notification Types

Body Only

The most simple notification just contains a body message:

let payload = Payload(message: "Your push message comes here")

Title and Body

let payload = Payload(title: "Title", body: "Your push message comes here")

Hidden push notification

You can create a content-available push payload using:

let payload = Payload.contentAvailable

Advanced notifications

If you want a more advanced way of creating a push payload, you can create the Payload yourself: (This example creates a localized push notification with Jena and Frank as passed arguments)

let payload = Payload()
payload.bodyLocKey = "GAME_PLAY_REQUEST_FORMAT"
payload.bodyLocArgs = [ "Jenna", "Frank" ]

The possibilities are endless!