Skip to main content

Setup

You will need a Pusher Beams account with an instance configured. In Courier, navigate to the Pusher Beams Integration page, enter your instance ID and secret key, then click “Save.”

Profile Requirements

Pusher Beams can send to either users or interests. At least one mode out of web, apns, or fcm is required.

Send to interests

{
  "message": {
    "to": {
      "pusherBeams": {
        "interests": ["interest-1", "interest-2"],
        "mode": ["apns", "fcm"]
      }
    }
  }
}

Send to users

{
  "message": {
    "to": {
      "pusherBeams": {
        "userIds": ["user-id-1", "user-id-2"],
        "mode": ["apns", "fcm"]
      }
    }
  }
}

Overrides

Body Overrides

Overrides can be used to change the request body that Courier sends to Pusher Beams’ API.
{
  "message": {
    "template": "NOTIFICATION_TEMPLATE_ID",
    "to": {
      "pusherBeams": {
        "interests": ["interest-1"],
        "mode": ["fcm"]
      }
    },
    "providers": {
      "pusher-beams": {
        "override": {
          "body": {
            "fcm": {
              "notification": {
                "title": "Custom Title",
                "body": "Custom body text"
              }
            }
          }
        }
      }
    }
  }
}

Config Overrides

You can swap the instance ID or secret key at send time:
{
  "message": {
    "template": "NOTIFICATION_TEMPLATE_ID",
    "to": {
      "pusherBeams": {
        "interests": ["interest-1"],
        "mode": ["fcm"]
      }
    },
    "providers": {
      "pusher-beams": {
        "override": {
          "config": {
            "instanceId": "RUNTIME_INSTANCE_ID",
            "secretKey": "RUNTIME_SECRET_KEY"
          }
        }
      }
    }
  }
}