Skip to main content

Push Notifications

Push needs credentials for each platform you send to. Set up each platform you ship on in the Arsel Dashboard under Push > Setup.

PlatformWhat you supplyWhere it comes from
AndroidA Firebase service-account JSONYour own Firebase project
iOSAn APNs auth key (.p8) plus its Key ID, your Team ID and your bundle IDApple Developer
WebThe origins allowed to register devicesNothing external — Arsel generates the keys
Quick Start
  1. Set up the platforms you ship on, using the sections below.
  2. Copy your client key (pub_…) and give it to whoever integrates the SDK.

Credentials​

Arsel sends with the credentials you upload, so device tokens you already hold keep working after you migrate. Revoking the service account key or the APNs key stops Arsel sending immediately, without involving support. FCM quota is your project's.

iOS and Firebase​

Arsel sends to Apple directly. There is no Firebase project in the iOS path: you upload one .p8 key. If your app runs Firebase Messaging for other reasons, it does not conflict; Arsel ignores its token.

Before You Start​

You need, for each platform you send to:

  • Android — a Firebase project with your app registered, and Owner or Editor access to the underlying Google Cloud project, enough to create a service account.
  • iOS — an Apple Developer account, and the ability to create a key under Certificates, Identifiers & Profiles.
  • Web — nothing external; see Web Push below.

Android​

Step 1 — Enable the Firebase Cloud Messaging API​

A new Firebase project does not always have the v1 messaging API switched on.

  1. Open the Google Cloud console and select your Firebase project from the project dropdown.
  2. Go to APIs & Services > Library.
  3. Search for Firebase Cloud Messaging API and click Enable.

If it already reads "Manage" rather than "Enable", it is on.

Step 2 — Create a service account key​

  1. In the Google Cloud console, go to IAM & Admin > Service Accounts.
  2. Either use the existing firebase-adminsdk-… account Firebase created, or click Create Service Account and give it a descriptive name such as arsel-push-sender.
  3. Grant it a role that includes the cloudmessaging.messages.create permission. The predefined Firebase Cloud Messaging API Admin role covers it, or use a custom role with only that permission.
  4. Open the account, go to Keys > Add Key > Create new key, choose JSON, and download the file.
The JSON file is a credential

Anyone holding it can send push notifications through your Firebase project. Do not commit it to source control or email it around. Upload it to Arsel and then delete your local copy.

The file must contain project_id, client_email, and private_key. Arsel rejects the upload if any are missing.

Step 3 — Upload it to Arsel​

  1. In the Arsel Dashboard, go to Push > Setup.
  2. Under Android, upload the JSON file.

Arsel validates the credential against FCM immediately. The first validated credential switches Android on.

If validation fails, the usual causes are:

SymptomCause
Authentication rejectedThe Firebase Cloud Messaging API is not enabled (Step 1)
Permission deniedThe service account lacks cloudmessaging.messages.create
File rejected on uploadThe JSON is missing project_id, client_email, or private_key

Rotating the key​

Upload a replacement from the same screen. The previous credential keeps serving in-flight sends until the new one validates, so rotation has no downtime. Revoke the old key in Google Cloud once the new one is active.


iOS​

The APNs auth key is a single .p8 file. It does not expire, and one key serves every app in your developer team.

Step 1 — Create the key​

  1. In the Apple Developer portal, go to Certificates, Identifiers & Profiles > Keys.
  2. Click +, name the key (e.g. Arsel Push), and tick Apple Push Notifications service (APNs).
  3. Register it and download the .p8.
Apple lets you download a .p8 exactly once

Save it somewhere durable before you leave the page. If you lose it, revoke the key and create a new one.

The key is team-wide: it can send to every app in your developer account. Do not commit it to source control or email it around.

Step 2 — Collect the three identifiers​

ValueWhere to find it
Key IDShown next to the key in the Keys list — 10 characters
Team IDTop-right of the Apple Developer portal, or your membership page — 10 characters
Bundle IDYour app's bundle identifier, e.g. com.example.app

Step 3 — Upload it to Arsel​

In Push > Setup, under iOS, upload the .p8 and fill in the three identifiers.

Arsel validates the key, the team and the bundle ID against Apple immediately.

SymptomCause
Bundle ID rejected (TopicDisallowed)The bundle ID does not match an app in this team, or the key belongs to a different team
Key rejected (InvalidProviderToken)The Key ID or Team ID does not match the uploaded .p8, or the key lacks the APNs capability

Debug builds vs the App Store​

Apple runs two hosts: sandbox for development builds, and production for TestFlight and the App Store. A token minted for one is rejected by the other. There is nothing to configure: the same .p8 authenticates against both, and the Arsel SDK reports at registration which host its build was signed for.

