You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/07/12 12:31:53 UTC
[camel] branch main updated: ✨ camel-whatsapp component
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 67f1cc01421 ✨ camel-whatsapp component
67f1cc01421 is described below
commit 67f1cc0142113436d65cfc1f7537692412189dec
Author: Croway <fe...@gmail.com>
AuthorDate: Wed May 25 17:09:18 2022 +0200
✨ camel-whatsapp component
---
bom/camel-bom/pom.xml | 5 +
catalog/camel-allcomponents/pom.xml | 4 +
components/camel-whatsapp/pom.xml | 99 ++++++++
.../whatsapp/WhatsAppComponentConfigurer.java | 94 +++++++
.../whatsapp/WhatsAppEndpointConfigurer.java | 205 +++++++++++++++
.../whatsapp/WhatsAppEndpointUriFactory.java | 99 ++++++++
.../services/org/apache/camel/component.properties | 7 +
.../services/org/apache/camel/component/whatsapp | 2 +
.../org/apache/camel/configurer/whatsapp-component | 2 +
.../org/apache/camel/configurer/whatsapp-endpoint | 2 +
.../org/apache/camel/urifactory/whatsapp-endpoint | 2 +
.../apache/camel/component/whatsapp/whatsapp.json | 69 ++++++
.../src/main/docs/whatsapp-component.adoc | 110 +++++++++
.../component/whatsapp/WhatsAppComponent.java | 133 ++++++++++
.../component/whatsapp/WhatsAppConfiguration.java | 106 ++++++++
.../component/whatsapp/WhatsAppConstants.java | 32 +++
.../camel/component/whatsapp/WhatsAppEndpoint.java | 149 +++++++++++
.../camel/component/whatsapp/WhatsAppProducer.java | 64 +++++
.../camel/component/whatsapp/WhatsAppService.java | 30 +++
.../whatsapp/WhatsAppWebhookProcessor.java | 119 +++++++++
.../camel/component/whatsapp/model/Action.java | 52 ++++
.../camel/component/whatsapp/model/Address.java | 93 +++++++
.../component/whatsapp/model/BaseMessage.java | 82 ++++++
.../camel/component/whatsapp/model/Body.java | 42 ++++
.../camel/component/whatsapp/model/Button.java | 42 ++++
.../camel/component/whatsapp/model/Component.java | 66 +++++
.../camel/component/whatsapp/model/Contact.java | 46 ++++
.../component/whatsapp/model/ContactMessage.java | 94 +++++++
.../whatsapp/model/ContactMessageRequest.java | 36 +++
.../camel/component/whatsapp/model/Currency.java | 62 +++++
.../camel/component/whatsapp/model/DateTime.java | 37 +++
.../camel/component/whatsapp/model/Email.java | 45 ++++
.../camel/component/whatsapp/model/Header.java | 68 +++++
.../whatsapp/model/InteractiveMessage.java | 73 ++++++
.../whatsapp/model/InteractiveMessageRequest.java | 34 +++
.../camel/component/whatsapp/model/Language.java | 43 ++++
.../component/whatsapp/model/LocationMessage.java | 60 +++++
.../whatsapp/model/LocationMessageRequest.java | 34 +++
.../component/whatsapp/model/MediaMessage.java | 76 ++++++
.../whatsapp/model/MediaMessageRequest.java | 63 +++++
.../camel/component/whatsapp/model/Message.java | 33 +++
.../component/whatsapp/model/MessageResponse.java | 68 +++++
.../camel/component/whatsapp/model/Name.java | 89 +++++++
.../apache/camel/component/whatsapp/model/Org.java | 51 ++++
.../camel/component/whatsapp/model/Parameter.java | 91 +++++++
.../camel/component/whatsapp/model/Phone.java | 58 +++++
.../camel/component/whatsapp/model/Reply.java | 42 ++++
.../camel/component/whatsapp/model/Section.java | 44 ++++
.../component/whatsapp/model/TempalteMessage.java | 54 ++++
.../whatsapp/model/TemplateMessageRequest.java | 35 +++
.../component/whatsapp/model/TextMessage.java | 48 ++++
.../whatsapp/model/TextMessageRequest.java | 36 +++
.../component/whatsapp/model/UploadMedia.java | 62 +++++
.../whatsapp/model/UploadMediaRequest.java | 32 +++
.../apache/camel/component/whatsapp/model/Url.java | 42 ++++
.../service/WhatsAppServiceRestAPIAdapter.java | 225 +++++++++++++++++
.../whatsapp/util/FileUploadStreamSupplier.java | 123 +++++++++
.../component/whatsapp/util/RestAdapterUtils.java | 62 +++++
.../component/whatsapp/WhatsAppApiConfig.java | 75 ++++++
.../component/whatsapp/WhatsAppTestSupport.java | 49 ++++
.../component/whatsapp/WhatsAppWebhookTest.java | 110 +++++++++
.../whatsapp/integration/WhatsAppServiceIT.java | 274 +++++++++++++++++++++
.../camel-whatsapp/src/test/resources/camel.jpg | Bin 0 -> 48089 bytes
.../camel-whatsapp/src/test/resources/camel.webp | Bin 0 -> 67616 bytes
.../test/resources/interactive-button-message.json | 30 +++
.../test/resources/interactive-list-message.json | 54 ++++
.../src/test/resources/log4j2.properties | 31 +++
.../camel-whatsapp/src/test/resources/sample.mp4 | Bin 0 -> 299284 bytes
.../src/test/resources/template-message.json | 11 +
.../src/test/resources/webhook-request.json | 39 +++
components/pom.xml | 1 +
parent/pom.xml | 5 +
72 files changed, 4355 insertions(+)
diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml
index 257d02ccdf4..e9203d586e8 100644
--- a/bom/camel-bom/pom.xml
+++ b/bom/camel-bom/pom.xml
@@ -2173,6 +2173,11 @@
<artifactId>camel-weka</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-whatsapp</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-wordpress</artifactId>
diff --git a/catalog/camel-allcomponents/pom.xml b/catalog/camel-allcomponents/pom.xml
index 3e8ed82f6f0..4cd3e7423c6 100644
--- a/catalog/camel-allcomponents/pom.xml
+++ b/catalog/camel-allcomponents/pom.xml
@@ -1481,6 +1481,10 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-weka</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-whatsapp</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-wordpress</artifactId>
diff --git a/components/camel-whatsapp/pom.xml b/components/camel-whatsapp/pom.xml
new file mode 100644
index 00000000000..505eb4a6f1f
--- /dev/null
+++ b/components/camel-whatsapp/pom.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>components</artifactId>
+ <version>3.18.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-whatsapp</artifactId>
+ <packaging>jar</packaging>
+ <name>Camel :: Whatsapp</name>
+ <description>Camel Whatsapp support</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-support</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-webhook</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>${jackson2-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.datatype</groupId>
+ <artifactId>jackson-datatype-jsr310</artifactId>
+ <version>${jackson2-version}</version>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-health</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- For testing the webhook -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-netty-http</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/components/camel-whatsapp/src/generated/java/org/apache/camel/component/whatsapp/WhatsAppComponentConfigurer.java b/components/camel-whatsapp/src/generated/java/org/apache/camel/component/whatsapp/WhatsAppComponentConfigurer.java
new file mode 100644
index 00000000000..82ec6fff3ed
--- /dev/null
+++ b/components/camel-whatsapp/src/generated/java/org/apache/camel/component/whatsapp/WhatsAppComponentConfigurer.java
@@ -0,0 +1,94 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.whatsapp;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.spi.ConfigurerStrategy;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.component.PropertyConfigurerSupport;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@SuppressWarnings("unchecked")
+public class WhatsAppComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {
+
+ @Override
+ public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
+ WhatsAppComponent target = (WhatsAppComponent) obj;
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "apiversion":
+ case "apiVersion": target.setApiVersion(property(camelContext, java.lang.String.class, value)); return true;
+ case "authorizationtoken":
+ case "authorizationToken": target.setAuthorizationToken(property(camelContext, java.lang.String.class, value)); return true;
+ case "autowiredenabled":
+ case "autowiredEnabled": target.setAutowiredEnabled(property(camelContext, boolean.class, value)); return true;
+ case "baseuri":
+ case "baseUri": target.setBaseUri(property(camelContext, java.lang.String.class, value)); return true;
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true;
+ case "client": target.setClient(property(camelContext, java.net.http.HttpClient.class, value)); return true;
+ case "lazystartproducer":
+ case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
+ case "phonenumberid":
+ case "phoneNumberId": target.setPhoneNumberId(property(camelContext, java.lang.String.class, value)); return true;
+ case "webhookverifytoken":
+ case "webhookVerifyToken": target.setWebhookVerifyToken(property(camelContext, java.lang.String.class, value)); return true;
+ default: return false;
+ }
+ }
+
+ @Override
+ public Class<?> getOptionType(String name, boolean ignoreCase) {
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "apiversion":
+ case "apiVersion": return java.lang.String.class;
+ case "authorizationtoken":
+ case "authorizationToken": return java.lang.String.class;
+ case "autowiredenabled":
+ case "autowiredEnabled": return boolean.class;
+ case "baseuri":
+ case "baseUri": return java.lang.String.class;
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler": return boolean.class;
+ case "client": return java.net.http.HttpClient.class;
+ case "lazystartproducer":
+ case "lazyStartProducer": return boolean.class;
+ case "phonenumberid":
+ case "phoneNumberId": return java.lang.String.class;
+ case "webhookverifytoken":
+ case "webhookVerifyToken": return java.lang.String.class;
+ default: return null;
+ }
+ }
+
+ @Override
+ public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+ WhatsAppComponent target = (WhatsAppComponent) obj;
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "apiversion":
+ case "apiVersion": return target.getApiVersion();
+ case "authorizationtoken":
+ case "authorizationToken": return target.getAuthorizationToken();
+ case "autowiredenabled":
+ case "autowiredEnabled": return target.isAutowiredEnabled();
+ case "baseuri":
+ case "baseUri": return target.getBaseUri();
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler": return target.isBridgeErrorHandler();
+ case "client": return target.getClient();
+ case "lazystartproducer":
+ case "lazyStartProducer": return target.isLazyStartProducer();
+ case "phonenumberid":
+ case "phoneNumberId": return target.getPhoneNumberId();
+ case "webhookverifytoken":
+ case "webhookVerifyToken": return target.getWebhookVerifyToken();
+ default: return null;
+ }
+ }
+}
+
diff --git a/components/camel-whatsapp/src/generated/java/org/apache/camel/component/whatsapp/WhatsAppEndpointConfigurer.java b/components/camel-whatsapp/src/generated/java/org/apache/camel/component/whatsapp/WhatsAppEndpointConfigurer.java
new file mode 100644
index 00000000000..561497345cc
--- /dev/null
+++ b/components/camel-whatsapp/src/generated/java/org/apache/camel/component/whatsapp/WhatsAppEndpointConfigurer.java
@@ -0,0 +1,205 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.whatsapp;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.spi.ConfigurerStrategy;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.component.PropertyConfigurerSupport;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@SuppressWarnings("unchecked")
+public class WhatsAppEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {
+
+ @Override
+ public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
+ WhatsAppEndpoint target = (WhatsAppEndpoint) obj;
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "apiversion":
+ case "apiVersion": target.getConfiguration().setApiVersion(property(camelContext, java.lang.String.class, value)); return true;
+ case "authorizationtoken":
+ case "authorizationToken": target.getConfiguration().setAuthorizationToken(property(camelContext, java.lang.String.class, value)); return true;
+ case "backofferrorthreshold":
+ case "backoffErrorThreshold": target.setBackoffErrorThreshold(property(camelContext, int.class, value)); return true;
+ case "backoffidlethreshold":
+ case "backoffIdleThreshold": target.setBackoffIdleThreshold(property(camelContext, int.class, value)); return true;
+ case "backoffmultiplier":
+ case "backoffMultiplier": target.setBackoffMultiplier(property(camelContext, int.class, value)); return true;
+ case "baseuri":
+ case "baseUri": target.getConfiguration().setBaseUri(property(camelContext, java.lang.String.class, value)); return true;
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true;
+ case "delay": target.setDelay(property(camelContext, long.class, value)); return true;
+ case "exceptionhandler":
+ case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true;
+ case "exchangepattern":
+ case "exchangePattern": target.setExchangePattern(property(camelContext, org.apache.camel.ExchangePattern.class, value)); return true;
+ case "greedy": target.setGreedy(property(camelContext, boolean.class, value)); return true;
+ case "httpclient":
+ case "httpClient": target.setHttpClient(property(camelContext, java.net.http.HttpClient.class, value)); return true;
+ case "initialdelay":
+ case "initialDelay": target.setInitialDelay(property(camelContext, long.class, value)); return true;
+ case "lazystartproducer":
+ case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
+ case "pollstrategy":
+ case "pollStrategy": target.setPollStrategy(property(camelContext, org.apache.camel.spi.PollingConsumerPollStrategy.class, value)); return true;
+ case "repeatcount":
+ case "repeatCount": target.setRepeatCount(property(camelContext, long.class, value)); return true;
+ case "runlogginglevel":
+ case "runLoggingLevel": target.setRunLoggingLevel(property(camelContext, org.apache.camel.LoggingLevel.class, value)); return true;
+ case "scheduledexecutorservice":
+ case "scheduledExecutorService": target.setScheduledExecutorService(property(camelContext, java.util.concurrent.ScheduledExecutorService.class, value)); return true;
+ case "scheduler": target.setScheduler(property(camelContext, java.lang.Object.class, value)); return true;
+ case "schedulerproperties":
+ case "schedulerProperties": target.setSchedulerProperties(property(camelContext, java.util.Map.class, value)); return true;
+ case "sendemptymessagewhenidle":
+ case "sendEmptyMessageWhenIdle": target.setSendEmptyMessageWhenIdle(property(camelContext, boolean.class, value)); return true;
+ case "startscheduler":
+ case "startScheduler": target.setStartScheduler(property(camelContext, boolean.class, value)); return true;
+ case "timeunit":
+ case "timeUnit": target.setTimeUnit(property(camelContext, java.util.concurrent.TimeUnit.class, value)); return true;
+ case "usefixeddelay":
+ case "useFixedDelay": target.setUseFixedDelay(property(camelContext, boolean.class, value)); return true;
+ case "webhookpath":
+ case "webhookPath": target.getConfiguration().setWebhookPath(property(camelContext, java.lang.String.class, value)); return true;
+ case "webhookverifytoken":
+ case "webhookVerifyToken": target.getConfiguration().setWebhookVerifyToken(property(camelContext, java.lang.String.class, value)); return true;
+ case "whatsappservice":
+ case "whatsappService": target.setWhatsappService(property(camelContext, org.apache.camel.component.whatsapp.WhatsAppService.class, value)); return true;
+ default: return false;
+ }
+ }
+
+ @Override
+ public Class<?> getOptionType(String name, boolean ignoreCase) {
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "apiversion":
+ case "apiVersion": return java.lang.String.class;
+ case "authorizationtoken":
+ case "authorizationToken": return java.lang.String.class;
+ case "backofferrorthreshold":
+ case "backoffErrorThreshold": return int.class;
+ case "backoffidlethreshold":
+ case "backoffIdleThreshold": return int.class;
+ case "backoffmultiplier":
+ case "backoffMultiplier": return int.class;
+ case "baseuri":
+ case "baseUri": return java.lang.String.class;
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler": return boolean.class;
+ case "delay": return long.class;
+ case "exceptionhandler":
+ case "exceptionHandler": return org.apache.camel.spi.ExceptionHandler.class;
+ case "exchangepattern":
+ case "exchangePattern": return org.apache.camel.ExchangePattern.class;
+ case "greedy": return boolean.class;
+ case "httpclient":
+ case "httpClient": return java.net.http.HttpClient.class;
+ case "initialdelay":
+ case "initialDelay": return long.class;
+ case "lazystartproducer":
+ case "lazyStartProducer": return boolean.class;
+ case "pollstrategy":
+ case "pollStrategy": return org.apache.camel.spi.PollingConsumerPollStrategy.class;
+ case "repeatcount":
+ case "repeatCount": return long.class;
+ case "runlogginglevel":
+ case "runLoggingLevel": return org.apache.camel.LoggingLevel.class;
+ case "scheduledexecutorservice":
+ case "scheduledExecutorService": return java.util.concurrent.ScheduledExecutorService.class;
+ case "scheduler": return java.lang.Object.class;
+ case "schedulerproperties":
+ case "schedulerProperties": return java.util.Map.class;
+ case "sendemptymessagewhenidle":
+ case "sendEmptyMessageWhenIdle": return boolean.class;
+ case "startscheduler":
+ case "startScheduler": return boolean.class;
+ case "timeunit":
+ case "timeUnit": return java.util.concurrent.TimeUnit.class;
+ case "usefixeddelay":
+ case "useFixedDelay": return boolean.class;
+ case "webhookpath":
+ case "webhookPath": return java.lang.String.class;
+ case "webhookverifytoken":
+ case "webhookVerifyToken": return java.lang.String.class;
+ case "whatsappservice":
+ case "whatsappService": return org.apache.camel.component.whatsapp.WhatsAppService.class;
+ default: return null;
+ }
+ }
+
+ @Override
+ public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+ WhatsAppEndpoint target = (WhatsAppEndpoint) obj;
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "apiversion":
+ case "apiVersion": return target.getConfiguration().getApiVersion();
+ case "authorizationtoken":
+ case "authorizationToken": return target.getConfiguration().getAuthorizationToken();
+ case "backofferrorthreshold":
+ case "backoffErrorThreshold": return target.getBackoffErrorThreshold();
+ case "backoffidlethreshold":
+ case "backoffIdleThreshold": return target.getBackoffIdleThreshold();
+ case "backoffmultiplier":
+ case "backoffMultiplier": return target.getBackoffMultiplier();
+ case "baseuri":
+ case "baseUri": return target.getConfiguration().getBaseUri();
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler": return target.isBridgeErrorHandler();
+ case "delay": return target.getDelay();
+ case "exceptionhandler":
+ case "exceptionHandler": return target.getExceptionHandler();
+ case "exchangepattern":
+ case "exchangePattern": return target.getExchangePattern();
+ case "greedy": return target.isGreedy();
+ case "httpclient":
+ case "httpClient": return target.getHttpClient();
+ case "initialdelay":
+ case "initialDelay": return target.getInitialDelay();
+ case "lazystartproducer":
+ case "lazyStartProducer": return target.isLazyStartProducer();
+ case "pollstrategy":
+ case "pollStrategy": return target.getPollStrategy();
+ case "repeatcount":
+ case "repeatCount": return target.getRepeatCount();
+ case "runlogginglevel":
+ case "runLoggingLevel": return target.getRunLoggingLevel();
+ case "scheduledexecutorservice":
+ case "scheduledExecutorService": return target.getScheduledExecutorService();
+ case "scheduler": return target.getScheduler();
+ case "schedulerproperties":
+ case "schedulerProperties": return target.getSchedulerProperties();
+ case "sendemptymessagewhenidle":
+ case "sendEmptyMessageWhenIdle": return target.isSendEmptyMessageWhenIdle();
+ case "startscheduler":
+ case "startScheduler": return target.isStartScheduler();
+ case "timeunit":
+ case "timeUnit": return target.getTimeUnit();
+ case "usefixeddelay":
+ case "useFixedDelay": return target.isUseFixedDelay();
+ case "webhookpath":
+ case "webhookPath": return target.getConfiguration().getWebhookPath();
+ case "webhookverifytoken":
+ case "webhookVerifyToken": return target.getConfiguration().getWebhookVerifyToken();
+ case "whatsappservice":
+ case "whatsappService": return target.getWhatsappService();
+ default: return null;
+ }
+ }
+
+ @Override
+ public Object getCollectionValueType(Object target, String name, boolean ignoreCase) {
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "schedulerproperties":
+ case "schedulerProperties": return java.lang.Object.class;
+ default: return null;
+ }
+ }
+}
+
diff --git a/components/camel-whatsapp/src/generated/java/org/apache/camel/component/whatsapp/WhatsAppEndpointUriFactory.java b/components/camel-whatsapp/src/generated/java/org/apache/camel/component/whatsapp/WhatsAppEndpointUriFactory.java
new file mode 100644
index 00000000000..0ab7b34596b
--- /dev/null
+++ b/components/camel-whatsapp/src/generated/java/org/apache/camel/component/whatsapp/WhatsAppEndpointUriFactory.java
@@ -0,0 +1,99 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.whatsapp;
+
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.camel.spi.EndpointUriFactory;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+public class WhatsAppEndpointUriFactory extends org.apache.camel.support.component.EndpointUriFactorySupport implements EndpointUriFactory {
+
+ private static final String BASE = ":type";
+
+ private static final Set<String> PROPERTY_NAMES;
+ private static final Set<String> SECRET_PROPERTY_NAMES;
+ private static final Set<String> MULTI_VALUE_PREFIXES;
+ static {
+ Set<String> props = new HashSet<>(28);
+ props.add("apiVersion");
+ props.add("authorizationToken");
+ props.add("backoffErrorThreshold");
+ props.add("backoffIdleThreshold");
+ props.add("backoffMultiplier");
+ props.add("baseUri");
+ props.add("bridgeErrorHandler");
+ props.add("delay");
+ props.add("exceptionHandler");
+ props.add("exchangePattern");
+ props.add("greedy");
+ props.add("httpClient");
+ props.add("initialDelay");
+ props.add("lazyStartProducer");
+ props.add("phoneNumberId");
+ props.add("pollStrategy");
+ props.add("repeatCount");
+ props.add("runLoggingLevel");
+ props.add("scheduledExecutorService");
+ props.add("scheduler");
+ props.add("schedulerProperties");
+ props.add("sendEmptyMessageWhenIdle");
+ props.add("startScheduler");
+ props.add("timeUnit");
+ props.add("useFixedDelay");
+ props.add("webhookPath");
+ props.add("webhookVerifyToken");
+ props.add("whatsappService");
+ PROPERTY_NAMES = Collections.unmodifiableSet(props);
+ Set<String> secretProps = new HashSet<>(1);
+ secretProps.add("authorizationToken");
+ SECRET_PROPERTY_NAMES = Collections.unmodifiableSet(secretProps);
+ Set<String> prefixes = new HashSet<>(1);
+ prefixes.add("scheduler.");
+ MULTI_VALUE_PREFIXES = Collections.unmodifiableSet(prefixes);
+ }
+
+ @Override
+ public boolean isEnabled(String scheme) {
+ return "whatsapp".equals(scheme);
+ }
+
+ @Override
+ public String buildUri(String scheme, Map<String, Object> properties, boolean encode) throws URISyntaxException {
+ String syntax = scheme + BASE;
+ String uri = syntax;
+
+ Map<String, Object> copy = new HashMap<>(properties);
+
+ uri = buildPathParameter(syntax, uri, "phoneNumberId", null, true, copy);
+ uri = buildQueryParameters(uri, copy, encode);
+ return uri;
+ }
+
+ @Override
+ public Set<String> propertyNames() {
+ return PROPERTY_NAMES;
+ }
+
+ @Override
+ public Set<String> secretPropertyNames() {
+ return SECRET_PROPERTY_NAMES;
+ }
+
+ @Override
+ public Set<String> multiValuePrefixes() {
+ return MULTI_VALUE_PREFIXES;
+ }
+
+ @Override
+ public boolean isLenientProperties() {
+ return false;
+ }
+}
+
diff --git a/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/component.properties b/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/component.properties
new file mode 100644
index 00000000000..beebb8a9234
--- /dev/null
+++ b/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/component.properties
@@ -0,0 +1,7 @@
+# Generated by camel build tools - do NOT edit this file!
+components=whatsapp
+groupId=org.apache.camel
+artifactId=camel-whatsapp
+version=3.18.0-SNAPSHOT
+projectName=Camel :: Whatsapp
+projectDescription=Camel Whatsapp support
diff --git a/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/component/whatsapp b/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/component/whatsapp
new file mode 100644
index 00000000000..1c34b1487ee
--- /dev/null
+++ b/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/component/whatsapp
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.whatsapp.WhatsAppComponent
diff --git a/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/configurer/whatsapp-component b/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/configurer/whatsapp-component
new file mode 100644
index 00000000000..1178d0a6375
--- /dev/null
+++ b/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/configurer/whatsapp-component
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.whatsapp.WhatsAppComponentConfigurer
diff --git a/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/configurer/whatsapp-endpoint b/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/configurer/whatsapp-endpoint
new file mode 100644
index 00000000000..6968f024bbc
--- /dev/null
+++ b/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/configurer/whatsapp-endpoint
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.whatsapp.WhatsAppEndpointConfigurer
diff --git a/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/urifactory/whatsapp-endpoint b/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/urifactory/whatsapp-endpoint
new file mode 100644
index 00000000000..03b4b614086
--- /dev/null
+++ b/components/camel-whatsapp/src/generated/resources/META-INF/services/org/apache/camel/urifactory/whatsapp-endpoint
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.whatsapp.WhatsAppEndpointUriFactory
diff --git a/components/camel-whatsapp/src/generated/resources/org/apache/camel/component/whatsapp/whatsapp.json b/components/camel-whatsapp/src/generated/resources/org/apache/camel/component/whatsapp/whatsapp.json
new file mode 100644
index 00000000000..8f267b07698
--- /dev/null
+++ b/components/camel-whatsapp/src/generated/resources/org/apache/camel/component/whatsapp/whatsapp.json
@@ -0,0 +1,69 @@
+{
+ "component": {
+ "kind": "component",
+ "name": "whatsapp",
+ "title": "WhatsApp",
+ "description": "Send messages.",
+ "deprecated": false,
+ "firstVersion": "3.18.0",
+ "label": "cloud,api,chat",
+ "javaType": "org.apache.camel.component.whatsapp.WhatsAppComponent",
+ "supportLevel": "Preview",
+ "groupId": "org.apache.camel",
+ "artifactId": "camel-whatsapp",
+ "version": "3.18.0-SNAPSHOT",
+ "scheme": "whatsapp",
+ "extendsScheme": "",
+ "syntax": "whatsapp:type",
+ "async": false,
+ "api": false,
+ "consumerOnly": false,
+ "producerOnly": false,
+ "lenientProperties": false
+ },
+ "componentProperties": {
+ "phoneNumberId": { "kind": "property", "displayName": "Phone Number Id", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Phone Number ID taken from WhatsApp Meta for Developers Dashboard" },
+ "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a me [...]
+ "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...]
+ "apiVersion": { "kind": "property", "displayName": "Api Version", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "v13.0", "description": "WhatsApp Cloud API version" },
+ "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...]
+ "baseUri": { "kind": "property", "displayName": "Base Uri", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "https:\/\/graph.facebook.com", "description": "Can be used to set an alternative base URI, e.g. when you want to test the component against a mock WhatsApp API" },
+ "client": { "kind": "property", "displayName": "Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "java.net.http.HttpClient", "deprecated": false, "autowired": false, "secret": false, "description": "Java 11 HttpClient implementation" },
+ "webhookVerifyToken": { "kind": "property", "displayName": "Webhook Verify Token", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "Webhook verify token" },
+ "authorizationToken": { "kind": "property", "displayName": "Authorization Token", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "Authorization Token taken from WhatsApp Meta for Developers Dashboard" }
+ },
+ "headers": {
+ "CamelWhatsAppPhoneNumberId": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "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": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "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" }
+ },
+ "properties": {
+ "phoneNumberId": { "kind": "path", "displayName": "Phone Number Id", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.whatsapp.WhatsAppConfiguration", "configurationField": "configuration", "description": "The phone number ID taken from whatsapp-business dashboard." },
+ "sendEmptyMessageWhenIdle": { "kind": "parameter", "displayName": "Send Empty Message When Idle", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead." },
+ "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now [...]
+ "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the con [...]
+ "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." },
+ "pollStrategy": { "kind": "parameter", "displayName": "Poll Strategy", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation [...]
+ "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may other [...]
+ "apiVersion": { "kind": "parameter", "displayName": "Api Version", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.whatsapp.WhatsAppConfiguration", "configurationField": "configuration", "description": "Facebook graph api version." },
+ "baseUri": { "kind": "parameter", "displayName": "Base Uri", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.whatsapp.WhatsAppConfiguration", "configurationField": "configuration", "description": "Can be used to set an alternative base URI, e.g. when you want to test the component against a mock WhatsApp API" },
+ "httpClient": { "kind": "parameter", "displayName": "Http Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "java.net.http.HttpClient", "deprecated": false, "autowired": false, "secret": false, "description": "HttpClient implementation" },
+ "webhookPath": { "kind": "parameter", "displayName": "Webhook Path", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "webhook", "configurationClass": "org.apache.camel.component.whatsapp.WhatsAppConfiguration", "configurationField": "configuration", "description": "Webhook path" },
+ "webhookVerifyToken": { "kind": "parameter", "displayName": "Webhook Verify Token", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.whatsapp.WhatsAppConfiguration", "configurationField": "configuration", "description": "Webhook verify token" },
+ "whatsappService": { "kind": "parameter", "displayName": "Whatsapp Service", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.whatsapp.WhatsAppService", "deprecated": false, "autowired": false, "secret": false, "description": "WhatsApp service implementation" },
+ "backoffErrorThreshold": { "kind": "parameter", "displayName": "Backoff Error Threshold", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in." },
+ "backoffIdleThreshold": { "kind": "parameter", "displayName": "Backoff Idle Threshold", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "The number of subsequent idle polls that should happen before the backoffMultipler should kick-in." },
+ "backoffMultiplier": { "kind": "parameter", "displayName": "Backoff Multiplier", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "description": "To let the scheduled polling consumer backoff if there has been a number of subsequent idles\/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening agai [...]
+ "delay": { "kind": "parameter", "displayName": "Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 500, "description": "Milliseconds before the next poll." },
+ "greedy": { "kind": "parameter", "displayName": "Greedy", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages." },
+ "initialDelay": { "kind": "parameter", "displayName": "Initial Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1000, "description": "Milliseconds before the first poll starts." },
+ "repeatCount": { "kind": "parameter", "displayName": "Repeat Count", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 0, "description": "Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever." },
+ "runLoggingLevel": { "kind": "parameter", "displayName": "Run Logging Level", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "org.apache.camel.LoggingLevel", "enum": [ "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "TRACE", "description": "The consumer logs a start\/complete log line when it polls. This option allows you to configure the logging level [...]
+ "scheduledExecutorService": { "kind": "parameter", "displayName": "Scheduled Executor Service", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.concurrent.ScheduledExecutorService", "deprecated": false, "autowired": false, "secret": false, "description": "Allows for configuring a custom\/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool." },
+ "scheduler": { "kind": "parameter", "displayName": "Scheduler", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.lang.Object", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "none", "description": "To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler" },
+ "schedulerProperties": { "kind": "parameter", "displayName": "Scheduler Properties", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "scheduler.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "description": "To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler." },
+ "startScheduler": { "kind": "parameter", "displayName": "Start Scheduler", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the scheduler should be auto started." },
+ "timeUnit": { "kind": "parameter", "displayName": "Time Unit", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.concurrent.TimeUnit", "enum": [ "NANOSECONDS", "MICROSECONDS", "MILLISECONDS", "SECONDS", "MINUTES", "HOURS", "DAYS" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "MILLISECONDS", "description": "Time unit for initialDelay and delay options." },
+ "useFixedDelay": { "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." },
+ "authorizationToken": { "kind": "parameter", "displayName": "Authorization Token", "group": "security", "label": "security", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.whatsapp.WhatsAppConfiguration", "configurationField": "configuration", "description": "The authorization access token taken from whatsapp-business dashboard." }
+ }
+}
diff --git a/components/camel-whatsapp/src/main/docs/whatsapp-component.adoc b/components/camel-whatsapp/src/main/docs/whatsapp-component.adoc
new file mode 100644
index 00000000000..b2c149338ef
--- /dev/null
+++ b/components/camel-whatsapp/src/main/docs/whatsapp-component.adoc
@@ -0,0 +1,110 @@
+= WhatsApp Component
+:doctitle: WhatsApp
+:shortname: whatsapp
+:artifactid: camel-whatsapp
+:description: Send messages.
+:since: 3.18
+:supportlevel: Preview
+:component-header: Both producer and consumer are supported
+
+*Since Camel {since}*
+
+*{component-header}*
+
+The WhatsApp component provides access to the https://developers.facebook.com/docs/whatsapp/cloud-api[WhatsApp Cloud API].
+It allows a Camel-based application to send messages using a cloud-hosted version of the WhatsApp Business Platform..
+
+Before using this component you have to set up Developer Assets and Platform Access, following the instructions at the
+https://developers.facebook.com/docs/whatsapp/cloud-api/get-started#set-up-developer-assets[Register WhatsApp Business Cloud API account].
+Once the account is set up you can navigate to https://developers.facebook.com/apps/?show_reminder=true[Meta for Developers Apps], in order to access to the WhatsApp dashboard where you can get the **authorization token**, **phone number id** and you can add **recipient phone numbers**, these parameters are mandatory in order to use the component.=
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-whatsapp</artifactId>
+ <version>x.x.x</version>
+ <!-- use the same version as your Camel core version -->
+</dependency>
+------------------------------------------------------------
+
+== URI format
+
+----------------------------------------------------
+whatsapp:type[?options]
+----------------------------------------------------
+
+
+
+// component-configure options: START
+
+// component-configure options: END
+
+// component options: START
+include::partial$component-configure-options.adoc[]
+include::partial$component-endpoint-options.adoc[]
+// component options: END
+
+// endpoint options: START
+
+// endpoint options: END
+// component headers: START
+include::partial$component-endpoint-headers.adoc[]
+// component headers: END
+
+== Usage
+
+The WhatsApp component supports only producer endpoints.
+
+== Producer Example
+
+The following is a basic example of how to send a message to a WhatsApp chat through the
+Business Cloud API.
+
+in Java DSL
+
+[source,java]
+---------------------------------------------------------
+from("direct:start")
+ .process(exchange -> {
+ TextMessageRequest request = new TextMessageRequest();
+ request.setTo(insertYourRecipientPhoneNumberHere);
+ request.setText(new TextMessage());
+ request.getText().setBody("This is an auto-generated message from Camel \uD83D\uDC2B");
+
+ exchange.getIn().setBody(request);
+ })
+ .to("whatsapp:123456789:insertYourPhoneNumberIdHere?authorizationToken=123456789:insertYourAuthorizationTokenHere");
+---------------------------------------------------------
+For more information you can refer to https://developers.facebook.com/docs/whatsapp/cloud-api/reference[Cloud API Reference], Supported API are: https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages[Messages] and https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media[Media]
+
+== Webhook Mode
+
+The Whatsapp component supports usage in the *webhook mode* using the *camel-webhook* component.
+
+In order to enable webhook mode, users need first to add a REST implementation to their application.
+Maven users, for example, can add *netty-http* to their `pom.xml` file:
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-netty-http</artifactId>
+</dependency>
+------------------------------------------------------------
+
+Once done, you need to prepend the webhook URI to the whatsapp URI you want to use.
+
+In Java DSL:
+
+[source,java]
+---------------------------------------------------------
+fromF("webhook:whatsapp:%s?authorizationToken=%s&webhookVerifyToken=%s", "<phoneNumberId>", "<AuthorizationToken>", "<webhookVerifyToken>").log("${body}")
+---------------------------------------------------------
+
+In order to enable and configure the webhook, the following guide can be used https://developers.facebook.com/docs/whatsapp/cloud-api/guides/set-up-webhooks the webhook component will expose an endpoint that can be used into the whatsapp administration console.
+
+Refer to the *camel-webhook* component documentation for instructions on how to set it.
\ No newline at end of file
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppComponent.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppComponent.java
new file mode 100644
index 00000000000..c5ed109e8ae
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppComponent.java
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import java.net.http.HttpClient;
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.annotations.Component;
+import org.apache.camel.support.DefaultComponent;
+import org.apache.camel.util.ObjectHelper;
+
+@Component("whatsapp")
+public class WhatsAppComponent extends DefaultComponent {
+
+ public static final String API_DEFAULT_URL = "https://graph.facebook.com";
+ public static final String API_DEFAULT_VERSION = "v13.0";
+
+ @Metadata(required = true, description = "Phone Number ID taken from WhatsApp Meta for Developers Dashboard")
+ private String phoneNumberId;
+ @Metadata(label = "security", secret = true, required = true,
+ description = "Authorization Token taken from WhatsApp Meta for Developers Dashboard")
+ private String authorizationToken;
+
+ @Metadata(label = "advanced", description = "Java 11 HttpClient implementation")
+ private HttpClient client;
+ @Metadata(label = "advanced", defaultValue = API_DEFAULT_URL,
+ description = "Can be used to set an alternative base URI, e.g. when you want to test the component against a mock WhatsApp API")
+ private String baseUri = API_DEFAULT_URL;
+ @Metadata(label = "advanced", defaultValue = API_DEFAULT_VERSION, description = "WhatsApp Cloud API version")
+ private String apiVersion = API_DEFAULT_VERSION;
+ @Metadata(description = "Webhook verify token", label = "advanced", secret = true)
+ private String webhookVerifyToken;
+
+ public WhatsAppComponent() {
+ }
+
+ @Override
+ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+ WhatsAppConfiguration configuration = new WhatsAppConfiguration();
+
+ if (configuration.getBaseUri() == null) {
+ configuration.setBaseUri(baseUri);
+ }
+ if (configuration.getApiVersion() == null) {
+ configuration.setApiVersion(apiVersion);
+ }
+ if (configuration.getWebhookVerifyToken() == null) {
+ configuration.setWebhookVerifyToken(webhookVerifyToken);
+ }
+
+ configuration.setAuthorizationToken(authorizationToken);
+
+ if (remaining.endsWith("/")) {
+ remaining = remaining.substring(0, remaining.length() - 1);
+ }
+ configuration.setPhoneNumberId(remaining);
+
+ WhatsAppEndpoint endpoint = new WhatsAppEndpoint(uri, this, configuration, client);
+
+ setProperties(endpoint, parameters);
+
+ if (ObjectHelper.isEmpty(endpoint.getConfiguration().getAuthorizationToken())) {
+ throw new IllegalArgumentException(
+ "AuthorizationToken must be configured on either component or endpoint for whatsapp: " + uri);
+ }
+
+ return endpoint;
+ }
+
+ public String getPhoneNumberId() {
+ return phoneNumberId;
+ }
+
+ public void setPhoneNumberId(String phoneNumberId) {
+ this.phoneNumberId = phoneNumberId;
+ }
+
+ public String getAuthorizationToken() {
+ return authorizationToken;
+ }
+
+ public void setAuthorizationToken(String authorizationToken) {
+ this.authorizationToken = authorizationToken;
+ }
+
+ public HttpClient getClient() {
+ return client;
+ }
+
+ public void setClient(HttpClient client) {
+ this.client = client;
+ }
+
+ public String getBaseUri() {
+ return baseUri;
+ }
+
+ public void setBaseUri(String baseUri) {
+ this.baseUri = baseUri;
+ }
+
+ public String getApiVersion() {
+ return apiVersion;
+ }
+
+ public void setApiVersion(String apiVersion) {
+ this.apiVersion = apiVersion;
+ }
+
+ public String getWebhookVerifyToken() {
+ return webhookVerifyToken;
+ }
+
+ public void setWebhookVerifyToken(String webhookVerifyToken) {
+ this.webhookVerifyToken = webhookVerifyToken;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConfiguration.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConfiguration.java
new file mode 100644
index 00000000000..a239a585359
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConfiguration.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+import org.apache.camel.spi.UriPath;
+
+@UriParams
+public class WhatsAppConfiguration {
+
+ @UriParam(description = "The authorization access token taken from whatsapp-business dashboard.", label = "security",
+ secret = true)
+ @Metadata(required = true)
+ private String authorizationToken;
+
+ @UriPath(description = "The phone number ID taken from whatsapp-business dashboard.")
+ @Metadata(required = true)
+ private String phoneNumberId;
+
+ @UriParam(label = "advanced",
+ description = "Can be used to set an alternative base URI, e.g. when you want to test the component against a mock WhatsApp API")
+ private String baseUri;
+
+ @UriParam(description = "Facebook graph api version.", label = "advanced")
+ private String apiVersion;
+
+ @UriParam(description = "Webhook verify token", label = "advanced")
+ private String webhookVerifyToken;
+
+ @UriParam(description = "Webhook path", label = "advanced", defaultValue = "webhook")
+ private String webhookPath = "camel-whatsapp/webhook";
+
+ public WhatsAppConfiguration() {
+ }
+
+ public String getAuthorizationToken() {
+ return authorizationToken;
+ }
+
+ public void setAuthorizationToken(String authorizationToken) {
+ this.authorizationToken = authorizationToken;
+ }
+
+ public String getApiVersion() {
+ return apiVersion;
+ }
+
+ public void setApiVersion(String apiVersion) {
+ this.apiVersion = apiVersion;
+ }
+
+ public String getPhoneNumberId() {
+ return phoneNumberId;
+ }
+
+ public void setPhoneNumberId(String phoneNumberId) {
+ this.phoneNumberId = phoneNumberId;
+ }
+
+ public String getBaseUri() {
+ return baseUri;
+ }
+
+ public void setBaseUri(String baseUri) {
+ this.baseUri = baseUri;
+ }
+
+ public String getWebhookVerifyToken() {
+ return webhookVerifyToken;
+ }
+
+ public void setWebhookVerifyToken(String webhookVerifyToken) {
+ this.webhookVerifyToken = webhookVerifyToken;
+ }
+
+ public String getWebhookPath() {
+ return webhookPath;
+ }
+
+ public void setWebhookPath(String webhookPath) {
+ this.webhookPath = webhookPath;
+ }
+
+ @Override
+ public String toString() {
+ return "WhatsAppConfiguration{" + "authorizationToken='" + authorizationToken + '\'' + ", baseUri='" + baseUri + '\''
+ + ", apiVersion='" + apiVersion + '\''
+ + ", phoneNumberId='" + phoneNumberId + '\'' + '}';
+ }
+}
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
new file mode 100644
index 00000000000..387c997ea63
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConstants.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import org.apache.camel.spi.Metadata;
+
+public final class WhatsAppConstants {
+
+ @Metadata(label = "producer", description = "Phone Number ID taken from WhatsApp Meta for Developers Dashboard",
+ javaType = "Object")
+ public static final String WHATSAPP_PHONE_NUMBER_ID = "CamelWhatsAppPhoneNumberId";
+
+ @Metadata(label = "producer", description = "Recipient phone number associated with Phone Number ID", javaType = "Object")
+ public static final String WHATSAPP_RECIPIENT_PHONE_NUMBER_ID = "CamelWhatsAppRecipientPhoneNumberId";
+
+ private WhatsAppConstants() {
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppEndpoint.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppEndpoint.java
new file mode 100644
index 00000000000..b0b388c1eb1
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppEndpoint.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import java.net.http.HttpClient;
+import java.time.Duration;
+import java.util.List;
+
+import org.apache.camel.Category;
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.webhook.WebhookCapableEndpoint;
+import org.apache.camel.component.webhook.WebhookConfiguration;
+import org.apache.camel.component.whatsapp.service.WhatsAppServiceRestAPIAdapter;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.support.ScheduledPollEndpoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Send messages.
+ */
+@UriEndpoint(firstVersion = "3.18.0", scheme = "whatsapp", title = "WhatsApp", syntax = "whatsapp:type",
+ category = {
+ Category.CLOUD, Category.API,
+ Category.CHAT },
+ headersClass = WhatsAppConstants.class)
+public class WhatsAppEndpoint extends ScheduledPollEndpoint implements WebhookCapableEndpoint {
+ private static final Logger LOG = LoggerFactory.getLogger(WhatsAppEndpoint.class);
+
+ @UriParam
+ private WhatsAppConfiguration configuration;
+
+ @UriParam(label = "advanced", description = "HttpClient implementation")
+ private HttpClient httpClient;
+ @UriParam(label = "advanced", description = "WhatsApp service implementation")
+ private WhatsAppService whatsappService;
+
+ private WebhookConfiguration webhookConfiguration;
+
+ public WhatsAppEndpoint(String endpointUri, Component component, WhatsAppConfiguration configuration, HttpClient client) {
+ super(endpointUri, component);
+ this.configuration = configuration;
+ this.httpClient = client;
+ }
+
+ @Override
+ protected void doStart() throws Exception {
+ super.doStart();
+ if (httpClient == null) {
+ httpClient
+ = HttpClient.newBuilder().version(HttpClient.Version.HTTP_2).connectTimeout(Duration.ofSeconds(10)).build();
+ }
+ if (whatsappService == null) {
+ whatsappService = new WhatsAppServiceRestAPIAdapter(
+ httpClient, configuration.getBaseUri(), configuration.getApiVersion(), configuration.getPhoneNumberId(),
+ configuration.getAuthorizationToken());
+ }
+ LOG.debug("client {}", httpClient);
+ LOG.debug("whatsappService {}", whatsappService);
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ super.doStop();
+ // ensure client is closed when stopping
+ httpClient = null;
+ }
+
+ @Override
+ public Producer createProducer() throws Exception {
+ return new WhatsAppProducer(this);
+ }
+
+ @Override
+ public Consumer createConsumer(Processor processor) throws Exception {
+ return null;
+ }
+
+ @Override
+ public Processor createWebhookHandler(Processor next) {
+ return new WhatsAppWebhookProcessor(next, configuration);
+ }
+
+ @Override
+ public List<String> getWebhookMethods() {
+ return List.of("POST", "GET");
+ }
+
+ @Override
+ public void registerWebhook() throws Exception {
+ }
+
+ @Override
+ public void setWebhookConfiguration(WebhookConfiguration webhookConfiguration) {
+ webhookConfiguration.setWebhookPath(configuration.getWebhookPath());
+
+ this.webhookConfiguration = webhookConfiguration;
+ }
+
+ @Override
+ public void unregisterWebhook() throws Exception {
+ }
+
+ public WhatsAppConfiguration getConfiguration() {
+ return configuration;
+ }
+
+ public void setConfiguration(WhatsAppConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ public WhatsAppService getWhatsappService() {
+ return whatsappService;
+ }
+
+ public void setWhatsappService(WhatsAppService whatsappService) {
+ this.whatsappService = whatsappService;
+ }
+
+ public HttpClient getHttpClient() {
+ return httpClient;
+ }
+
+ public void setHttpClient(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ }
+
+ public WebhookConfiguration getWebhookConfiguration() {
+ return webhookConfiguration;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppProducer.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppProducer.java
new file mode 100644
index 00000000000..a30cb492b75
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppProducer.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+import org.apache.camel.support.DefaultAsyncProducer;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A producer that sends messages to WhatsApp through the Business Cloud API.
+ */
+public class WhatsAppProducer extends DefaultAsyncProducer {
+ private static final Logger LOG = LoggerFactory.getLogger(WhatsAppProducer.class);
+
+ private WhatsAppEndpoint endpoint;
+
+ public WhatsAppProducer(WhatsAppEndpoint endpoint) {
+ super(endpoint);
+ this.endpoint = endpoint;
+ }
+
+ @Override
+ public boolean process(Exchange exchange, AsyncCallback callback) {
+ if (exchange.getIn().getBody() == null) {
+ // fail fast
+ LOG.debug("Received exchange with empty body, skipping");
+ callback.done(true);
+ return true;
+ }
+
+ // WhatsAppConfiguration config = endpoint.getConfiguration();
+
+ // 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);
+ return false;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppService.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppService.java
new file mode 100644
index 00000000000..058211addad
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppService.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+
+/**
+ * Send messages to WhatsApp Business Cloud API
+ */
+public interface WhatsAppService {
+
+ void sendMessage(Exchange exchange, AsyncCallback callback, BaseMessage message);
+
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppWebhookProcessor.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppWebhookProcessor.java
new file mode 100644
index 00000000000..0099f125378
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppWebhookProcessor.java
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.AsyncProcessor;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.support.AsyncProcessorConverterHelper;
+import org.apache.camel.support.AsyncProcessorSupport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WhatsAppWebhookProcessor extends AsyncProcessorSupport implements AsyncProcessor {
+ private static final Logger LOG = LoggerFactory.getLogger(WhatsAppWebhookProcessor.class);
+
+ private static final String MODE_QUERY_PARAM = "hub.mode";
+ private static final String VERIFY_TOKEN_QUERY_PARAM = "hub.verify_token";
+ private static final String CHALLENGE_QUERY_PARAM = "hub.challenge";
+
+ private final WhatsAppConfiguration configuration;
+
+ private AsyncProcessor next;
+
+ public WhatsAppWebhookProcessor(Processor next, WhatsAppConfiguration configuration) {
+ this.next = AsyncProcessorConverterHelper.convert(next);
+ this.configuration = configuration;
+ }
+
+ @Override
+ public boolean process(Exchange exchange, AsyncCallback callback) {
+ String content;
+ AtomicBoolean isGet = new AtomicBoolean(false);
+
+ if ("GET".equalsIgnoreCase(exchange.getIn().getHeader(Exchange.HTTP_METHOD).toString())) {
+ isGet.set(true);
+ // Parse params from the webhook verification request
+ Map<String, String> queryParams = parseQueryParam(exchange);
+
+ String mode = queryParams.get(MODE_QUERY_PARAM);
+ String token = queryParams.get(VERIFY_TOKEN_QUERY_PARAM);
+ String challenge = queryParams.get(CHALLENGE_QUERY_PARAM);
+
+ if (mode != null && token != null) {
+ if ("subscribe".equals(mode) && token.equals(configuration.getWebhookVerifyToken())) {
+ LOG.info("WhatsApp Webhook verified and subscribed");
+ content = challenge;
+ } else {
+ content = null;
+ exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE, 403);
+ }
+ } else {
+ LOG.error("{} or {} missing from request query param", MODE_QUERY_PARAM, VERIFY_TOKEN_QUERY_PARAM);
+ content = null;
+ exchange.getMessage().setHeader(Exchange.HTTP_RESPONSE_CODE, 400);
+ }
+ } else {
+ isGet.set(false);
+ InputStream body = exchange.getIn().getBody(InputStream.class);
+
+ try {
+ content = new String(body.readAllBytes());
+ } catch (IOException e) {
+ exchange.setException(e);
+ callback.done(true);
+ return true;
+ }
+ }
+
+ exchange.getMessage().setBody(content);
+
+ return next.process(exchange, doneSync -> {
+ // No response data expected
+ if (!isGet.get()) {
+ exchange.getMessage().setBody(content);
+ } else {
+ exchange.getMessage().setBody("");
+ }
+
+ callback.done(doneSync);
+ });
+ }
+
+ private Map<String, String> parseQueryParam(Exchange exchange) {
+ Map<String, String> queryParams = new HashMap<>();
+
+ if (exchange.getIn().getHeader(Exchange.HTTP_QUERY) != null) {
+ String[] pairs = exchange.getIn().getHeader(Exchange.HTTP_QUERY).toString().split("&");
+ for (String pair : pairs) {
+ String[] keyValuePair = pair.split("=");
+
+ queryParams.put(keyValuePair[0], keyValuePair[1]);
+ }
+ }
+
+ return queryParams;
+ }
+
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Action.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Action.java
new file mode 100644
index 00000000000..9bc2215a220
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Action.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.util.List;
+
+public class Action {
+ private String button;
+ private List<Button> buttons;
+ private List<Section> sections;
+
+ public Action() {
+ }
+
+ public String getButton() {
+ return button;
+ }
+
+ public void setButton(String button) {
+ this.button = button;
+ }
+
+ public List<Button> getButtons() {
+ return buttons;
+ }
+
+ public void setButtons(List<Button> buttons) {
+ this.buttons = buttons;
+ }
+
+ public List<Section> getSections() {
+ return sections;
+ }
+
+ public void setSections(List<Section> sections) {
+ this.sections = sections;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Address.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Address.java
new file mode 100644
index 00000000000..077ef6f0b8e
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Address.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Address {
+
+ private String street;
+ private String city;
+ private String state;
+ private String zip;
+ private String country;
+ @JsonProperty("country_code")
+ private String countryCode;
+ /**
+ * Standard Values: HOME, WORK
+ */
+ private String type;
+
+ public Address() {
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getZip() {
+ return zip;
+ }
+
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public String getCountryCode() {
+ return countryCode;
+ }
+
+ public void setCountryCode(String countryCode) {
+ this.countryCode = countryCode;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/BaseMessage.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/BaseMessage.java
new file mode 100644
index 00000000000..e355700cf9e
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/BaseMessage.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class BaseMessage {
+
+ /**
+ * Messaging service used for the request. Use "whatsapp".
+ */
+ @JsonProperty("messaging_product")
+ private String messagingProduct = "whatsapp";
+
+ /**
+ * Currently, you can only send messages to individuals. Set this as individual.
+ */
+ @JsonProperty("recipient_type")
+ private String recipientType = "individual";
+
+ /**
+ * WhatsApp ID or phone number for the person you want to send a message to.
+ */
+ private String to;
+
+ /**
+ * The type of message you want to send. Default: text Supported Options audio: for audio messages. contacts: for
+ * contact messages. document: for document messages. image: for image messages. interactive: for list and reply
+ * button messages. location: for location messages. sticker: for sticker messages. template: for template messages.
+ * Text and media (images and documents) message templates are supported. text: for text messages.
+ */
+ private String type = "text";
+
+ public BaseMessage() {
+ }
+
+ public String getMessagingProduct() {
+ return messagingProduct;
+ }
+
+ public void setMessagingProduct(String messagingProduct) {
+ this.messagingProduct = messagingProduct;
+ }
+
+ public String getRecipientType() {
+ return recipientType;
+ }
+
+ public void setRecipientType(String recipientType) {
+ this.recipientType = recipientType;
+ }
+
+ public String getTo() {
+ return to;
+ }
+
+ public void setTo(String to) {
+ this.to = to;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Body.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Body.java
new file mode 100644
index 00000000000..c2deccf8420
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Body.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class Body {
+
+ private String type;
+ private String text;
+
+ public Body() {
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Button.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Button.java
new file mode 100644
index 00000000000..8de952d2691
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Button.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class Button {
+
+ private String type = "reply";
+ private Reply reply;
+
+ public Button() {
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public Reply getReply() {
+ return reply;
+ }
+
+ public void setReply(Reply reply) {
+ this.reply = reply;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Component.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Component.java
new file mode 100644
index 00000000000..7eb031dd70a
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Component.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Component {
+
+ private String type;
+ @JsonProperty("sub_type")
+ private String subType;
+ private List<Parameter> parameters;
+ private String index;
+
+ public Component() {
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getSubType() {
+ return subType;
+ }
+
+ public void setSubType(String subType) {
+ this.subType = subType;
+ }
+
+ public List<Parameter> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(List<Parameter> parameters) {
+ this.parameters = parameters;
+ }
+
+ public String getIndex() {
+ return index;
+ }
+
+ public void setIndex(String index) {
+ this.index = index;
+ }
+
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Contact.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Contact.java
new file mode 100644
index 00000000000..b8b11ac1d50
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Contact.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Contact {
+
+ private String input;
+
+ @JsonProperty("wa_id")
+ private String waId;
+
+ public Contact() {
+ }
+
+ public String getInput() {
+ return input;
+ }
+
+ public void setInput(String input) {
+ this.input = input;
+ }
+
+ public String getWaId() {
+ return waId;
+ }
+
+ public void setWaId(String waId) {
+ this.waId = waId;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/ContactMessage.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/ContactMessage.java
new file mode 100644
index 00000000000..8a1809da349
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/ContactMessage.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.time.LocalDate;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+public class ContactMessage {
+
+ private List<Address> addresses;
+
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private LocalDate birthday;
+ private List<Email> emails;
+ private Name name;
+ private Org org;
+ private List<Phone> phones;
+ private List<Url> urls;
+
+ public ContactMessage() {
+ }
+
+ public List<Address> getAddresses() {
+ return addresses;
+ }
+
+ public void setAddresses(List<Address> addresses) {
+ this.addresses = addresses;
+ }
+
+ public LocalDate getBirthday() {
+ return birthday;
+ }
+
+ public void setBirthday(LocalDate birthday) {
+ this.birthday = birthday;
+ }
+
+ public List<Email> getEmails() {
+ return emails;
+ }
+
+ public void setEmails(List<Email> emails) {
+ this.emails = emails;
+ }
+
+ public Name getName() {
+ return name;
+ }
+
+ public void setName(Name name) {
+ this.name = name;
+ }
+
+ public Org getOrg() {
+ return org;
+ }
+
+ public void setOrg(Org org) {
+ this.org = org;
+ }
+
+ public List<Phone> getPhones() {
+ return phones;
+ }
+
+ public void setPhones(List<Phone> phones) {
+ this.phones = phones;
+ }
+
+ public List<Url> getUrls() {
+ return urls;
+ }
+
+ public void setUrls(List<Url> urls) {
+ this.urls = urls;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/ContactMessageRequest.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/ContactMessageRequest.java
new file mode 100644
index 00000000000..110c9e54aba
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/ContactMessageRequest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.util.List;
+
+public class ContactMessageRequest extends BaseMessage {
+
+ private List<ContactMessage> contacts;
+
+ public ContactMessageRequest() {
+ setType("contacts");
+ }
+
+ public List<ContactMessage> getContacts() {
+ return contacts;
+ }
+
+ public void setContacts(List<ContactMessage> contacts) {
+ this.contacts = contacts;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Currency.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Currency.java
new file mode 100644
index 00000000000..9cc7fa95a36
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Currency.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Currency {
+
+ @JsonProperty("fallback_value")
+ private String fallbackValue;
+ /**
+ * Currency code as defined in ISO 4217.
+ */
+ private String code;
+ /**
+ * Amount multiplied by 1000.
+ */
+ @JsonProperty("amount_1000")
+ private String amount1000;
+
+ public Currency() {
+ }
+
+ public String getFallbackValue() {
+ return fallbackValue;
+ }
+
+ public void setFallbackValue(String fallbackValue) {
+ this.fallbackValue = fallbackValue;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getAmount1000() {
+ return amount1000;
+ }
+
+ public void setAmount1000(String amount1000) {
+ this.amount1000 = amount1000;
+ }
+
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/DateTime.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/DateTime.java
new file mode 100644
index 00000000000..3b71c8fee35
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/DateTime.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class DateTime {
+
+ @JsonProperty("fallback_value")
+ private String fallbackValue;
+
+ public DateTime() {
+ }
+
+ public String getFallbackValue() {
+ return fallbackValue;
+ }
+
+ public void setFallbackValue(String fallbackValue) {
+ this.fallbackValue = fallbackValue;
+ }
+
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Email.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Email.java
new file mode 100644
index 00000000000..64d87050bad
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Email.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class Email {
+
+ private String email;
+ /**
+ * Standard Values: HOME, WORK
+ */
+ private String type;
+
+ public Email() {
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Header.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Header.java
new file mode 100644
index 00000000000..3abf3394a21
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Header.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class Header {
+ private String type;
+ private String text;
+ private MediaMessage video;
+ private MediaMessage image;
+ private MediaMessage document;
+
+ public Header() {
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public MediaMessage getVideo() {
+ return video;
+ }
+
+ public void setVideo(MediaMessage video) {
+ this.video = video;
+ }
+
+ public MediaMessage getImage() {
+ return image;
+ }
+
+ public void setImage(MediaMessage image) {
+ this.image = image;
+ }
+
+ public MediaMessage getDocument() {
+ return document;
+ }
+
+ public void setDocument(MediaMessage document) {
+ this.document = document;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/InteractiveMessage.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/InteractiveMessage.java
new file mode 100644
index 00000000000..ff7ebe1383a
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/InteractiveMessage.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class InteractiveMessage {
+ public Action action;
+ public Body body;
+ private Body footer;
+ private Header header;
+ /**
+ * The type of interactive message you want to send. Supported Options list: Use it for List Messages. button: Use
+ * it for Reply Buttons.
+ */
+ private String type;
+
+ public InteractiveMessage() {
+
+ }
+
+ public Action getAction() {
+ return action;
+ }
+
+ public void setAction(Action action) {
+ this.action = action;
+ }
+
+ public Body getBody() {
+ return body;
+ }
+
+ public void setBody(Body body) {
+ this.body = body;
+ }
+
+ public Body getFooter() {
+ return footer;
+ }
+
+ public void setFooter(Body footer) {
+ this.footer = footer;
+ }
+
+ public Header getHeader() {
+ return header;
+ }
+
+ public void setHeader(Header header) {
+ this.header = header;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/InteractiveMessageRequest.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/InteractiveMessageRequest.java
new file mode 100644
index 00000000000..296a94c832c
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/InteractiveMessageRequest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class InteractiveMessageRequest extends BaseMessage {
+
+ private InteractiveMessage interactive;
+
+ public InteractiveMessageRequest() {
+ setType("interactive");
+ }
+
+ public InteractiveMessage getInteractive() {
+ return interactive;
+ }
+
+ public void setInteractive(InteractiveMessage interactive) {
+ this.interactive = interactive;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Language.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Language.java
new file mode 100644
index 00000000000..4c43a71e61e
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Language.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class Language {
+
+ private String policy = "deterministic";
+ private String code;
+
+ public Language() {
+ }
+
+ public String getPolicy() {
+ return policy;
+ }
+
+ public void setPolicy(String policy) {
+ this.policy = policy;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/LocationMessage.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/LocationMessage.java
new file mode 100644
index 00000000000..45ac0705acb
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/LocationMessage.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class LocationMessage {
+
+ private String longitude;
+ private String latitude;
+ private String name;
+ private String address;
+
+ public LocationMessage() {
+ }
+
+ public String getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(String longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(String latitude) {
+ this.latitude = latitude;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/LocationMessageRequest.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/LocationMessageRequest.java
new file mode 100644
index 00000000000..cfc3486de05
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/LocationMessageRequest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class LocationMessageRequest extends BaseMessage {
+
+ private LocationMessage location;
+
+ public LocationMessageRequest() {
+ setType("location");
+ }
+
+ public LocationMessage getLocation() {
+ return location;
+ }
+
+ public void setLocation(LocationMessage location) {
+ this.location = location;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/MediaMessage.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/MediaMessage.java
new file mode 100644
index 00000000000..21ee8feb533
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/MediaMessage.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class MediaMessage {
+
+ /**
+ * The media object ID. Do not use this field when the message type is set to text.
+ */
+ private String id;
+
+ /**
+ * The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. Do not use this field when the
+ * message type is set to text.
+ */
+ private String link;
+
+ /**
+ * Describes the specified document or image media. Do not use with audio media.
+ */
+ private String caption;
+
+ /**
+ * Describes the filename for the specific document. Use only with document media.
+ */
+ private String filename;
+
+ public MediaMessage() {
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+ public String getCaption() {
+ return caption;
+ }
+
+ public void setCaption(String caption) {
+ this.caption = caption;
+ }
+
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/MediaMessageRequest.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/MediaMessageRequest.java
new file mode 100644
index 00000000000..5b6a4949409
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/MediaMessageRequest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.util.Collections;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+public class MediaMessageRequest extends BaseMessage {
+
+ /**
+ * one of audio, document, image, video, and sticker
+ */
+ @JsonIgnore
+ private String objectName;
+
+ @JsonIgnore
+ private MediaMessage mediaMessage;
+
+ public MediaMessageRequest(String objectName, MediaMessage mediaMessage) {
+ this.objectName = objectName;
+ this.mediaMessage = mediaMessage;
+
+ setType(objectName);
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> any() {
+ return Collections.singletonMap(objectName, mediaMessage);
+ }
+
+ public String getObjectName() {
+ return objectName;
+ }
+
+ public void setObjectName(String objectName) {
+ this.objectName = objectName;
+ }
+
+ public MediaMessage getMediaMessage() {
+ return mediaMessage;
+ }
+
+ public void setMediaMessage(MediaMessage mediaMessage) {
+ this.mediaMessage = mediaMessage;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Message.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Message.java
new file mode 100644
index 00000000000..395e13ef9bd
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Message.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class Message {
+
+ private String id;
+
+ public Message() {
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/MessageResponse.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/MessageResponse.java
new file mode 100644
index 00000000000..74309a737c6
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/MessageResponse.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class MessageResponse {
+
+ @JsonProperty("messaging_product")
+ private String messagingProduct = "whatsapp";
+
+ private List<Contact> contacts;
+
+ private List<Message> messages;
+
+ private String id;
+
+ public MessageResponse() {
+ }
+
+ public String getMessagingProduct() {
+ return messagingProduct;
+ }
+
+ public void setMessagingProduct(String messagingProduct) {
+ this.messagingProduct = messagingProduct;
+ }
+
+ public List<Contact> getContacts() {
+ return contacts;
+ }
+
+ public void setContacts(List<Contact> contacts) {
+ this.contacts = contacts;
+ }
+
+ public List<Message> getMessages() {
+ return messages;
+ }
+
+ public void setMessages(List<Message> messages) {
+ this.messages = messages;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Name.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Name.java
new file mode 100644
index 00000000000..40ff9cef72f
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Name.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Name {
+
+ @JsonProperty("formatted_name")
+ private String formattedName;
+
+ @JsonProperty("first_name")
+ private String firstName;
+
+ @JsonProperty("last_name")
+ private String lastName;
+
+ @JsonProperty("middle_name")
+ private String middleName;
+
+ private String suffix;
+
+ private String prefix;
+
+ public Name() {
+ }
+
+ public String getFormattedName() {
+ return formattedName;
+ }
+
+ public void setFormattedName(String formattedName) {
+ this.formattedName = formattedName;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getMiddleName() {
+ return middleName;
+ }
+
+ public void setMiddleName(String middleName) {
+ this.middleName = middleName;
+ }
+
+ public String getSuffix() {
+ return suffix;
+ }
+
+ public void setSuffix(String suffix) {
+ this.suffix = suffix;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Org.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Org.java
new file mode 100644
index 00000000000..ae6e203174d
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Org.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class Org {
+
+ private String company;
+ private String department;
+ private String title;
+
+ public Org() {
+ }
+
+ public String getCompany() {
+ return company;
+ }
+
+ public void setCompany(String company) {
+ this.company = company;
+ }
+
+ public String getDepartment() {
+ return department;
+ }
+
+ public void setDepartment(String department) {
+ this.department = department;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Parameter.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Parameter.java
new file mode 100644
index 00000000000..46c62607759
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Parameter.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Parameter {
+
+ private String type;
+ private String text;
+ private Currency currency;
+ @JsonProperty("date_time")
+ private DateTime dateTime;
+ private MediaMessage image;
+ private MediaMessage document;
+ private MediaMessage video;
+
+ public Parameter() {
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public Currency getCurrency() {
+ return currency;
+ }
+
+ public void setCurrency(Currency currency) {
+ this.currency = currency;
+ }
+
+ public DateTime getDateTime() {
+ return dateTime;
+ }
+
+ public void setDateTime(DateTime dateTime) {
+ this.dateTime = dateTime;
+ }
+
+ public MediaMessage getImage() {
+ return image;
+ }
+
+ public void setImage(MediaMessage image) {
+ this.image = image;
+ }
+
+ public MediaMessage getDocument() {
+ return document;
+ }
+
+ public void setDocument(MediaMessage document) {
+ this.document = document;
+ }
+
+ public MediaMessage getVideo() {
+ return video;
+ }
+
+ public void setVideo(MediaMessage video) {
+ this.video = video;
+ }
+
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Phone.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Phone.java
new file mode 100644
index 00000000000..a4a436e423c
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Phone.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Phone {
+
+ private String phone;
+ /**
+ * Standard Values: CELL, MAIN, IPHONE, HOME, WORK
+ */
+ private String type;
+ @JsonProperty("wa_id")
+ private String waId;
+
+ public Phone() {
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getWaId() {
+ return waId;
+ }
+
+ public void setWaId(String waId) {
+ this.waId = waId;
+ }
+
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Reply.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Reply.java
new file mode 100644
index 00000000000..46d3da812bb
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Reply.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class Reply {
+
+ private String title;
+ private String id;
+
+ public Reply() {
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Section.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Section.java
new file mode 100644
index 00000000000..f07f2c7bf51
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Section.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.util.List;
+
+public class Section {
+
+ private String title;
+ private List<Object> rows;
+
+ public Section() {
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public List<Object> getRows() {
+ return rows;
+ }
+
+ public void setRows(List<Object> rows) {
+ this.rows = rows;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TempalteMessage.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TempalteMessage.java
new file mode 100644
index 00000000000..7f20e87fe9f
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TempalteMessage.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.util.List;
+
+public class TempalteMessage {
+
+ private String name;
+ private Language language;
+ private List<Component> components;
+
+ public TempalteMessage() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Language getLanguage() {
+ return language;
+ }
+
+ public void setLanguage(Language language) {
+ this.language = language;
+ }
+
+ public List<Component> getComponents() {
+ return components;
+ }
+
+ public void setComponents(List<Component> components) {
+ this.components = components;
+ }
+
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TemplateMessageRequest.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TemplateMessageRequest.java
new file mode 100644
index 00000000000..7604bddf2a3
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TemplateMessageRequest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class TemplateMessageRequest extends BaseMessage {
+
+ private TempalteMessage template;
+
+ public TemplateMessageRequest() {
+ setType("template");
+ }
+
+ public TempalteMessage getTemplate() {
+ return template;
+ }
+
+ public void setTemplate(TempalteMessage template) {
+ this.template = template;
+ }
+
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TextMessage.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TextMessage.java
new file mode 100644
index 00000000000..769d1e3dd73
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TextMessage.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TextMessage {
+
+ @JsonProperty("preview_url")
+ private boolean previewUrl;
+
+ private String body;
+
+ public TextMessage() {
+ }
+
+ public boolean isPreviewUrl() {
+ return previewUrl;
+ }
+
+ public void setPreviewUrl(boolean previewUrl) {
+ this.previewUrl = previewUrl;
+ }
+
+ public String getBody() {
+ return body;
+ }
+
+ public void setBody(String body) {
+ this.body = body;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TextMessageRequest.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TextMessageRequest.java
new file mode 100644
index 00000000000..e2b9d8194a4
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/TextMessageRequest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class TextMessageRequest extends BaseMessage {
+
+ private TextMessage text;
+
+ public TextMessageRequest() {
+ }
+
+ public TextMessage getText() {
+ return text;
+ }
+
+ public void setText(TextMessage text) {
+ this.text = text;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/UploadMedia.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/UploadMedia.java
new file mode 100644
index 00000000000..ff3f4985280
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/UploadMedia.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Objects;
+
+import org.apache.camel.RuntimeCamelException;
+
+public class UploadMedia {
+
+ private File file;
+ private String contentType;
+ private String name;
+ private InputStream fileStream;
+
+ public UploadMedia(File file, String contentType) {
+ this.file = Objects.requireNonNull(file);
+ this.contentType = Objects.requireNonNull(contentType);
+
+ if (!file.exists()) {
+ throw new RuntimeCamelException("The file provided does not exists");
+ }
+ }
+
+ public UploadMedia(String name, InputStream fileStream, String contentType) {
+ this.name = Objects.requireNonNull(name);
+ this.fileStream = Objects.requireNonNull(fileStream);
+ this.contentType = Objects.requireNonNull(contentType);
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public InputStream getFileStream() {
+ return fileStream;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/UploadMediaRequest.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/UploadMediaRequest.java
new file mode 100644
index 00000000000..8f9517ca82d
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/UploadMediaRequest.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class UploadMediaRequest extends BaseMessage {
+ private UploadMedia uploadMedia;
+
+ public UploadMediaRequest() {
+ }
+
+ public UploadMedia getUploadMedia() {
+ return uploadMedia;
+ }
+
+ public void setUploadMedia(UploadMedia uploadMedia) {
+ this.uploadMedia = uploadMedia;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Url.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Url.java
new file mode 100644
index 00000000000..71c11d10e69
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/Url.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+public class Url {
+
+ private String url;
+ private String type;
+
+ public Url() {
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java
new file mode 100644
index 00000000000..ef6d748f3a2
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpRequest.BodyPublisher;
+import java.net.http.HttpRequest.BodyPublishers;
+import java.net.http.HttpRequest.Builder;
+import java.net.http.HttpResponse;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.CompletableFuture;
+import java.util.function.Supplier;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.whatsapp.WhatsAppService;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+import org.apache.camel.component.whatsapp.model.ContactMessageRequest;
+import org.apache.camel.component.whatsapp.model.InteractiveMessageRequest;
+import org.apache.camel.component.whatsapp.model.LocationMessageRequest;
+import org.apache.camel.component.whatsapp.model.MediaMessageRequest;
+import org.apache.camel.component.whatsapp.model.MessageResponse;
+import org.apache.camel.component.whatsapp.model.TemplateMessageRequest;
+import org.apache.camel.component.whatsapp.model.TextMessageRequest;
+import org.apache.camel.component.whatsapp.model.UploadMediaRequest;
+import org.apache.camel.component.whatsapp.util.FileUploadStreamSupplier;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Java11 Http Client implementation
+ */
+public class WhatsAppServiceRestAPIAdapter implements WhatsAppService {
+ private static final Logger LOG = LoggerFactory.getLogger(WhatsAppServiceRestAPIAdapter.class);
+
+ private static final String MESSAGES_ENDPOINT = "/messages";
+ private static final String MEDIA_ENDPOINT = "/media";
+
+ private final Map<Class<?>, WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<?>> handlers;
+ private final ObjectMapper mapper;
+ private final String baseUri;
+ private final String authorizationToken;
+
+ public WhatsAppServiceRestAPIAdapter(HttpClient client, String baseUri, String apiVersion, String phoneNumberId,
+ String authorizationToken) {
+ this.baseUri = baseUri + "/" + apiVersion + "/" + phoneNumberId;
+ this.mapper = new ObjectMapper().registerModule(new JavaTimeModule());
+ this.mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ this.authorizationToken = authorizationToken;
+
+ final Map<Class<?>, WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<?>> m = new HashMap<>();
+ m.put(TextMessageRequest.class, new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+ m.put(MediaMessageRequest.class, new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+ m.put(LocationMessageRequest.class, new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+ m.put(ContactMessageRequest.class, new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+ m.put(InteractiveMessageRequest.class,
+ new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+ m.put(UploadMediaRequest.class, new OutgoingMediaMessageHandler(client, mapper, this.baseUri + MEDIA_ENDPOINT));
+ m.put(TemplateMessageRequest.class, new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+
+ this.handlers = m;
+ }
+
+ @Override
+ public void sendMessage(Exchange exchange, AsyncCallback callback, BaseMessage message) {
+ @SuppressWarnings("unchecked")
+ final WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<BaseMessage> handler
+ = (WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<BaseMessage>) handlers
+ .get(message.getClass());
+
+ ObjectHelper.notNull(handler, "handler");
+
+ try {
+ handler.sendMessage(exchange, callback, message, authorizationToken);
+ } catch (IOException | InterruptedException e) {
+ throw new RuntimeCamelException("Could not send message " + message, e);
+ }
+ }
+
+ static class OutgoingMediaMessageHandler extends WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<UploadMediaRequest> {
+
+ public OutgoingMediaMessageHandler(HttpClient httpClient, ObjectMapper mapper, String uri,
+ Class<? extends MessageResponse> resultClass) {
+ super(httpClient, mapper, uri, null, resultClass);
+ }
+
+ public OutgoingMediaMessageHandler(HttpClient httpClient, ObjectMapper mapper, String uri) {
+ this(httpClient, mapper, uri, MessageResponse.class);
+ }
+
+ @Override
+ protected void addBody(Builder builder, UploadMediaRequest message) {
+ Map<Object, Object> formData = new HashMap<>();
+ formData.put("messaging_product", "whatsapp");
+ formData.put("file", message.getUploadMedia());
+
+ String boundary = new BigInteger(256, new Random()).toString();
+ try {
+ builder.POST(ofStreamPart(formData, boundary));
+ } catch (IOException e) {
+ throw new RuntimeCamelException("Could not serialize " + message, e);
+ }
+
+ builder.header("content-type", "multipart/form-data; boundary=" + boundary);
+ }
+
+ public static BodyPublisher ofStreamPart(Map<Object, Object> data, String boundary) throws IOException {
+ Supplier<? extends InputStream> streamSupplier = new FileUploadStreamSupplier(data, boundary).generate();
+
+ return BodyPublishers.ofInputStream(streamSupplier);
+ }
+ }
+
+ static class OutgoingPlainMessageHandler extends WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<BaseMessage> {
+
+ public OutgoingPlainMessageHandler(HttpClient httpClient, ObjectMapper mapper, String uri,
+ Class<? extends MessageResponse> returnType) {
+ super(httpClient, mapper, uri, "application/json", returnType);
+ }
+
+ public OutgoingPlainMessageHandler(HttpClient httpClient, ObjectMapper mapper, String uri) {
+ this(httpClient, mapper, uri, MessageResponse.class);
+ }
+
+ @Override
+ protected void addBody(Builder builder, BaseMessage message) {
+ try {
+ final String body = mapper.writeValueAsString(message);
+ BodyPublisher bodyPublisher = BodyPublishers.ofString(body);
+ builder.POST(bodyPublisher);
+ } catch (JsonProcessingException e) {
+ throw new RuntimeCamelException("Could not serialize " + message, e);
+ }
+ }
+
+ }
+
+ abstract static class OutgoingMessageHandler<T extends BaseMessage> {
+ protected final ObjectMapper mapper;
+ private final HttpClient httpClient;
+ private final String contentType;
+ private final String uri;
+ private final Class<? extends MessageResponse> resultClass;
+
+ public OutgoingMessageHandler(HttpClient httpClient, ObjectMapper mapper, String uri, String contentType,
+ Class<? extends MessageResponse> resultClass) {
+ this.resultClass = resultClass;
+ this.httpClient = httpClient;
+ this.mapper = mapper;
+ this.uri = uri;
+ this.contentType = contentType;
+ }
+
+ public void sendMessage(Exchange exchange, AsyncCallback callback, T message, String authorizationToken)
+ throws IOException, InterruptedException {
+ HttpRequest.Builder httpRequestBuilder = HttpRequest.newBuilder();
+ if (contentType != null) {
+ httpRequestBuilder.header("content-type", contentType);
+ }
+ httpRequestBuilder.header("Authorization", "Bearer " + authorizationToken);
+ httpRequestBuilder.header("Accept", "application/json");
+
+ addBody(httpRequestBuilder, message);
+
+ httpRequestBuilder.uri(URI.create(this.uri));
+
+ CompletableFuture<HttpResponse<String>> asyncResponse
+ = httpClient.sendAsync(httpRequestBuilder.build(), HttpResponse.BodyHandlers.ofString());
+
+ asyncResponse.thenAccept(response -> {
+ try {
+ int statusCode = response.statusCode();
+ LOG.info("Response received with status {} and body {}", statusCode, response.body());
+ final boolean success = statusCode >= 200 && statusCode < 300;
+ if (success) {
+ final Object result = mapper.readValue(response.body(), resultClass);
+
+ exchange.getMessage().setBody(result);
+ } else {
+ LOG.debug("Error response Headers {}", response.headers());
+ RuntimeException exception = new RuntimeCamelException(
+ uri + " responded: " + statusCode + " and body: " + response.body());
+ exchange.setException(exception);
+ throw exception;
+ }
+ } catch (JsonProcessingException e) {
+ exchange.setException(e);
+ throw RuntimeCamelException.wrapRuntimeCamelException(e);
+ } finally {
+ callback.done(false);
+ }
+ });
+ }
+
+ protected abstract void addBody(HttpRequest.Builder builder, T message);
+ }
+
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/util/FileUploadStreamSupplier.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/util/FileUploadStreamSupplier.java
new file mode 100644
index 00000000000..9d1bb48c8b6
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/util/FileUploadStreamSupplier.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.io.SequenceInputStream;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Supplier;
+
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.whatsapp.model.UploadMedia;
+
+public class FileUploadStreamSupplier {
+
+ private InputStream preFileIS;
+ private InputStream fileIS;
+ private InputStream postFileIS;
+ private final Map<Object, Object> data;
+ private final String boundary;
+
+ public FileUploadStreamSupplier(Map<Object, Object> data, String boundary) {
+ this.data = data;
+ this.boundary = boundary;
+
+ List<byte[]> byteArrays = new ArrayList<>();
+ byte[] boundaryBytes = boundary.getBytes();
+ ByteBuffer separatorBuffer = RestAdapterUtils.generateByteBuffer(RestAdapterUtils.EXTRA_BYTES, boundaryBytes,
+ RestAdapterUtils.NEW_LINE_BYTES,
+ RestAdapterUtils.CONTENT_DISPOSITION_BYTES);
+
+ byte[] separator = separatorBuffer.array();
+
+ for (Map.Entry<Object, Object> entry : data.entrySet()) {
+ byteArrays.add(separator);
+
+ byte[] keyBytes = ((String) entry.getKey()).getBytes();
+
+ if (entry.getValue() instanceof UploadMedia) {
+ UploadMedia uploadMedia = (UploadMedia) entry.getValue();
+
+ generateUploadMediaStream(byteArrays, keyBytes, uploadMedia);
+ } else {
+ byte[] entryStringBytes = entry.getValue().toString().getBytes();
+ ByteBuffer stringBuffer = RestAdapterUtils.generateByteBuffer(RestAdapterUtils.QUOTE_BYTES, keyBytes,
+ RestAdapterUtils.NEW_LINE_BYTES,
+ RestAdapterUtils.NEW_LINE_BYTES, entryStringBytes, RestAdapterUtils.NEW_LINE_BYTES);
+
+ byteArrays.add(stringBuffer.array());
+ }
+ }
+ ByteBuffer endBuffer = RestAdapterUtils.generateByteBuffer(RestAdapterUtils.EXTRA_BYTES, boundaryBytes,
+ RestAdapterUtils.EXTRA_BYTES, RestAdapterUtils.NEW_LINE_BYTES);
+
+ byteArrays.add(endBuffer.array());
+
+ ByteBuffer postFileBytes = RestAdapterUtils.generateByteBuffer(byteArrays);
+ postFileIS = new ByteArrayInputStream(postFileBytes.array());
+ }
+
+ private void generateUploadMediaStream(List<byte[]> byteArrays, byte[] keyBytes, UploadMedia uploadMedia) {
+ byte[] fileNameBytes;
+ if (uploadMedia.getFile() != null) {
+ fileNameBytes = uploadMedia.getFile().toPath().getFileName().toString().getBytes();
+
+ try {
+ fileIS = new FileInputStream(uploadMedia.getFile());
+ } catch (FileNotFoundException e) {
+ throw new RuntimeCamelException(e);
+ }
+ } else {
+ fileNameBytes = uploadMedia.getName().getBytes();
+ fileIS = uploadMedia.getFileStream();
+ }
+
+ byte[] contentTypeBytes = uploadMedia.getContentType().getBytes();
+ ByteBuffer uploadMediaBuffer = RestAdapterUtils.generateByteBuffer(RestAdapterUtils.QUOTE_BYTES, keyBytes,
+ RestAdapterUtils.FILE_NAME_HEADER_BYTES, fileNameBytes,
+ RestAdapterUtils.CONTENT_TYPE_HEADER_BYTES, contentTypeBytes, RestAdapterUtils.NEW_LINE_BYTES,
+ RestAdapterUtils.NEW_LINE_BYTES);
+
+ byteArrays.add(uploadMediaBuffer.array());
+
+ ByteBuffer preFileBytes = RestAdapterUtils.generateByteBuffer(byteArrays);
+
+ preFileIS = new ByteArrayInputStream(preFileBytes.array());
+
+ byteArrays.clear();
+ byteArrays.add(RestAdapterUtils.NEW_LINE_BYTES);
+ }
+
+ public Supplier<? extends InputStream> generate() {
+ return (Supplier<SequenceInputStream>) () -> new SequenceInputStream(
+ preFileIS, new SequenceInputStream(fileIS, postFileIS));
+ }
+
+ public Map<Object, Object> getData() {
+ return data;
+ }
+
+ public String getBoundary() {
+ return boundary;
+ }
+}
diff --git a/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/util/RestAdapterUtils.java b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/util/RestAdapterUtils.java
new file mode 100644
index 00000000000..823c578309a
--- /dev/null
+++ b/components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/util/RestAdapterUtils.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.util;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.List;
+
+public final class RestAdapterUtils {
+
+ public static final byte[] EXTRA_BYTES = "--".getBytes();
+ public static final byte[] NEW_LINE_BYTES = "\r\n".getBytes();
+ public static final byte[] CONTENT_DISPOSITION_BYTES = "Content-Disposition: form-data; name=".getBytes();
+ public static final byte[] QUOTE_BYTES = "\"".getBytes();
+ public static final byte[] FILE_NAME_HEADER_BYTES = "\"; filename=\"".getBytes();
+ public static final byte[] CONTENT_TYPE_HEADER_BYTES = "\"\r\nContent-Type: ".getBytes();
+
+ private RestAdapterUtils() {
+ }
+
+ public static ByteBuffer generateByteBuffer(byte[]... bytes) {
+ int size = Arrays.stream(bytes).map(b -> b.length).reduce(0, Integer::sum);
+
+ return getByteBuffer(size, bytes);
+ }
+
+ private static ByteBuffer getByteBuffer(int size, byte[][] bytes) {
+ ByteBuffer buffer = ByteBuffer.allocate(size);
+
+ for (byte[] byteArray : bytes) {
+ buffer.put(byteArray);
+ }
+
+ return buffer;
+ }
+
+ public static ByteBuffer generateByteBuffer(List<byte[]> bytes) {
+ int size = bytes.stream().map(b -> b.length).reduce(0, Integer::sum);
+
+ ByteBuffer buffer = ByteBuffer.allocate(size);
+
+ for (byte[] byteArray : bytes) {
+ buffer.put(byteArray);
+ }
+
+ return buffer;
+ }
+}
diff --git a/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppApiConfig.java b/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppApiConfig.java
new file mode 100644
index 00000000000..8215d5d02a5
--- /dev/null
+++ b/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppApiConfig.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+public final class WhatsAppApiConfig {
+
+ private final String authorizationToken;
+ private final int port;
+ private final String baseUri;
+ private final String phoneNumberId;
+ private final String apiVersion;
+ private final String recipientPhoneNumber;
+
+ public WhatsAppApiConfig(String baseUri, int port, String authorizationToken, String phoneNumberId, String apiVersion,
+ String recipientPhoneNumber) {
+ this.baseUri = baseUri;
+ this.port = port;
+ this.authorizationToken = authorizationToken;
+ this.phoneNumberId = phoneNumberId;
+ this.apiVersion = apiVersion;
+ this.recipientPhoneNumber = recipientPhoneNumber;
+ }
+
+ public static WhatsAppApiConfig fromEnv() {
+ final String authorizationToken = System.getenv("WHATSAPP_AUTHORIZATION_TOKEN");
+ final String phoneNumberId = System.getenv("WHATSAPP_PHONE_NUMBER_ID");
+ final String recipientPhoneNumber = System.getenv("WHATSAPP_RECIPIENT_PHONE_NUMBER");
+
+ return new WhatsAppApiConfig(
+ WhatsAppComponent.API_DEFAULT_URL, 443, authorizationToken, phoneNumberId,
+ WhatsAppComponent.API_DEFAULT_VERSION, recipientPhoneNumber);
+ }
+
+ public static WhatsAppApiConfig mock(int port) {
+ return new WhatsAppApiConfig("http://localhost:" + port, port, "mock-token", "-1", "v1", "1");
+ }
+
+ public String getAuthorizationToken() {
+ return authorizationToken;
+ }
+
+ public String getBaseUri() {
+ return baseUri;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public String getPhoneNumberId() {
+ return phoneNumberId;
+ }
+
+ public String getApiVersion() {
+ return apiVersion;
+ }
+
+ public String getRecipientPhoneNumber() {
+ return recipientPhoneNumber;
+ }
+}
diff --git a/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppTestSupport.java b/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppTestSupport.java
new file mode 100644
index 00000000000..d5dbbb5f8ac
--- /dev/null
+++ b/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppTestSupport.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+
+public class WhatsAppTestSupport extends CamelTestSupport {
+
+ protected static final String VERIFY_TOKEN = "111";
+ protected static final String WRONG_VERIFY_TOKEN = "222";
+
+ protected String phoneNumberId;
+ protected String recipientPhoneNumber;
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ final CamelContext context = super.createCamelContext();
+ final WhatsAppComponent component = new WhatsAppComponent();
+
+ WhatsAppApiConfig apiConfig = getWhatsAppApiConfig();
+ component.setBaseUri(apiConfig.getBaseUri());
+ component.setAuthorizationToken(apiConfig.getAuthorizationToken());
+ component.setWebhookVerifyToken(VERIFY_TOKEN);
+ this.phoneNumberId = apiConfig.getPhoneNumberId();
+ this.recipientPhoneNumber = apiConfig.getRecipientPhoneNumber();
+
+ context.addComponent("whatsapp", component);
+ return context;
+ }
+
+ protected WhatsAppApiConfig getWhatsAppApiConfig() {
+ return WhatsAppApiConfig.fromEnv();
+ }
+}
diff --git a/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppWebhookTest.java b/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppWebhookTest.java
new file mode 100644
index 00000000000..c7d03aac6a2
--- /dev/null
+++ b/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppWebhookTest.java
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import java.io.InputStream;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.webhook.WebhookConfiguration;
+import org.apache.camel.component.webhook.WebhookEndpoint;
+import org.apache.camel.test.AvailablePortFinder;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class WhatsAppWebhookTest extends WhatsAppTestSupport {
+
+ private int port;
+
+ @Test
+ public void testWebhookRegistration() throws Exception {
+ String challenge = "987";
+ WebhookConfiguration config
+ = ((WebhookEndpoint) context().getRoute("webhook").getConsumer().getEndpoint()).getConfiguration();
+ String url = config.computeFullExternalUrl() + "?hub.mode=subscribe&hub.verify_token=" + VERIFY_TOKEN
+ + "&hub.challenge=" + challenge;
+
+ MockEndpoint mock = getMockEndpoint("mock:endpoint");
+ mock.expectedBodiesReceived(challenge);
+ mock.expectedMinimumMessageCount(1);
+
+ template().sendBodyAndHeader("netty-http:" + url, null, Exchange.HTTP_METHOD, "GET");
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testWebhookRegistrationFailed() throws Exception {
+ String challenge = "987";
+ WebhookConfiguration config
+ = ((WebhookEndpoint) context().getRoute("webhook").getConsumer().getEndpoint()).getConfiguration();
+ String url = config.computeFullExternalUrl() + "?hub.mode=subscribe&hub.verify_token=" + WRONG_VERIFY_TOKEN
+ + "&hub.challenge=" + challenge;
+
+ MockEndpoint mock = getMockEndpoint("mock:endpoint");
+ mock.expectedMinimumMessageCount(1);
+
+ Assertions
+ .assertThatThrownBy(() -> template().sendBodyAndHeader("netty-http:" + url, null, Exchange.HTTP_METHOD, "GET"))
+ .rootCause()
+ .hasMessageContaining("statusCode: 403");
+ mock.assertIsSatisfied();
+ }
+
+ @Test
+ public void testWebhook() throws Exception {
+ WebhookConfiguration config
+ = ((WebhookEndpoint) context().getRoute("webhook").getConsumer().getEndpoint()).getConfiguration();
+ String url = config.computeFullExternalUrl();
+
+ try (InputStream content = getClass().getClassLoader().getResourceAsStream("webhook-request.json")) {
+ MockEndpoint mock = getMockEndpoint("mock:endpoint");
+ mock.expectedMinimumMessageCount(1);
+
+ template().sendBodyAndHeader("netty-http:" + url, content, Exchange.CONTENT_TYPE, "application/json");
+ mock.assertIsSatisfied();
+ }
+ MockEndpoint mock = getMockEndpoint("mock:endpoint");
+
+ mock.assertIsSatisfied();
+ Assertions.assertThat(mock.getExchanges().get(0).getIn().getBody(String.class)).contains("\"type\": \"text\"");
+ }
+
+ @Override
+ protected void doPreSetup() {
+ port = AvailablePortFinder.getNextAvailable();
+ }
+
+ protected WhatsAppApiConfig getWhatsAppApiConfig() {
+ return WhatsAppApiConfig.mock(port);
+ }
+
+ @Override
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ restConfiguration().host("localhost").port(port);
+
+ from("webhook:whatsapp:" + phoneNumberId + "?webhookAutoRegister=false").id("webhook")
+ .convertBodyTo(String.class).to("mock:endpoint");
+ }
+ };
+ }
+
+}
diff --git a/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/integration/WhatsAppServiceIT.java b/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/integration/WhatsAppServiceIT.java
new file mode 100644
index 00000000000..663f47b75de
--- /dev/null
+++ b/components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/integration/WhatsAppServiceIT.java
@@ -0,0 +1,274 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.integration;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.time.LocalDate;
+import java.util.List;
+
+import com.fasterxml.jackson.core.exc.StreamReadException;
+import com.fasterxml.jackson.databind.DatabindException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.camel.component.whatsapp.WhatsAppTestSupport;
+import org.apache.camel.component.whatsapp.model.Address;
+import org.apache.camel.component.whatsapp.model.ContactMessage;
+import org.apache.camel.component.whatsapp.model.ContactMessageRequest;
+import org.apache.camel.component.whatsapp.model.Email;
+import org.apache.camel.component.whatsapp.model.InteractiveMessageRequest;
+import org.apache.camel.component.whatsapp.model.LocationMessage;
+import org.apache.camel.component.whatsapp.model.LocationMessageRequest;
+import org.apache.camel.component.whatsapp.model.MediaMessage;
+import org.apache.camel.component.whatsapp.model.MediaMessageRequest;
+import org.apache.camel.component.whatsapp.model.MessageResponse;
+import org.apache.camel.component.whatsapp.model.Name;
+import org.apache.camel.component.whatsapp.model.Org;
+import org.apache.camel.component.whatsapp.model.Phone;
+import org.apache.camel.component.whatsapp.model.TemplateMessageRequest;
+import org.apache.camel.component.whatsapp.model.TextMessage;
+import org.apache.camel.component.whatsapp.model.TextMessageRequest;
+import org.apache.camel.component.whatsapp.model.UploadMedia;
+import org.apache.camel.component.whatsapp.model.UploadMediaRequest;
+import org.apache.camel.component.whatsapp.model.Url;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariables;
+
+@EnabledIfEnvironmentVariables({
+ @EnabledIfEnvironmentVariable(named = "WHATSAPP_AUTHORIZATION_TOKEN", matches = ".*",
+ disabledReason = "WhatsApp Authorization Token not provided"),
+ @EnabledIfEnvironmentVariable(named = "WHATSAPP_PHONE_NUMBER_ID", matches = ".*",
+ disabledReason = "WhatsApp phone number ID not provided"),
+ @EnabledIfEnvironmentVariable(named = "WHATSAPP_RECIPIENT_PHONE_NUMBER", matches = ".*",
+ disabledReason = "WhatsApp recipient phone number not provided") })
+public class WhatsAppServiceIT extends WhatsAppTestSupport {
+
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ @Test
+ public void testTextMessage() {
+ TextMessageRequest request = new TextMessageRequest();
+ request.setTo(recipientPhoneNumber);
+ request.setText(new TextMessage());
+ request.getText().setBody("This is an auto-generated message from Camel \uD83D\uDC2B \uD83D\uDC2A");
+
+ MessageResponse response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, request);
+
+ assertResponse(response);
+ }
+
+ @Test
+ public void testTextMessageWithUrl() {
+ TextMessageRequest request = new TextMessageRequest();
+ request.setTo(recipientPhoneNumber);
+ request.setText(new TextMessage());
+ request.getText().setBody("This is an auto-generated message from Camel with URL https://camel.apache.org/");
+ request.getText().setPreviewUrl(true);
+
+ MessageResponse response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, request);
+
+ assertResponse(response);
+ }
+
+ @Test
+ public void testLocationMessage() {
+ LocationMessageRequest request = new LocationMessageRequest();
+ request.setTo(recipientPhoneNumber);
+ request.setLocation(new LocationMessage());
+ request.getLocation().setLatitude("41.902782");
+ request.getLocation().setLongitude("12.496366");
+ request.getLocation().setAddress("Rome");
+ request.getLocation().setName("Rome");
+
+ MessageResponse response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, request);
+
+ assertResponse(response);
+ }
+
+ @Test
+ public void testContactMessage() {
+ ContactMessageRequest request = new ContactMessageRequest();
+ request.setTo(recipientPhoneNumber);
+
+ ContactMessage contactMessage = getContactMessage();
+
+ request.setContacts(List.of(contactMessage));
+
+ MessageResponse response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, request);
+
+ assertResponse(response);
+ }
+
+ @Test
+ public void testInteractiveListMessage() throws IOException {
+ InteractiveMessageRequest request = MAPPER.readValue(
+ WhatsAppServiceIT.class.getResourceAsStream("/interactive-list-message.json"), InteractiveMessageRequest.class);
+ request.setTo(recipientPhoneNumber);
+
+ MessageResponse response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, request);
+
+ assertResponse(response);
+ }
+
+ @Test
+ public void testInteractiveButtonMessage() throws IOException {
+ InteractiveMessageRequest request
+ = MAPPER.readValue(WhatsAppServiceIT.class.getResourceAsStream("/interactive-button-message.json"),
+ InteractiveMessageRequest.class);
+ request.setTo(recipientPhoneNumber);
+
+ MessageResponse response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, request);
+
+ assertResponse(response);
+ }
+
+ private void assertResponse(MessageResponse response) {
+ Assertions.assertThat(response).isNotNull();
+ Assertions.assertThat(response.getMessages()).isNotNull();
+ Assertions.assertThat(response.getMessages().get(0).getId()).isNotNull();
+ }
+
+ @Test
+ public void testMediaStickerMessage() {
+ MediaMessage mediaMessage = new MediaMessage();
+ // 512x512 sticker only
+ mediaMessage.setLink("https://stickercommunity.com/uploads/main/09-05-2021-01-39-24fzl6i-sticker0.webp");
+
+ MediaMessageRequest request = new MediaMessageRequest("sticker", mediaMessage);
+ request.setTo(recipientPhoneNumber);
+
+ MessageResponse response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, request);
+
+ assertResponse(response);
+ }
+
+ @Test
+ public void testMediaUploadImage() throws URISyntaxException {
+ UploadMediaRequest uploadMediaRequest = new UploadMediaRequest();
+ UploadMedia uploadMedia = new UploadMedia(
+ new File(WhatsAppServiceIT.class.getResource("/camel.jpg").toURI()),
+ "image/jpeg");
+ uploadMediaRequest.setUploadMedia(uploadMedia);
+
+ // Upload media
+ MessageResponse response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, uploadMediaRequest);
+
+ Assertions.assertThat(response).isNotNull();
+ Assertions.assertThat(response.getId()).isNotNull();
+
+ MediaMessage mediaMessage = new MediaMessage();
+ mediaMessage.setId(response.getId());
+
+ MediaMessageRequest request = new MediaMessageRequest("image", mediaMessage);
+ request.setTo(recipientPhoneNumber);
+
+ response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, request);
+
+ assertResponse(response);
+ }
+
+ @Test
+ public void testMediaUploadVideoWithInputStream() throws URISyntaxException {
+ UploadMediaRequest uploadMediaRequest = new UploadMediaRequest();
+ UploadMedia uploadMedia = new UploadMedia(
+ "sample.mp4",
+ WhatsAppServiceIT.class.getResourceAsStream("/sample.mp4"),
+ "video/mp4");
+ uploadMediaRequest.setUploadMedia(uploadMedia);
+
+ // Upload media
+ MessageResponse response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, uploadMediaRequest);
+
+ Assertions.assertThat(response).isNotNull();
+ Assertions.assertThat(response.getId()).isNotNull();
+
+ MediaMessage mediaMessage = new MediaMessage();
+ mediaMessage.setId(response.getId());
+
+ MediaMessageRequest request = new MediaMessageRequest("video", mediaMessage);
+ request.setTo(recipientPhoneNumber);
+
+ response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, request);
+
+ assertResponse(response);
+ }
+
+ @Test
+ public void testTemplateMessage() throws StreamReadException, DatabindException, IOException {
+ TemplateMessageRequest request
+ = MAPPER.readValue(WhatsAppServiceIT.class.getResourceAsStream("/template-message.json"),
+ TemplateMessageRequest.class);
+ request.setTo(recipientPhoneNumber);
+
+ MessageResponse response = (MessageResponse) template.requestBody("whatsapp://" + phoneNumberId, request);
+
+ assertResponse(response);
+ }
+
+ @Test
+ public void testWrongRecipient() {
+ TextMessageRequest request = new TextMessageRequest();
+ request.setTo("33333333");
+ request.setText(new TextMessage());
+ request.getText().setBody("Wrong recipient");
+
+ Assertions.assertThatThrownBy(() -> template.requestBody("whatsapp://" + phoneNumberId, request))
+ .getRootCause()
+ .hasMessageContaining("Recipient phone number not in allowed list");
+ }
+
+ private ContactMessage getContactMessage() {
+ ContactMessage contactMessage = new ContactMessage();
+ Address address = new Address();
+ address.setCity("Rome");
+ address.setCountry("Italy");
+ address.setCountryCode("ITA");
+ address.setState("Italy");
+ address.setStreet("Via Rome");
+ address.setType("HOME");
+ address.setZip("00145");
+ contactMessage.setAddresses(List.of(address));
+ contactMessage.setName(new Name());
+ contactMessage.getName().setFirstName("first");
+ contactMessage.getName().setFormattedName("formatted");
+ contactMessage.getName().setLastName("last");
+ contactMessage.getName().setMiddleName("middle");
+ contactMessage.getName().setPrefix("prefix");
+ contactMessage.getName().setSuffix("suffix");
+ contactMessage.setBirthday(LocalDate.now());
+ Email email = new Email();
+ email.setEmail("test@camel.com");
+ email.setType("WORK");
+ contactMessage.setEmails(List.of(email));
+ contactMessage.setOrg(new Org());
+ contactMessage.getOrg().setCompany("company");
+ contactMessage.getOrg().setDepartment("department");
+ contactMessage.getOrg().setTitle("title");
+ Phone phone = new Phone();
+ phone.setPhone("333111333");
+ phone.setType("WORK");
+ contactMessage.setPhones(List.of(phone));
+ Url url = new Url();
+ url.setUrl("https://camel.apache.org/");
+ url.setType("WORK");
+ contactMessage.setUrls(List.of(url));
+
+ return contactMessage;
+ }
+}
diff --git a/components/camel-whatsapp/src/test/resources/camel.jpg b/components/camel-whatsapp/src/test/resources/camel.jpg
new file mode 100644
index 00000000000..3162a3f44e8
Binary files /dev/null and b/components/camel-whatsapp/src/test/resources/camel.jpg differ
diff --git a/components/camel-whatsapp/src/test/resources/camel.webp b/components/camel-whatsapp/src/test/resources/camel.webp
new file mode 100644
index 00000000000..cca8fa3448a
Binary files /dev/null and b/components/camel-whatsapp/src/test/resources/camel.webp differ
diff --git a/components/camel-whatsapp/src/test/resources/interactive-button-message.json b/components/camel-whatsapp/src/test/resources/interactive-button-message.json
new file mode 100644
index 00000000000..0a3ca32ad9f
--- /dev/null
+++ b/components/camel-whatsapp/src/test/resources/interactive-button-message.json
@@ -0,0 +1,30 @@
+{
+ "messaging_product": "whatsapp",
+ "recipient_type": "individual",
+ "to": "PHONE_NUMBER",
+ "type": "interactive",
+ "interactive": {
+ "type": "button",
+ "body": {
+ "text": "BUTTON_TEXT"
+ },
+ "action": {
+ "buttons": [
+ {
+ "type": "reply",
+ "reply": {
+ "id": "UNIQUE_BUTTON_ID_1",
+ "title": "BUTTON_TITLE_1"
+ }
+ },
+ {
+ "type": "reply",
+ "reply": {
+ "id": "UNIQUE_BUTTON_ID_2",
+ "title": "BUTTON_TITLE_2"
+ }
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/components/camel-whatsapp/src/test/resources/interactive-list-message.json b/components/camel-whatsapp/src/test/resources/interactive-list-message.json
new file mode 100644
index 00000000000..95f35f240ba
--- /dev/null
+++ b/components/camel-whatsapp/src/test/resources/interactive-list-message.json
@@ -0,0 +1,54 @@
+{
+ "messaging_product": "whatsapp",
+ "recipient_type": "individual",
+ "to": "PHONE_NUMBER",
+ "type": "interactive",
+ "interactive": {
+ "type": "list",
+ "header": {
+ "type": "text",
+ "text": "HEADER_TEXT"
+ },
+ "body": {
+ "text": "BODY_TEXT"
+ },
+ "footer": {
+ "text": "FOOTER_TEXT"
+ },
+ "action": {
+ "button": "BUTTON_TEXT",
+ "sections": [
+ {
+ "title": "SECTION_1_TITLE",
+ "rows": [
+ {
+ "id": "SECTION_1_ROW_1_ID",
+ "title": "SECTION_1_ROW_1_TITLE",
+ "description": "SECTION_1_ROW_1_DESCRIPTION"
+ },
+ {
+ "id": "SECTION_1_ROW_2_ID",
+ "title": "SECTION_1_ROW_2_TITLE",
+ "description": "SECTION_1_ROW_2_DESCRIPTION"
+ }
+ ]
+ },
+ {
+ "title": "SECTION_2_TITLE",
+ "rows": [
+ {
+ "id": "SECTION_2_ROW_1_ID",
+ "title": "SECTION_2_ROW_1_TITLE",
+ "description": "SECTION_2_ROW_1_DESCRIPTION"
+ },
+ {
+ "id": "SECTION_2_ROW_2_ID",
+ "title": "SECTION_2_ROW_2_TITLE",
+ "description": "SECTION_2_ROW_2_DESCRIPTION"
+ }
+ ]
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/components/camel-whatsapp/src/test/resources/log4j2.properties b/components/camel-whatsapp/src/test/resources/log4j2.properties
new file mode 100644
index 00000000000..a3177d7df0a
--- /dev/null
+++ b/components/camel-whatsapp/src/test/resources/log4j2.properties
@@ -0,0 +1,31 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-whatsapp.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d %-5p %c{1} - %m %n
+appender.console.type = Console
+appender.console.name = console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
+logger.whatsapp.name = org.apache.camel.component.whatsapp
+logger.whatsapp.level = DEBUG
+rootLogger.level = INFO
+
+rootLogger.appenderRef.file.ref = file
diff --git a/components/camel-whatsapp/src/test/resources/sample.mp4 b/components/camel-whatsapp/src/test/resources/sample.mp4
new file mode 100644
index 00000000000..467aa73c7b7
Binary files /dev/null and b/components/camel-whatsapp/src/test/resources/sample.mp4 differ
diff --git a/components/camel-whatsapp/src/test/resources/template-message.json b/components/camel-whatsapp/src/test/resources/template-message.json
new file mode 100644
index 00000000000..7f242039d98
--- /dev/null
+++ b/components/camel-whatsapp/src/test/resources/template-message.json
@@ -0,0 +1,11 @@
+{
+ "messaging_product":"whatsapp",
+ "to":"",
+ "type":"template",
+ "template":{
+ "name":"hello_world",
+ "language":{
+ "code":"en_US"
+ }
+ }
+}
\ No newline at end of file
diff --git a/components/camel-whatsapp/src/test/resources/webhook-request.json b/components/camel-whatsapp/src/test/resources/webhook-request.json
new file mode 100644
index 00000000000..8a776997267
--- /dev/null
+++ b/components/camel-whatsapp/src/test/resources/webhook-request.json
@@ -0,0 +1,39 @@
+{
+ "object": "whatsapp_business_account",
+ "entry": [
+ {
+ "id": "WHATSAPP_BUSINESS_ACCOUNT_ID",
+ "changes": [
+ {
+ "value": {
+ "messaging_product": "whatsapp",
+ "metadata": {
+ "display_phone_number": "PHONE_NUMBER",
+ "phone_number_id": "PHONE_NUMBER_ID"
+ },
+ "contacts": [
+ {
+ "profile": {
+ "name": "Federico Mariani"
+ },
+ "wa_id": "PHONE_NUMBER"
+ }
+ ],
+ "messages": [
+ {
+ "from": "PHONE_NUMBER",
+ "id": "wamid.HBgMMzkzMzg2ODY1NTIxFQIAEhgUM0VCMDUwNEI1NURCNzM5Q0YxR",
+ "timestamp": "1654854656",
+ "text": {
+ "body": "test"
+ },
+ "type": "text"
+ }
+ ]
+ },
+ "field": "messages"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/components/pom.xml b/components/pom.xml
index fab2ebc9ad7..f01bb0c093c 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -323,6 +323,7 @@
<module>camel-websocket-jsr356</module>
<module>camel-websocket</module>
<module>camel-weka</module>
+ <module>camel-whatsapp</module>
<module>camel-wordpress</module>
<module>camel-workday</module>
<module>camel-xchange</module>
diff --git a/parent/pom.xml b/parent/pom.xml
index 602e178aa17..e801546dc27 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -2700,6 +2700,11 @@
<artifactId>camel-weka</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-whatsapp</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-wordpress</artifactId>