WhatsApp flow endpoint trigger
The WhatsApp flow endpoint trigger allows you to deploy an endpoint to power a dynamic WhatsApp flow using a no/low code approach. Using this trigger will provide:
No-Code Endpoint Deployment: Easily set up and configure your dynamic WhatsApp flow endpoint without any coding required. This simplifies the process of deploying an endpoint to manage and respond to incoming requests from a dynamic WhatsApp flows
Automatic Decryption and Encryption: The flow manages the decryption of incoming requests and the encryption of outgoing responses, ensuring secure communication. Simply provide your private key and passphrase during setup, and the system handles the rest.
Integration with Bird CRM Flow Actions: Leverage the full range of Bird CRM flow actions within your WhatsApp flows; for example getting contact information or making third party API requests.
Set up a WhatsApp Flow endpoint trigger
Generate RSA Key Pairs
WhatsApp Flows requires a public/private key pair to decrypt/encrypt data between WhatsApp and the flows endpoint. Firstly generate (or provide) the key pair.
# Replace '<your_passphrase>' with your actual passphrase
PASS="<your_passphrase>"
# Generate the private key with AES-256-CBC encryption and a passphrase
openssl genrsa -aes256 -traditional -passout pass:$PASS -out private_key.pem 2048
# Extract the public key from the private key
openssl rsa -pubout -in private_key.pem -out public_key.pem -passin pass:$PASS
Converting private key to add headers
It is important that your private key contains the following header information
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,AA3AC1C7DC568ACB8E3AC6790G40D9D1
To regenerate an existing private key to contain the headers you can run the following commands:
openssl rsa -in encrypted_key.pem -out decrypted_key.pem
openssl rsa -in decrypted_key.pem -aes256 -traditional -passout pass:$PASS -out reencrypted_key.pem
Upload the public key
Open
public_key.pem
in a text editor and copy its content.For each channel where you will send a dynamic WhatsApp flow navigate to Manage Channels > WhatsApp > WhatsApp Channel > Settings
Paste the content into the "Public key" field.
Click "Update" to save the public key
Configure WhatsApp flows trigger to use the private key
Select WhatsApp flow endpoint as the trigger for your new Flow
In the "Request Decryption and Encryption" section:
Private key: Open the
private_key.pem
file in a text editor, copy the entire content, and paste it into the "Private key" field.Private key passphrase: Enter the passphrase you used when generating the private key into the "Private key passphrase" field.
Click Next
Respond to health checks
Add a conditional step
Add a Conditional Step right after the WhatsApp Flow Endpoint trigger
Define Conditions:
For Branch A, set a condition to check if the incoming request (
trigger.payload.action
) equals "ping".You can add more conditions or branches as needed for different types of incoming messages.
Set variables
Add a Set Variables Step under the appropriate branch (e.g.
Branch A
).Configure the Variables:
Use the Code Editor to define the variables. For example:
{
"data": {
"status": "active"
},
"version": "3.0"
}
Last updated
Was this helpful?