Skip to content

bxacosta/wp-cloud-api-demo

Repository files navigation

WhatsApp Business Cloud API Demo

This repository is a demo of how to integrate the WhatsApp Business Cloud API through Facebook's Graph API. using Spring Boot.

Features

  • Uses restfb as the Facebook's Graph API client.
  • Implements Embedded Signup for authentication.
  • Lists associated WhatsApp Business Accounts.
  • Lists associated WhatsApp Business Phone Numbers.
  • Lists associated WhatsApp Message Templates.

Technologies Used

  • Spring Boot 3.4
  • Java 21
  • Gradle
  • lombok

Requirements

Check the official documentation for more details:

Setup

Facebook App Configuration

  1. Set up OAuth redirect URLs to include the /callback endpoint.
  2. Note your App ID, Config ID, and App Secret, check Basic Settings.

Configure application.yml

Update the configuration file src/main/resources/application.yml with your Facebook API credentials:

facebook:
  appId: your_app_id
  configId: your_config_id
  appSecret: your_app_secret
  callbackUrl: https://your-app.com/callback
  webhookToken: wp-notification

Make sure to replace the placeholder values with your actual Facebook application credentials.

Building and Running

  • Build the Application
./gradlew build
  • Run the Application
./gradlew bootRun

Use .\gradlew.bat instead if you are on Windows.

Usage

  1. Navigate to /login to initiate the Facebook authentication flow.
  2. After successful authentication, you will be redirected back to the application /.
  3. The access token will be stored in the session.

API Endpoints

Authentication (Embedded Signup)

Method Endpoint Description
GET /login Redirects the user to Facebook authentication.
GET /callback Processes the authentication response.

WhatsApp Business Data

Method Endpoint Description
GET / Lists associated WhatsApp Business accounts, phone numbers, and message templates.

License

MIT License

About

WhatsApp Business Cloud API client with Spring Boot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages