How to integrate Whatsapp in Spring Boot with official site Facebook Meta Developer

 

WhatsApp Business API Integration Service




WhatsApp API 

  • Register as a developer at Meta for Developers. 
  • Enable two-factor authentication on your account.
  • Ensure your Meta account is linked to a Meta Business account. 
  • Once complete, create an app on Meta for Developers. Start by visiting Meta for Developers and clicking My Apps. Then, click Create App and select Business as the app type. 
  • Provide the requested details, including the app name and contact email address, and select your business account from the dropdown. Once the app is created, scroll down and click Set up from the WhatsApp card. 
  • This will take you to the Getting started page, which contains all of the information you need for your Java app to start sending WhatsApp messages. Additionally — and most importantly — this page provides a temporary access token and the pre-populated URL command that’s necessary for sending your first test message.

  •  Now that your app is created in the Meta for Developers console.
  • Open any IDEs & create a new Java project.

  • cURL request that provides details about which URL you need to call, the headers you should provide, and an example payload to include as the body. 
  • To use server side Whatsapp API
  • Next, build and send a request, then you can parse the response, The code will look something like the following: (create a controller to handle the API request.


  • Create Request Handler Class

  
  • You can run the project by clicking on the Run project in under the JAVA PROJECTS heading and clicking Run. 
  •  After Run the project open Postman Tool in Post method insert link;

  • In Headers
  • In Body (in blur Part put your register mobile number with country code)


  • If everything is configured correctly, a WhatsApp message similar to the one below should have been sent to the target phone number.

  • Now project works, you can send a simple text message without using a message template. 
  • The type property has now been changed to text. You also replace the template object with a text object specifying the desired message. 
  • You can now successfully send a simple text message using the API !!!














Comments

Post a Comment