A dependency for creating WhatsApp chatbots using a template-driven approach.
Templates use YAML allowing you to define conversation flows and business logic in a clean and modular way.
- Template-Driven Design: Use YAML templates for conversational flows.
- Hooks for Business Logic: Attach Java classes / RESTful endpoints to process messages or actions.
- Abstracts the API for WhatsApp Cloud.
- Supports dynamic messages with placeholders.
For a quick start - Fork the repository and attempt to run the chatbot in the example
folder
Developed using Java 17
- Clone repository
git clone [email protected]:DonnC/jawce.git
- Install all project maven dependencies
- Start by installing dependencies in the
jsession
folder - Next, install
jengine
folder dependencies - Finally install dependencies for the
example/jchabot
folder
- Navigate to the example chatbot >
example/jchatbot/src/main/resources/application.yml
properties file and replace configs with your WhatsApp account configs
chatbot:
configs:
# ~ snippet ~
hub-token: "your-webhook-hub-challenge-token"
phone-number-id: "your-phone-number-id"
access-token: "your-access-token"
- Configure chatbot resources under the
resources
section
resources:
templates: "path-to-templates-dir"
triggers: "path-to-triggers-dir"
watcher: "path-to-watcher-dir"
Configure the full path to where the resources are, for example.
If you clone the project in C:\\Projects
folder, it will be like below
resources:
templates: C:\\Projects\\jawce\\example\\jchatbot\\src\\main\\resources\\templates
triggers: C:\\Projects\\jawce\\example\\jchatbot\\src\\main\\resources\\triggers
watcher: C:\\Projects\\jawce\\example\\jchatbot\\src\\main\\resources\\watch
The watcher is used to listen to file changes in the watch dir which will trigger all templates to reload without restarting the service.
Refer to the Example ChatBot for a quick getting started template
To include the jengine in your own project.
In your pom.xml
dependencies add the following
<!-- your other dependencies -->
<dependency>
<groupId>zw.co.dcl.jawce</groupId>
<artifactId>jengine</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
Make sure you create a rest controller which handles 2 of the important logic
- webhook verification
- webhook payload
Visit the official documentation for a detailed guide.
We welcome contributions! Please check out the Contributing Guide for details.
This project is licensed under the MIT License. See the LICENSE file for details.