Pega and Whatsapp Integration
Pega and Whatsapp Integration
Following the procedure from Official Whatsapp Cloud API
1. Set up Developer Assets and Platform Access
The WhatsApp Cloud API and WhatsApp Business Management API are part of Meta’s Graph API, so you need to set up a Meta developer account and a Meta developer app. To set that up:
- Create a Meta App: Go to developers.facebook.com > My Apps > Create App. Select the "Business" type and follow the prompts on your screen.
Click the app you want to connect to WhatsApp from the App Dashboard. Click Set up when you locate the "WhatsApp" product by scrolling down.
Following that, you will have the choice to choose an existing Business Manager (if you have one) or, if you prefer, have one created for you automatically through the onboarding process (you can customize your business later, if needed). Make your choice, then press Continue.
The following activities are carried out by the onboarding process when you click Continue:
The Business Manager that you selected or that was generated automatically is linked to your App.
You install a WhatsApp test phone number for your company. Without signing up or transferring a phone number, you can use this test number to explore the WhatsApp Business Platform.
- In your App dashboard click on "Getting started" under Whatsapp and note down your temporary access token ( Note : It's valid for 24hours only we need a business account to get permanent access token) Let's continue with this for now
Make sure to add the recipient's phone number's for a free account upto 5 recipient numbers are possible (this is basically the "toPhoneNumber" that you can use later, if any other number not mentioned in this list is given in our pega app it throws error
****************************************** PEGA CONFIGURATION ***************************************
Step 1 : Create a REST Integration
Configure -> Integration -> Connectors -> Create REST Integration
Endpoint URL : https://graph.facebook.com/v13.0/{phoneid}/messages
Headers : Authorization
Step 2 : Choose the method as "POST" and continue (As we will post a new message)
Step 3 : Click on + Add Response and go to your Meta dashboard and get your phoneID and also paste your Auth token in format of Bearer(space)Authtoken that you noted previously
Step 4 : Under Request body use the following JSON
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "ENTER YOUR MOBILE NUMBER HERE",
"type": "text",
"text": {
"body": "Hi there from PegawithSamboy"
}
}
Step 5: Click on run and if everything is Ok you get a 200 ok continue and choose your classes , make sure to create new datapage and click on generate
Step 6 : Open the generated the datapage, pass the text and number as user input params
Pass the params to the request DT
Give the same param names to the DT
Modify the Request DT as below
Create an activity accepting the same params in a sample workclass and configure with below steps
Configure a section as below with a button to invoke our connector
Use Action sets on the fields "To mobile number and Whatsapp Message" as action "change" and event to PostValue
On the button " Send text message" Configure as below,
On the button " Send text message" Configure as below,
That's it we have configured the flow !!
Run the case to see it in action !!
Thanks for reading do comment and encourage me to explore more :)
Run the case to see it in action !!
Thanks for reading do comment and encourage me to explore more :)
Think WhatsApp Plus Provides some additional features that normal WhatsApp not.
ReplyDeleteThis is such a fantastic post!
ReplyDeleteI always stay connected with this blog, and I must say, I’m truly impressed. The information shared here is incredibly useful, especially the last part—it really stood out! I sincerely appreciate this well-researched and informative post. I had been searching for this kind of detailed insight for a long time, and I’m glad I found it here. Keep up the great work!
By the way, if anyone is looking for a reliable WhatsApp Business API Provider in Delhi., Hashtag SMS is a great choice. They offer affordable pricing, automation, and excellent support for businesses of all sizes