Push notifications
Connect APNs or Firebase, register devices, and handle reply and campaign notifications in your app.
AAgent44Updated 3 min read
On this page
In one minute#
agent44 sends two kinds of push notification to your iOS and Android apps:
Replies: a teammate or the AI agent answered the user's conversation.
Campaigns: a push notification you send from Engagement to everyone or a segment, now or at a scheduled time.
iOS apps get them through Apple Push Notification service (APNs) and Android apps through Firebase Cloud Messaging (FCM). You upload your credentials once per app; your app registers each device's token with agent44. Web apps don't get push.
1. Set up credentials#
Open Settings › Apps, then the app. Its Push notifications section takes:
Platform | What to upload |
|---|---|
iOS | An APNs key (the |
Android | A Firebase service account JSON key. In the Firebase console, open Project settings › Service accounts and choose Generate new private key. Use the Firebase project your app's |
agent44 checks the credentials with Apple or Firebase before saving them; credentials that don't work aren't saved. Then:
Send test push sends a notification to one of the app's most recently registered devices, so register a device first (step 2).
Check again re-checks saved credentials. If Apple or Firebase later rejects them, push for that app stops and the panel shows the error until you check again or upload new ones.
Turn off push stops sending for the app.
Replies are pushed by default; turn them off in Settings › Inbox › General (Push replies to users). Users without push still get an email if they haven't read a reply after a few minutes.
2. Register the device#
Call POST /v1/push/devices with the app's key and the user's identity headers:
at every launch, once you have a token;
whenever the token changes (
didRegisterForRemoteNotificationsWithDeviceToken,FirebaseMessagingService.onNewToken);right after sign-in, with the user's id, so the device follows the user.
{ "token": "a1b2c3…", "environment": "production", "app_version": "4.2.0", "locale": "en-GB", "enabled": true }iOS: send the APNs token as hex, and
environment:sandboxfor development builds,productionfor TestFlight and the App Store. A wrong environment means Apple refuses every push to the device.Android: send the FCM registration token; leave
environmentout.Send
enabled: falsewhen the user has turned notifications off, andtrueagain when they turn them back on.
At sign-out, call DELETE /v1/push/devices with {"token": "…"} before you forget the user id. Register again with the new anonymous id if the device should keep getting campaigns.
Every field and response is in the Push API.
3. What arrives#
Every agent44 notification carries an a44_type key. Ignore notifications without one: they're your app's own.
iOS (APNs):
{
"aps": { "alert": { "title": "Sam from Akmi", "body": "That's fixed in 4.2.1" }, "sound": "default", "thread-id": "a44-conversation-…" },
"a44_type": "reply",
"a44_conversation_id": "6f1c…",
"a44_message_id": "9a2b…"
}Android (FCM): a notification message with title and body, and the same keys in data:
{ "a44_type": "campaign", "a44_message_id": "6f1c…", "a44_url": "myapp://offers" }On iOS, replies are grouped by conversation (thread-id). On Android, a repeat of the same notification replaces the earlier one. In the background it uses your default notification channel; set com.google.firebase.messaging.default_notification_channel_id in your manifest to choose it.
Key | Meaning |
|---|---|
|
|
|
|
|
|
|
|
4. Handle taps#
reply: open your support screen ona44_conversation_idand load it withGET /v1/conversations/{id}.campaign: opena44_urlif there is one, otherwise bring the app to the front. Then report the open, which counts as "Opened" in the campaign's stats:
POST /v1/prompts/<a44_message_id>/events
{ "type": "clicked" }While the user is looking at the conversation a reply belongs to, don't show the banner: the message appears in the thread on the next poll.
Text in notifications is plain: never render title or body as HTML or Markdown.
Campaigns#
Create a campaign in Engagement with the type Push notification: write the title and body, pick the apps, platforms, versions and segment it goes to, add an optional link, and send it now or schedule it. The form shows an estimate of how many devices it will reach. Each device gets a campaign at most once, and the campaign's page shows how many were sent and opened.