Push notifications are authored in the Set Dashboard. After you create a notification, you’ll be able to configure a trigger that will determine when it’s fired off to your users.
Login and click on your configured client. Navigate to the “Notifications” tab in the left sidebar.
After clicking on “Create your first notification”, you’ll see a pre-populated JSON editor.
Sandbox versus Production
By default, all Clients you create are in Sandbox mode. This means that the Recipes and Notifications you create will work for the development versions of your apps. Sandbox mode clients will not work for production apps (TestFlight or App Store). We recommend you create 2 clients in your Set Dashboard, one for your development app and kept in Sandbox mode, and a second for your production app toggled to Production mode.
Each client will have separate Set ID and Secret pairs.
To toggle one client from Sandbox to Production mode, click the switch button in the upper right of the Overview tab.
Author a Notification
Give your notifications a name. We’ll call this one “Warning: Late arrival” because later we’ll set up a Recipe trigger to send this to any user that has arrived to work late. Provide the details of your notification via the “aps” field. All available options from Apple are supported. The descriptions for the APS Options below are taken from Apple’s documentation.
|name||string||The notification name. This will not be displayed to the user.|
|aps||dictionary||The details of your Notification. See “Notification APS Options” below.|
|Limits recipe-based triggering to a total count in the given past interval (sec) on a per user basis.
Notification APS Options
|alert||dictionary | string||Include this key when you want the system to display a standard alert or a banner. The notification settings for your app on the user’s device determine whether an alert or banner is displayed.
The preferred value for this key is a dictionary, the keys for which are listed in Table 9-2. If you specify a string as the value of this key, that string is displayed as the message text of the alert or banner.
The JSON \U notation is not supported. Put the actual UTF-8 character in the alert text instead. See “Notification Alert Options” below.
|“launch-image”||string||The filename of an image file in the app bundle, with or without the filename extension. The image is used as the launch image when users tap the action button or move the action slider. If this property is not specified, the system either uses the previous snapshot, uses the image identified by the UILaunchImageFile key in the app’s Info.plist file, or falls back to Default.png.|
|badge||number||Include this key when you want the system to modify the badge of your app icon.
If this key is not included in the dictionary, the badge is not changed. To remove the badge, set the value of this key to 0.
|sound||string||Include this key when you want the system to play a sound. The value of this key is the name of a sound file in your app’s main bundle or in the Library/Sounds folder of your app’s data container. If the sound file cannot be found, or if you specify default for the value, the system plays the default alert sound.|
|“content-available”||undefined | 1||Include this key with a value of 1 to configure a silent notification. When this key is present, the system wakes up your app in the background and delivers the notification to its app delegate.|
|category||string||Provide this key with a string value that represents the notification’s type. This value corresponds to the value in the identifier property of one of your app’s registered categories.|
Notification Alert Options
|body||string||The text of the alert message.|
|title||string||A short string describing the purpose of the notification. Apple Watch displays this string as part of the notification interface. This string is displayed only briefly and should be crafted so that it can be understood quickly. This key was added in iOS 8.2.|
|“loc-key”||string||A key to an alert-message string in a Localizable.strings file for the current localization (which is set by the user’s language preference). The key string can be formatted with %@ and %n$@ specifiers to take the variables specified in the loc-args array.|
|“loc-args”||string||Variable string values to appear in place of the format specifiers in loc-key.|
|“title-loc-key”||string||The key to a title string in the Localizable.strings file for the current localization. The key string can be formatted with %@ and %n$@ specifiers to take the variables specified in the title-loc-args array.|
|“title-loc-args”||string||Variable string values to appear in place of the format specifiers in title-loc-key.|
|“action-loc-key”||string||If a string is specified, the system displays an alert that includes the Close and View buttons. The string is used as a key to get a localized string in the current localization to use for the right button’s title instead of “View”.|
Click “Create” in the upper right-hand corner of the Dashboard when you’re happy with your notification.
Testing your Notification
It’s a good idea to test out your notifications to see how they’ll show up for your users. There are two ways to do this. In either case, you’ll need a user that has registered for notifications via the Set iOS SDK. This means they’ve given your app permission to send them notifications.
- Send a notification to all your users
- Click on the notification you want to test. In the upper right-hand corner, click on “Test”. In the dialog that appears, click “Send”.
- Send a notification to one user
- Navigate to the Users section under your client. Click on a user. If the user has registered for notifications, you’ll see a dropdown list of notifications to choose from. Choose one and click “Send Test”.
Now, send your first Notification using Recipes.
Get in touch
- If you need help, shoot us a message at firstname.lastname@example.org or ping us on our Slack community.
- If found a bug, or have a feature request, add an Issue on the SetSDK Repo.
- Follow us on Twitter for product updates: @everyset