Webhook For Reset Password
Last updated
Last updated
To resetting the password, first of all we create a webhook API. Whenever we call this webhook API, we will get huge data about visitor in body of that particular API. Like: hash, visitor_id, chat_id, visitor’s name, visitor’s email, lead details, browser details, custom fields value, other misc details.
So by the use of visitor’s email we can call our internal Endpoint of Resetting the password, by the use of this Webhook API.
First of all we fetch visitor’s Email from this huge data, then after we call our endpoint by the use of cURL(in PHP) and then webhook will reply based on the cURL response. Bot will use that Webhook response and replace it with webhook variable in Sales-Bot’s Lead.
In Code, We do like this:
In cURL Code, we call our endpoint, where we pass $email value on <SYSTEM_DOMAIN>/api/auth/forget-password endpoint. Then after according to response we setup our webhook. Keep this mind that, If you create webhook variable as reset_password_status then response of this webhook must be {“reset_password_status”: “<MESSSAGE HERE>”}. So Bot can easily understand it and replace it with webhook variable.
After creating this webhook API, we add this in Webhook APIs Section in Acquire (Chat Bot > Setting > Webhook APIs).
Now we make a Lead in Sales-Bot, where we make various branches. In branches, somewhere we use that webhook variable {{reset_password_status}}. Create lead branch like:
Now, we call this Lead either from Trigger section or from Support-Bot. In Support-Bot we make a Question/Answer as “I forgot my password” then Support-Bot will redirect us to Sales-Bot. See Example: