Enbbox Docs

Apple Push Notification Service (APNs)

Integrate Apple Push Notification service (APNs) with Enbbox. Setup guide with p8 key, team ID, and bundle ID configuration for iOS push notifications.

Overview

Apple Push Notification Service (APNs) is Apple's platform for delivering push notifications to iOS, macOS, watchOS, and tvOS devices.

[!IMPORTANT] APNs requires an Apple Developer account ($99/year) and either a .p8 authentication key or a .p12 certificate.

Prerequisites

  • An Apple Developer Program membership
  • An app with push notification capability enabled
  • Your app registered with a Bundle ID in the Apple Developer portal

Step 1: Create an APNs Authentication Key (.p8)

The .p8 key is recommended — it never expires and works for all apps in your team.

  1. Go to developer.apple.com/account/resources/authkeys
  2. Click the + button to create a new key
  3. Enter a key name (e.g., "Enbbox Push")
  4. Check Apple Push Notifications service (APNs)
  5. Click ContinueRegister
  6. Download the .p8 file — you can only download it once

You'll also need:

Step 2: Connect to Enbbox

  1. Navigate to Integrations in the Enbbox dashboard
  2. Click Add Provider → select PushAPNs
  3. Enter your credentials:
    • Private Key — paste the contents of the .p8 file
    • Key ID — the 10-character key identifier
    • Team ID — your Apple Developer Team ID
    • Bundle ID — your app's bundle identifier (e.g., com.myapp.ios)
  4. Select Environment: sandbox for development, production for App Store builds
  5. Click Test Connection to verify
  6. Activate the integration

[!WARNING] Use sandbox for development/TestFlight builds and production for App Store releases. Using the wrong environment will cause silent delivery failures.

Step 3: Register Device Tokens

In your iOS app, request push permission and register the device token:

// AppDelegate.swift
func application(_ application: UIApplication,
    didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
    // Send this token to your backend
}

Store it in Enbbox:

import { SubscriberCredentialsApi, Configuration } from "@enbbox/api";

const config = new Configuration({ accessToken: "your-api-key" });
const credentialsApi = new SubscriberCredentialsApi(config);

await credentialsApi.setCredentials("subscriber-123", "apns", {
  credentials: { device_tokens: [token] },
});

Step 4: Send a Test Notification

import { EventsApi, Configuration } from "@enbbox/api";

const config = new Configuration({ accessToken: "your-api-key" });
const eventsApi = new EventsApi(config);

await eventsApi.triggerEvent({
  name: "appointment-reminder",
  to: { subscriberId: "subscriber-123" },
  payload: {
    title: "Appointment Tomorrow",
    body: "Your appointment is scheduled for 10:00 AM",
  },
});

Troubleshooting

IssueSolution
BadDeviceTokenToken was generated for different environment (sandbox vs production)
ExpiredProviderTokenYour .p8 key is correct but check Team ID and Key ID
TopicDisallowedBundle ID doesn't match the app's push entitlement
Notification not receivedEnsure the device has granted push permission

On this page