Skip to content

fix(in-app): send app identifier header to gist - #812

Merged
mrehan27 merged 3 commits into
mainfrom
inapp-14655-app-identifier-header
Aug 21, 2026
Merged

mrehan27 merged 3 commits into
mainfrom
inapp-14655-app-identifier-header

Conversation

@mrehan27

@mrehan27 mrehan27 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

https://linear.app/customerio/issue/INAPP-14655/mobile-add-app-identifier-header-for-app-filtering

Summary

Gist needs to know which app a request came from so the backend can filter messages by platform and app. The SDK now sends the host app's package name as X-CIO-Client-App-Identifier alongside the platform header it already sends.

The header is added in NetworkUtilities.addCommonHeaders, whose only two callers are the queue fetch client (Queue.createHttpClient) and the SSE connect interceptor (SseService.createSseHttpClient) — so one header set rides fetch and SSE alike. No query-parameter variant is needed on mobile: native SSE clients set headers, and only gist-web passes platform=web as a query param because browser EventSource cannot.

Changes

  • X-CIO-Client-App-Identifier: <package name> on every gist request, sourced from applicationStore.customerPackageName.
  • The test spells the wire name out instead of reading the constant, so a rename of the constant value cannot pass silently.
  • Hoisted the repeated SDKComponent.android() lookup into a local and grouped the client/app headers together.

Wrappers

React Native, Expo and Flutter all initialize the native SDK with the host Application (reactContext.applicationContext / the plugin's application), so the header carries the host app's applicationId, not a wrapper id. The platform header still reports the wrapper (e.g. reactnative-android). A test locks this in by overriding the SDK source and asserting the app identifier is unchanged.

Note for backend registration: on Android this value is the Gradle applicationId, so it picks up per-variant suffixes (e.g. applicationIdSuffix ".debug").

Test plan

  • New NetworkUtilitiesTest covers the fetch variant, the SSE variant (includeUserToken = false), and the wrapper-source case.

  • :messaginginapp:runJacocoTestReport — 522 tests, 0 failures. ktlint and apiCheck clean (the constant is internal, so no public API change).

  • Verified on a Pixel 10 Pro emulator (API 36, kotlin_compose sample) with a temporary header probe, since the SDK has no request logging. Both requests carried the header:

    fetch /api/v4/users -> X-CIO-Client-App-Identifier: io.customer.android.sample.kotlin_compose
    sse   /api/v3/sse   -> X-CIO-Client-App-Identifier: io.customer.android.sample.kotlin_compose
    

    The sample workspace does not return X-CIO-Use-SSE: true, so the SSE flag was forced locally to make the connect fire. Both the probe and the forced flag were reverted before committing.

🤖 Generated with Claude Code


Note

Low Risk
Additive, internal header on existing Gist clients with unit coverage; no changes to auth, tokens, or public API.

Overview
Gist in-app traffic now includes X-CIO-Client-App-Identifier on every request that uses NetworkUtilities.addCommonHeaders (queue fetch and SSE connect). The value is the host app’s applicationStore.customerPackageName (Gradle applicationId), so backend filtering can distinguish apps while the existing platform header still reflects wrapper sources like reactnative-android.

addCommonHeaders also hoists a single SDKComponent.android() lookup and groups the client metadata headers together. NetworkUtilitiesTest asserts the wire header name and value for fetch, SSE (includeUserToken = false), and a React Native–style client override where the app id stays the host package.

Reviewed by Cursor Bugbot for commit 6fb0e9d. Bugbot is set up for automated code reviews on this repo. Configure here.

Gist needs to know which app a request came from so the backend can filter
messages by platform and app. Send the host app's package name as
X-CIO-App-Identifier alongside the existing platform header, from the shared
header builder so both the queue fetch and the SSE connect carry it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mrehan27
mrehan27 requested a review from a team as a code owner August 12, 2026 10:00
@mrehan27 mrehan27 self-assigned this Aug 12, 2026
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

Sample app builds 📱

Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.


  • java_layout: inapp-14655-app-identifier-header (1787131355)
  • kotlin_compose: inapp-14655-app-identifier-header (1787131355)

Commit 6ddda9b · CI run

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.43%. Comparing base (b5cf24d) to head (6ddda9b).
⚠️ Report is 35 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #812      +/-   ##
============================================
- Coverage     69.07%   66.43%   -2.64%     
- Complexity      838     1539     +701     
============================================
  Files           149      245      +96     
  Lines          4601     8765    +4164     
  Branches        628     1443     +815     
============================================
+ Hits           3178     5823    +2645     
- Misses         1189     2482    +1293     
- Partials        234      460     +226     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown

Build available to test
Version: inapp-14655-app-identifier-header-SNAPSHOT
Repository: https://central.sonatype.com/repository/maven-snapshots/

@mrehan27 mrehan27 changed the title chore(in-app): send app identifier header to gist fix(in-app): send app identifier header to gist Aug 12, 2026
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

📏 SDK Binary Size Comparison Report

Module Last Recorded Size Current Size Change in Size
core 45.66 KB 45.66 KB ✅ No Change
datapipelines 42.67 KB 42.67 KB ✅ No Change
messagingpush 71.44 KB 71.44 KB ✅ No Change
messaginginapp 148.53 KB 148.66 KB ⬆️ +0.13KB
messaginginbox 60.46 KB 60.46 KB ✅ No Change
tracking-migration 22.89 KB 22.89 KB ✅ No Change
location 18.93 KB 18.93 KB ✅ No Change
geofence 85.77 KB 85.77 KB ✅ No Change

…ifier

Aligns with the X-CIO-Client-* naming the other client headers use. The test
now spells the wire name out instead of reading the constant, so a rename of
the constant's value cannot slip through.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mrehan27
mrehan27 merged commit bbd5616 into main Aug 21, 2026
49 of 50 checks passed
@mrehan27
mrehan27 deleted the inapp-14655-app-identifier-header branch August 21, 2026 09:07
cio-mobile-release Bot pushed a commit that referenced this pull request Aug 21, 2026
## [4.20.2](4.20.1...4.20.2) (2026-08-21)

### Bug Fixes

* **in-app:** send app identifier header to gist ([#812](#812)) ([bbd5616](bbd5616))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants