Skip to content

camel-whatsapp: deprecate both documented headers, which nothing reads - #29958

Open
Dhairya-007 wants to merge 6 commits into
apache:mainfrom
Dhairya-007:fix/whatsapp-deprecate-unread-headers
Open

Dhairya-007 wants to merge 6 commits into
apache:mainfrom
Dhairya-007:fix/whatsapp-deprecate-unread-headers

Conversation

@Dhairya-007

Copy link
Copy Markdown
Contributor

Problem

WhatsAppConstants publishes exactly two headers, and the component reads neither - so the whole header table of camel-whatsapp documents headers that do nothing.

WhatsAppProducer.process takes nothing but the body:

// Tries to get a message in its OutgoingMessage format
// Automatic conversion applies here
BaseMessage message = exchange.getIn().getBody(BaseMessage.class);
ObjectHelper.notNull(message, "message");

final WhatsAppService service = endpoint.getWhatsappService();

LOG.debug("Message being sent is: {}", message);
LOG.debug("Headers of message being sent are: {}", exchange.getIn().getHeaders());

service.sendMessage(exchange, callback, message);

The headers are logged and then ignored. What actually carries each value is an option or a body field that already exists:

  • CamelWhatsAppPhoneNumberId duplicates the phoneNumberId path parameter. WhatsAppComponent sets it from the remaining URI (configuration.setPhoneNumberId(remaining)) and WhatsAppEndpoint passes configuration.getPhoneNumberId() to the service.
  • CamelWhatsAppRecipientPhoneNumberId duplicates the to field of the BaseMessage the body is converted to.

Neither constant appears anywhere else in the component, tests included. (A grep turns up WHATSAPP_PHONE_NUMBER_ID and WHATSAPP_RECIPIENT_PHONE_NUMBER in WhatsAppApiConfig and WhatsAppServiceIT, but those are environment variable names for the integration test, not these headers.)

Fix

Deprecate both constants, each with a deprecationNote naming what carries the value instead, so the catalog stops advertising them. The constants stay, so nothing stops compiling.

The regenerated whatsapp.json files are included.

WhatsAppConstants publishes exactly two headers and the component reads
neither; WhatsAppProducer takes nothing but the body:

    BaseMessage message = exchange.getIn().getBody(BaseMessage.class);
    ObjectHelper.notNull(message, "message");
    service.sendMessage(exchange, callback, message);

CamelWhatsAppPhoneNumberId duplicates the endpoint's phoneNumberId path
parameter, which WhatsAppComponent sets from the remaining URI and the
endpoint passes to the service, and CamelWhatsAppRecipientPhoneNumberId
duplicates the to field of the BaseMessage the body is converted to.
Neither name appears anywhere else in the component, including tests -
the matching test names are the WHATSAPP_PHONE_NUMBER_ID and
WHATSAPP_RECIPIENT_PHONE_NUMBER environment variables of the
integration test, which are unrelated.

So the whole header table of the component documents two headers that do
nothing. Deprecate both, with a note naming what carries the value.
@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. On main, WhatsAppProducer only logs the headers, and neither CamelWhatsAppPhoneNumberId nor CamelWhatsAppRecipientPhoneNumberId is read anywhere, now or in 3.20.0/4.0.0. The WHATSAPP_* hits in the tests are env vars, as you say. The notes are accurate: WhatsAppComponent sets phoneNumberId from the URI, and BaseMessage has to.

  1. WhatsAppEndpointBuilderFactory (dsl/camel-endpointdsl/src/generated/..., whatsAppPhoneNumberId() / whatsAppRecipientPhoneNumberId()) needs regenerating, as in #29709. Otherwise CI will likely flag uncommitted changes.
  2. Please add an entry to camel-4x-upgrade-guide-4_24.adoc for the two deprecated headers.

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

✅ Generated files are up to date

An earlier CI run reported uncommitted generated changes; the latest run no longer does.

@github-actions github-actions Bot added the dsl label Nov 14, 2026

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the Regen commit added @Deprecated and the notes to whatsAppPhoneNumberId() and whatsAppRecipientPhoneNumberId() in WhatsAppEndpointBuilderFactory, so the generated-files point is done.

  1. The upgrade-guide entry is still missing: please add one to docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc for CamelWhatsAppPhoneNumberId and CamelWhatsAppRecipientPhoneNumberId, telling users to set phoneNumberId on the endpoint URI and the recipient as to on the message body instead.

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-whatsapp
  • docs
  • dsl/camel-endpointdsl

🔁 1 test passed only after a retry on JDK 21 (1 retried attempt)

Recovered flaky tests on JDK 21 (1)
Module Test Failed attempts First failure
dsl/camel-jbang/camel-jbang-plugin-tui AiPanelAcpTest.aJsonRpcErrorKeepsTheSessionAlive 1 the second question reaches the same agent ==> expected: <2> but was: <1>

