Swiftpack.co -  Package - nodes-vapor/push-urban-airship
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Send push notifications using Urban Airship ✉ïļ
.package(url: "https://github.com/nodes-vapor/push-urban-airship.git", from: "2.0.2")


Swift Version Vapor Version Circle CI codebeat badge codecov Readme Score GitHub license

Send push notifications with Urban Airship for Vapor.

ðŸ“Ķ Installation

Install package using SPM

Update your Package.swift file.

Swift 3

.Package(url: "https://github.com/nodes-vapor/push-urban-airship.git", majorVersion: 2)

Swift 4

.package(url: "https://github.com/nodes-vapor/push-urban-airship.git", .upToNextMajor(from: "2.0.1"))
targets: [
        name: "App",
        dependencies: [


Create config file uapusher.json with following syntax

    "applicationGroups": {
        "defaultGroup": {
            "development": {
                "appKey": "yyyy",
                "masterSecret": "yyyy"
            "staging": {
                "appKey": "yyyy",
                "masterSecret": "yyyy"

You can define multiple apps like in the example. Else just delete one of groups.

Getting started 🚀

Set up the provider:

import UAPusher

try config.addProvider(UAPusher.Provider.self)

Simple example

let body = try JSON(node: [
    "audience": "all",
    "device_types": [
    "notification": [
        "alert": "hello world"
let request = UARequest(body: body)

do {
    let response = try drop.uapusher?.send(request: request)
    if response.status == .accepted {
        print("Push sent..")
} catch UAError.response(let uaResponse) {
    // let response = uaResponse.response[0]

The above example will send a text push notification with the message hello world to all users on the ios platform.

Chain your payload

This package offers a way to easily customize the different segments of the payload sent to Urban Airship, using the UABuilder class.

let payload: JSON = try UABuilder()
    .add(Notification(.alert(value:"this is a test")))
let request: UARequest = UARequest(body: payload)

You can also provide all segments in a list

let payload: JSON = try UABuilder().add([
    Notification(.alert(value:"this is a test"))
let request: UARequest = UARequest(body: payload)

The above examples will define a text push notification with the message this is a test to all users.

UABuilder currently lets you set audience, campaigns, device_type, ÃŽn_app, message and notification. Method overloads allow you to set the payload segments directly using custom JSON or using a preset value. For more information see the Urban Airship documentation about the push object or check out the full api documentation.

🏆 Credits

This package is developed and maintained by the Vapor team at Nodes. The package owner for this project is Rasmus.

📄 License

This package is open-sourced software licensed under the MIT license.


Stars: 6
Last commit: 3 years ago


Release Notes

Version 2.0.2
3 years ago


  • Stop resolving client from droplet.json and start using FoundationClientFactory() right away.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco