<?php
/*
* Read HTTP POST values
*/
$whatsapp_from = $_POST['whatsapp_from'];
$whatsapp_to = $_POST['whatsapp_to'];
$whatsapp_message = trim($_POST['whatsapp_message']);
/*
* Below is the business logic based on the response of the user.
* You can pass this to your database, internal system etc.
*/
switch ($whatsapp_message) {
case 1:
$option = "Card";
break;
case 2:
$option = "Bank Account";
break;
case 3:
$option = "Wallet";
break;
default:
$option = "NONE";
}
/*
* Depending on the WhatsApp operation category, send a corresponding
* response message back to the subscriber.
*/
if($option == "NONE"){
$output['whatsapp_message'] = "Welcome to HollaTags' eBanking.\nPlease select your payment channel.\n1) Card\n2) Bank Account\n3) Wallet";
}else{
$output['whatsapp_message'] = "You selected *{$option}*. Have a great day.";
}
/*
* You do not need to define $whatsapp_from or $whatsapp_to in your response
* Your whatsapp_message will by default go to the session $whatsapp_to.
*/
echo json_encode($output);
exit;