Dhairya-007 opened a new pull request, #29958:
URL: https://github.com/apache/camel/pull/29958

   ## 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:
   
   ```java
   // 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to