Rotating the key​

Upload a replacement from the same screen. The outgoing key keeps serving in-flight sends until the new one validates, so rotation has no downtime. Revoke the old key in the Apple Developer portal once the new one is active.


Web Push​

Web Push uses the browser's Web Push standard with VAPID keys, which Arsel generates. It does not use Firebase, and the private key never leaves the server.

  1. In Push > Setup, enable Web Push.
  2. Add your allowed origins — every domain that may register devices, e.g. https://shop.example.com.
  3. Choose your signing keys: let Arsel generate a keypair (the default), or import an existing one if you are migrating (see below).

Arsel signs each push with its own VAPID contact, so you don't supply a contact address.

Origins are an allowlist, and it fails closed

A client key from an origin that is not on the list is rejected. An empty allowlist denies everything.

Include every origin you serve from. Apex and www are different origins, and so are staging domains and http://localhost:4200 during development.

Your page must be served over HTTPS. http://localhost is the browser's one exemption, for local development.

Migrating an existing web audience​

If you already send web push through another provider, import your existing VAPID keypair instead of letting Arsel generate one. Choose Import my existing keypair when you provision Web Push, and paste both halves.

A browser binds each subscription to the applicationServerKey it was created with, and the push service checks every send against that key. If you provision a different key, every existing subscription stops receiving pushes, with no error at setup. Browsers won't prompt those users again, so they stay unreachable until they return to your site and re-subscribe.

Arsel verifies the two halves are a matching pair before storing them.

Once provisioned, the keypair is fixed

Importing is only available the first time you provision Web Push, because overwriting a live key would strand the subscriptions bound to it. If a key has to change later, use Rotate VAPID keypair, which keeps the outgoing key serving existing subscribers during a grace period.


Handing off to your developers​

Once push is configured, your integration team needs:

WhatWhere to find it
Client key (pub_…)Push > Setup. Publishable — safe to ship in app code.
API key (be_…)Integrations > API keys. Secret — server-side only.
SDK installation guidesThe Client SDKs overview
Server-side endpointsThe Push API reference

Sending​

Push targets a contact: a send reaches every active device registered to that contact. A device must be bound to a contact (by the SDK's identify() call or by Register Device) before it can be targeted.

Transactional — POST /push/send sends one notification to one contact:

curl -X POST "https://api.arsel.sa/v1/push/send" \
-H "Authorization: Bearer $ARSEL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: shipment-7731-out-for-delivery" \
-d '{
"external_id": "user_8821",
"title": "Your order shipped",
"body": "Order A-1023 is on its way — arriving Thursday.",
"deep_link": "myapp://orders/A-1023"
}'

202 means queued. GET /push/:id reports how many of the contact's devices the push provider accepted it for.

Campaigns: create a draft, target it with list_ids, tag_ids or segment_ids (optionally narrowed with target_platforms), then send or schedule.

Two things to know:

  • There is no transactional exemption. A contact who opted out of push, or whose devices are no longer deliverable, cannot be reached by either path; POST /push/send returns 403. Use email or SMS for essential service messages.
  • Delivered, opened and clicked are reported by the SDK on the device. Devices registered server-side without an embedded SDK receive notifications but report nothing back. See Client SDKs.

Migrating from another push provider​

Mobile​

Because the Firebase sender and the Apple key stay yours, your existing device tokens remain valid:

  1. Export your current tokens, each with the contact identifier it belongs to.
  2. Import them 1,000 at a time with Bulk Register Devices, omitting sdk_version. The import runs in the background; poll each job for its status and per-row errors to reconcile against your export.
  3. Those devices are immediately sendable and render notifications natively.
  4. When you later ship a build embedding the Arsel SDK, it adopts the imported device rather than creating a duplicate.

Imported devices receive notifications but report no delivery or engagement data until the SDK is embedded. See the warning in Client SDKs.

Check which token type your iOS export contains

Arsel sends to iOS through Apple directly, so an imported ios device must carry an APNs device token. If your previous provider relayed iOS through Firebase, your export holds FCM registration tokens, which Apple can't use and which can't be imported as iOS devices. Those users re-register on their own once they open a build carrying the Arsel SDK.

Exports from providers that take your APNs key or certificate directly (CleverTap among them) hold real APNs tokens and import cleanly.

If any exported tokens came from development builds, send apns_environment: the default is production, and Apple's production host rejects sandbox tokens.

Web​

Web subscriptions are bound to their signing key, so you carry over the key rather than tokens. Import your existing VAPID keypair when you provision Web Push; see Migrating an existing web audience.