From ee02b9a848d6242606c28a24d5508ee7c8e9bd1f Mon Sep 17 00:00:00 2001 From: dhairya05 Date: Sat, 14 Nov 2026 23:53:53 +0530 Subject: [PATCH 1/3] camel-whatsapp: deprecate both documented headers, which nothing reads 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. --- .../org/apache/camel/catalog/components/whatsapp.json | 4 ++-- .../org/apache/camel/component/whatsapp/whatsapp.json | 4 ++-- .../camel/component/whatsapp/WhatsAppConstants.java | 10 ++++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/whatsapp.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/whatsapp.json index 9a4a52f5eed12..afc0ddc7bb70a 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/whatsapp.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/whatsapp.json @@ -35,8 +35,8 @@ "authorizationToken": { "index": 8, "kind": "property", "displayName": "Authorization Token", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Authorization Token taken from WhatsApp Meta for Developers Dashboard" } }, "headers": { - "CamelWhatsAppPhoneNumberId": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": false, "autowired": false, "secret": false, "description": "Phone Number ID taken from WhatsApp Meta for Developers Dashboard", "constantName": "org.apache.camel.component.whatsapp.WhatsAppConstants#WHATSAPP_PHONE_NUMBER_ID" }, - "CamelWhatsAppRecipientPhoneNumberId": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": false, "autowired": false, "secret": false, "description": "Recipient phone number associated with Phone Number ID", "constantName": "org.apache.camel.component.whatsapp.WhatsAppConstants#WHATSAPP_RECIPIENT_PHONE_NUMBER_ID" } + "CamelWhatsAppPhoneNumberId": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": true, "deprecationNote": "Never read by the component: the phone number ID comes from the endpoint URI, as the phoneNumberId path parameter", "autowired": false, "secret": false, "description": "Phone Number ID taken from WhatsApp Meta for Developers Dashboard. Deprecation note: Never read by the component: the phone number ID comes from the endpoint URI, as the phoneNumberId path parameter", "constantName": "org.apache.camel.component.whatsapp.WhatsAppConstants#WHATSAPP_PHONE_NUMBER_ID" }, + "CamelWhatsAppRecipientPhoneNumberId": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": true, "deprecationNote": "Never read by the component: the recipient comes from the to field of the BaseMessage the body is converted to", "autowired": false, "secret": false, "description": "Recipient phone number associated with Phone Number ID. Deprecation note: Never read by the component: the recipient comes from the to field of the BaseMessage the body is converted to", "constantName": "org.apache.camel.component.whatsapp.WhatsAppConstants#WHATSAPP_RECIPIENT_PHONE_NUMBER_ID" } }, "bodyTypes": { "consumerOut": { "carriers": [ "text", "null" ], "description": "In webhook mode (webhook:whatsapp:...), the event that WhatsApp posts, as JSON text. The verification request of WhatsApp (a GET) also reaches the route, with the hub.challenge as the body when hub.mode is subscribe and hub.verify_token matches webhookVerifyToken, else with no body (403, or 400 when the parameters are missing). An event without a valid X-Hub-Signature-256 is answered with 403 and does not reach the route, unless webhookVerification is false" }, diff --git a/components/camel-whatsapp/src/generated/resources/META-INF/org/apache/camel/component/whatsapp/whatsapp.json b/components/camel-whatsapp/src/generated/resources/META-INF/org/apache/camel/component/whatsapp/whatsapp.json index 9a4a52f5eed12..afc0ddc7bb70a 100644 --- a/components/camel-whatsapp/src/generated/resources/META-INF/org/apache/camel/component/whatsapp/whatsapp.json +++ b/components/camel-whatsapp/src/generated/resources/META-INF/org/apache/camel/component/whatsapp/whatsapp.json @@ -35,8 +35,8 @@ "authorizationToken": { "index": 8, "kind": "property", "displayName": "Authorization Token", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Authorization Token taken from WhatsApp Meta for Developers Dashboard" } }, "headers": { - "CamelWhatsAppPhoneNumberId": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": false, "autowired": false, "secret": false, "description": "Phone Number ID taken from WhatsApp Meta for Developers Dashboard", "constantName": "org.apache.camel.component.whatsapp.WhatsAppConstants#WHATSAPP_PHONE_NUMBER_ID" }, - "CamelWhatsAppRecipientPhoneNumberId": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": false, "autowired": false, "secret": false, "description": "Recipient phone number associated with Phone Number ID", "constantName": "org.apache.camel.component.whatsapp.WhatsAppConstants#WHATSAPP_RECIPIENT_PHONE_NUMBER_ID" } + "CamelWhatsAppPhoneNumberId": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": true, "deprecationNote": "Never read by the component: the phone number ID comes from the endpoint URI, as the phoneNumberId path parameter", "autowired": false, "secret": false, "description": "Phone Number ID taken from WhatsApp Meta for Developers Dashboard. Deprecation note: Never read by the component: the phone number ID comes from the endpoint URI, as the phoneNumberId path parameter", "constantName": "org.apache.camel.component.whatsapp.WhatsAppConstants#WHATSAPP_PHONE_NUMBER_ID" }, + "CamelWhatsAppRecipientPhoneNumberId": { "index": 1, "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": true, "deprecationNote": "Never read by the component: the recipient comes from the to field of the BaseMessage the body is converted to", "autowired": false, "secret": false, "description": "Recipient phone number associated with Phone Number ID. Deprecation note: Never read by the component: the recipient comes from the to field of the BaseMessage the body is converted to", "constantName": "org.apache.camel.component.whatsapp.WhatsAppConstants#WHATSAPP_RECIPIENT_PHONE_NUMBER_ID" } }, "bodyTypes": { "consumerOut": { "carriers": [ "text", "null" ], "description": "In webhook mode (webhook:whatsapp:...), the event that WhatsApp posts, as JSON text. The verification request of WhatsApp (a GET) also reaches the route, with the hub.challenge as the body when hub.mode is subscribe and hub.verify_token matches webhookVerifyToken, else with no body (403, or 400 when the parameters are missing). An event without a valid X-Hub-Signature-256 is answered with 403 and does not reach the route, unless webhookVerification is false" }, diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConstants.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConstants.java index 387c997ea6355..0edf8ad3415d0 100644 --- a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConstants.java +++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConstants.java @@ -21,10 +21,16 @@ public final class WhatsAppConstants { @Metadata(label = "producer", description = "Phone Number ID taken from WhatsApp Meta for Developers Dashboard", - javaType = "Object") + javaType = "Object", + deprecationNote = "Never read by the component: the phone number ID comes from the endpoint URI, as the" + + " phoneNumberId path parameter") + @Deprecated public static final String WHATSAPP_PHONE_NUMBER_ID = "CamelWhatsAppPhoneNumberId"; - @Metadata(label = "producer", description = "Recipient phone number associated with Phone Number ID", javaType = "Object") + @Metadata(label = "producer", description = "Recipient phone number associated with Phone Number ID", javaType = "Object", + deprecationNote = "Never read by the component: the recipient comes from the to field of the BaseMessage the body" + + " is converted to") + @Deprecated public static final String WHATSAPP_RECIPIENT_PHONE_NUMBER_ID = "CamelWhatsAppRecipientPhoneNumberId"; private WhatsAppConstants() { From b37a273923ee28194e1871962a9b09b743711d06 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Sat, 14 Nov 2026 19:06:20 +0000 Subject: [PATCH 2/3] Regen --- .../endpoint/dsl/WhatsAppEndpointBuilderFactory.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/WhatsAppEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/WhatsAppEndpointBuilderFactory.java index 873f32335e91d..c1668137c434d 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/WhatsAppEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/WhatsAppEndpointBuilderFactory.java @@ -908,6 +908,8 @@ public static class WhatsAppHeaderNameBuilder { /** * Phone Number ID taken from WhatsApp Meta for Developers Dashboard. + * Deprecation note: Never read by the component: the phone number ID + * comes from the endpoint URI, as the phoneNumberId path parameter. * * The option is a: {@code Object} type. * @@ -915,11 +917,14 @@ public static class WhatsAppHeaderNameBuilder { * * @return the name of the header {@code WhatsAppPhoneNumberId}. */ + @Deprecated public String whatsAppPhoneNumberId() { return "CamelWhatsAppPhoneNumberId"; } /** - * Recipient phone number associated with Phone Number ID. + * Recipient phone number associated with Phone Number ID. Deprecation + * note: Never read by the component: the recipient comes from the to + * field of the BaseMessage the body is converted to. * * The option is a: {@code Object} type. * @@ -928,6 +933,7 @@ public String whatsAppPhoneNumberId() { * @return the name of the header {@code * WhatsAppRecipientPhoneNumberId}. */ + @Deprecated public String whatsAppRecipientPhoneNumberId() { return "CamelWhatsAppRecipientPhoneNumberId"; } From fb927dfc38b79b1e89c0d338d0fe47565690d083 Mon Sep 17 00:00:00 2001 From: dhairya05 Date: Sun, 15 Nov 2026 15:15:36 +0530 Subject: [PATCH 3/3] camel-whatsapp: add the 4.24 upgrade-guide entry for the two deprecated 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 --- .../pages/camel-4x-upgrade-guide-4_24.adoc | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc index 028422a474ff9..724e36f0fab82 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc @@ -8743,3 +8743,29 @@ if it configured the proxy. It is now deprecated, with a `deprecationNote` that says so, and its description no longer claims to configure a proxy. Remove `protocol` from the endpoint URI or the configuration. To send the client's traffic through a proxy, use `proxyProtocol` together with `proxyHost` and `proxyPort`, which the shared client builder does apply. + +=== camel-whatsapp - both documented headers are deprecated + +`CamelWhatsAppPhoneNumberId` and `CamelWhatsAppRecipientPhoneNumberId` were the only two headers the component +documented, and it reads neither. A route that sets them gets no error and no effect. + +The phone number ID is the path parameter of the endpoint, so set it in the URI: + +[source,java] +---- +from("direct:start") + .to("whatsapp:1234567890?authorizationToken=token"); +---- + +The recipient is the `to` field of the `BaseMessage` the producer converts the body to, since `WhatsAppProducer` sends +`exchange.getIn().getBody(BaseMessage.class)` as it is: + +[source,java] +---- +TextMessageRequest request = new TextMessageRequest(); +request.setTo("15550001111"); +request.setText(new TextMessage()); +request.getText().setBody("Hello"); +---- + +Both headers are now deprecated, each with a `deprecationNote` that names the replacement.