ℹ️ These tests did not fail the build. Surefire retried them and they passed.
Retries are enabled project-wide by surefire.rerunFailingTestsCount in parent/pom.xml.


🔬 Scalpel shadow comparison — Scalpel: 9 of 726 tested, 24 compile-only — current: 9 all tested

Maveniverse Scalpel detected 9 affected modules (current approach: 9).

Skip-tests mode would test 9 modules (4 direct + 8 downstream), skip tests for 24 (generated code, meta-modules)

Modules Scalpel would test (9)
  • camel-jbang-mcp ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-tui ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-validate ← downstream of org.apache.camel:camel-yaml-dsl-validator
  • camel-jbang-run ← downstream of org.apache.camel:camel-catalog
  • camel-launcher-container ← downstream of org.apache.camel:camel-launcher
  • camel-whatsapp ← components/camel-whatsapp/src/generated/resources/META-INF/org/apache/camel/component/whatsapp/whatsapp.json, components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConstants.java
  • camel-yaml-dsl-validator ← downstream of org.apache.camel:camel-catalog
  • camel-yaml-dsl-validator-maven-plugin ← downstream of org.apache.camel:camel-yaml-dsl-validator
Modules with tests skipped (24)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (36 modules, 4m 39s total)

Total reactor time: 4m 39s

Module Duration Status
Camel :: JBang :: Plugin :: TUI 39.5s SUCCESS
Camel :: JBang :: MCP 39.2s SUCCESS
Camel :: JBang :: Plugin :: Validate 21.1s SUCCESS
Camel :: YAML DSL 19.2s SUCCESS
Camel :: YAML DSL :: Validator 18.9s SUCCESS
Camel :: Component DSL 17.1s SUCCESS
Camel :: JBang :: Run 16.7s SUCCESS
Camel :: Catalog :: Camel Catalog 14.8s SUCCESS
Camel :: Docs 9.9s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 9.8s SUCCESS
Camel :: JBang :: Plugin :: Testing 9.5s SUCCESS
Camel :: Whatsapp 9.1s SUCCESS
Camel :: Kamelet Main 8.3s SUCCESS
Camel :: Catalog :: Camel Report Maven Plugin 6.2s SUCCESS
Camel :: JBang :: Plugin :: Generate 6.1s SUCCESS
Camel :: Catalog :: Camel Route Parser 5.2s SUCCESS
Camel :: YAML DSL :: Deserializers 5.0s SUCCESS
Camel :: All Components Sync point 3.2s SUCCESS
Camel :: YAML DSL :: Validator Maven Plugin 2.4s SUCCESS
Camel :: Catalog :: Maven 2.3s SUCCESS
Camel :: JBang :: Plugin :: Edit 2.2s SUCCESS
Camel :: Assembly 2.0s SUCCESS
Camel :: JBang :: Plugin :: MCP 2.0s SUCCESS
Camel :: YAML DSL :: Maven Plugins 2.0s SUCCESS
Camel :: Catalog :: Suggest (deprecated) 1.8s SUCCESS
Camel :: Coverage 1.1s SUCCESS
Camel :: Catalog :: Dummy Component 0.9s SUCCESS
Camel :: JBang :: Main 0.9s SUCCESS
Camel :: Endpoint DSL :: Support 0.7s SUCCESS
Camel :: JBang :: Integration tests 0.7s SUCCESS
Camel :: Catalog :: Console 0.6s SUCCESS
Camel :: Launcher :: Container 0.5s SUCCESS
Camel :: Endpoint DSL n/a
Camel :: Integration Tests n/a
Camel :: JBang :: Core n/a
Camel :: Launcher n/a

Top 20 slowest modules:

  • Camel :: JBang :: Plugin :: TUI (39.5s)
  • Camel :: JBang :: MCP (39.2s)
  • Camel :: JBang :: Plugin :: Validate (21.1s)
  • Camel :: YAML DSL (19.2s)
  • Camel :: YAML DSL :: Validator (18.9s)
  • Camel :: Component DSL (17.1s)
  • Camel :: JBang :: Run (16.7s)
  • Camel :: Catalog :: Camel Catalog (14.8s)
  • Camel :: Docs (9.9s)
  • Camel :: JBang :: Plugin :: Kubernetes (9.8s)
  • Camel :: JBang :: Plugin :: Testing (9.5s)
  • Camel :: Whatsapp (9.1s)
  • Camel :: Kamelet Main (8.3s)
  • Camel :: Catalog :: Camel Report Maven Plugin (6.2s)
  • Camel :: JBang :: Plugin :: Generate (6.1s)
  • Camel :: Catalog :: Camel Route Parser (5.2s)
  • Camel :: YAML DSL :: Deserializers (5.0s)
  • Camel :: All Components Sync point (3.2s)
  • Camel :: YAML DSL :: Validator Maven Plugin (2.4s)
  • Camel :: Catalog :: Maven (2.3s)

⚙️ View full build and test results

…ed headers

Says where each value belongs instead: the phone number ID in the
endpoint path, the recipient in the to field of the BaseMessage the
producer converts the body to.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Dhairya-007

Copy link
Copy Markdown
Contributor Author

Added, thanks — === camel-whatsapp is now in camel-4x-upgrade-guide-4_24.adoc.

It says the phone number ID belongs in the endpoint path (whatsapp:1234567890?authorizationToken=..., the @UriPath on WhatsAppConfiguration.phoneNumberId) and the recipient in the to field of the BaseMessage, since WhatsAppProducer sends exchange.getIn().getBody(BaseMessage.class) unchanged. The TextMessageRequest snippet is the shape the component's own tests use.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Both headers correctly deprecated with accurate deprecationNote values, generated files (catalog JSON, EndpointDSL factory) regenerated, and the 4.24 upgrade-guide entry added. The two items raised by @davsclaus are fully addressed.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

# Conflicts:
#	docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Dhairya-007, the upgrade-guide entry is in and does what I asked: users put the phone number ID in the endpoint URI and the recipient in the to field of the message body. The examples match the code: phoneNumberId is the @UriPath of WhatsAppConfiguration, WhatsAppProducer.java:53 sends getBody(BaseMessage.class) as it is, and TextMessageRequest / TextMessage have the setters the snippet uses.

LGTM.

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@davsclaus

Copy link
Copy Markdown
Contributor

Thanks @Dhairya-007, this is approved and ready to merge, but it now conflicts with main. #29954 (camel-docker deprecations) was merged and also adds a section at the end of docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc, and #29955, #29958 and #29959 each do the same. Could you rebase on main and keep both sections? Once one of the three is merged the next one conflicts again in the same place, so rebasing all three now and merging them one at a time may need another rebase in between.

Claude Code on behalf of davsclaus

@davsclaus

Copy link
Copy Markdown
Contributor

Thanks, this is approved and green, but it now conflicts with main in docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc (other entries landed in the same place). Could you rebase on main and keep both sides of the upgrade guide? Then it can be merged.

Claude Code on behalf of davsclaus

@davsclaus

Copy link
Copy Markdown
Contributor

@Dhairya-007 thanks, this one is approved, but it now conflicts with main after today's merges of the other header PRs. Could you rebase it onto main, regenerate the generated files (catalog JSON and endpoint DSL), and force-push? We'll merge it once CI is green.

Claude Code on behalf of davsclaus

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous findings remain addressed — no diff changes since prior LGTM review (HEAD SHA f72bb157).

Both headers (CamelWhatsAppPhoneNumberId, CamelWhatsAppRecipientPhoneNumberId) verified unused: WhatsAppProducer.process() converts the body to BaseMessage directly without reading any headers. @Deprecated annotations, deprecationNote values, catalog JSON updates, EndpointDSL factory methods, and upgrade guide entry are all correct and consistent.

Needs a rebase on main — davsclaus has flagged the merge conflict in camel-4x-upgrade-guide-4_24.adoc three times. Once rebased, this is ready to merge.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@oscerd oscerd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the two headers against the sources, and the deprecation is justified.

WhatsAppConstants publishes exactly WHATSAPP_PHONE_NUMBER_ID and WHATSAPP_RECIPIENT_PHONE_NUMBER_ID, and neither is read in main: WhatsAppProducer.process takes the body as a BaseMessage and the only header call it makes is getHeaders() for a debug log, not a lookup of either constant. The webhook processor does read headers, but they are the HTTP ones and HUB_SIGNATURE_HEADER, which is a separate constant, not one of these two, so it does not contradict the claim.

Both are deprecated with a deprecationNote that names where the value actually comes from, and there is an upgrade-guide entry, which is the correct treatment for a documented public header that does nothing: keep it a cycle, tell users it is inert and point at the real carrier. The regen is included and CI is green. Reasonable.

Claude Code on behalf of oscerd

davsclaus and others added 2 commits November 16, 2026 11:23
Resolves the conflict with main in the 4.24 upgrade guide (both entries kept).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up on my earlier review — the rebase conflict blocker is now resolved.

The merge commit from @davsclaus (SHA 995a6f77) resolved the upgrade guide conflict in camel-4x-upgrade-guide-4_24.adoc, keeping both the camel-keycloak section (from the concurrent merge) and the camel-whatsapp section from this PR. Both are present and correct in the diff.

The original content is unchanged and still accurate:

  • ✅ Both headers correctly deprecated with accurate deprecationNote values
  • ✅ Generated files (catalog JSON, EndpointDSL factory) already regenerated
  • ✅ Upgrade guide entry in place, examples match the actual WhatsAppProducer behavior
  • ✅ Rebase conflict resolved — ready to merge

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants