The webhook block is one of the four action blocks available in the Guided Conversations bot builder. This block enables the conversation flow to interact with Zoho Desk processes or other Zoho or third-party services. The webhook block uses APIs from Zoho or third-party services to make this interaction possible. Therefore, any data that can be accessed or any action that can be performed using APIs can be included in the conversation flow through webhook blocks.
Why use a webhook block in your GC flow?
Webhooks significantly enhance the functionality and responsiveness of a chatbot by allowing it to interact with external systems and services in real-time, offering a more dynamic, scalable, and efficient chatbot experience.
1. Real-time communication with external systems
Webhooks allow chatbots to fetch and post data to external systems (e.g., CRMs, databases, APIs) instantly, without waiting for manual input leading to cross-integration with services.
This ensures that the chatbot provides timely and relevant information, enhancing user experience.
2. Dynamic response generation
A chatbot in E-commerce could fetch the latest order status or shipping details dynamically.
3. Handling complex requests
For example, sending an email, creating a ticket, or retrieving user-specific data.
4. Scalability
5. Automating business processes
Chatbots using webhooks can automate repetitive tasks, such as updating CRM records, sending notifications, or processing payments, making business operations more efficient.
6. Speedy responses
7. Improved error handling
In case of errors or system down times, webhooks provide detailed and precise error responses that allow the chatbot to handle exceptions with ease. For example, showing an error message or retrying the request.
8. Managing event-driven triggers
For example, user purchases and form submission.
Business scenario
Imagine John is visiting the Zylker website to request a zPad replacement because his screen is broken. Since he's already bought a Zylker product, the Webhook block will try to find his name or email in their database using API calls. If John is already a contact in their system, the bot will create a ticket for him and send the ticket ID as confirmation. If he's not in their system, the bot will create a new contact for John and then generate a ticket ID. The webhook block helps by checking if John is an existing customer and, if so, retrieving his details to make ticket creation easier.
Steps to add a webhook block
1. Navigate to Setup > Self Service > Guided Conversations.
2. Select the Flow in which you want to add the Webhook block.
3. On the Guided Conversations builder, click the Add Block icon ( ).The Add Block panel will appear on the right. 4. On this panel, click Action Cards and select Webhook.
5. In the Webhook block panel that appears, enter the following details:
a) Block name: Enter a name for the block. For example, 'Fetch Contact.'
If you input the name of a block that already exists, the following error message will appear.
b) Method: Choose an API call method from the list.
List of methods:
- Get: Fetches resources from existing contacts.
- Patch: Makes partial changes to be applied to an existing resource.
- Post: Creates or updates an existing resource.
- Put: Modifies a singular resource which is already a part of resources.
- Delete: Deletes an existing resource.
After this API is executed, the URL in the webhook stops receiving event information.
c) Enter the REST API URL of the third-party application in the URL to notify the field.
1. In the Query Params field, click and enter the parameters to sort or filter the resources criteria. For example: @email
2. When you choose an API call, you must enter the header, which is the organization ID or the portal ID. This has to be passed as the Header value.
The API call will then perform its action from this portal ID.
3. In the Body section, select JSON or File Upload to add fields or upload files, respectively.
- Do the following if you choose JSON:
a. Mandatory variables: Add the ones marked as mandatory in the API document. These are the fields that are available in the third-party or Zoho Services portal and those that need to be mapped by the GC component. To enter a variable value, you must enter a variable and type @, and then choose a variable from the pick-list
b. Custom fields: Include any custom field available in the third-party or Zoho Services portal to the Body section, if required.
- Do the following if you choose File Upload:
c. Enter the Key and the Value for the file to be uploaded.
4. Click Save.
5. Choose one of the following to create a Connection with the Desk portal.
- Pick Your Service: To create a connection from existing services
- Custom Service: To choose to create a completely new connection
Points to note on request body parameters:
- The option to send data via the request's body is unavailable for GET requests.
It is important that the value you declare in the body section be the information that you get from the user. Otherwise, you must define a starting value for the variable in the body section. The @ symbol for a variable indicates that the information is retrieved from the user via chatbot, which means a block for that variable is created in the GC.
- All other values in orange are static values, which you are not going to retrieve from the user. These values indicate that you are directly going to pass these values to be posted as the actual values for the particular fields or variables.
Pick your Service
To create a connection from existing services, perform the following steps:
1. Refer to steps 1 through 9 under Adding a webhook block and continue from there.
2. Click the Add button besides the Connections label.
The DRE page will open on a new tab.
3. Under Pick Your Service, choose from the already available third-party services with Zoho, or you can choose one of Zoho services itself.
4. Enter a name for the connection and the connection link.
You may need to choose the scopes applicable to the service when prompted.
5. Click Create and Connect.
6. Click Accept to allow your organization/portal to connect with the workflow.
The connection summary page will display, as shown below:
7. In the Connections section of the Webhook Block panel, click Refresh to populate the connection name in the drop-down list.
8. From the Pick Your Service drop-down list, select the connection name.
9. In the Response section, click Status Code and do the following:
- Enter the expected status code, which you can get from the API document.
The variable corresponding to the status code will be auto- generated. - Enter the response value field, which includes the bot variable, response value, type, and data type.
- Click the Plus icon ( ) to add additional bot variables, if necessary.
- Click Save.
Click Add New Response to add another status code and their corresponding bot variables.
10. Set a time for Request Timeout. Default time out is 8 seconds.
11. Click Save on the webhook block.
12. Click Save Draft on the flow to save your settings.
13. Click the Preview button to check if the flow is working.
You can copy or delete the webhook block by clicking the respective button on the upper-right side of the block. Custom Service
To create a completely new connection, perform the following steps:
1. Refer to steps 1 through 9 under Adding a webhook block and continue from there.
2. Click the Add button next to the Connections label.
The DRE page will open in a new tab.
3. Choose the Custom Service tab.
4. In the Custom Connection page, enter the following service details:
5. Click Create and Connect.
6. Click Accept to allow your organization/portal to connect with the workflow.
The connection summary page will display.
7. In the "Connections" section of the Webhook Block panel, click Refresh to populate the connection name in the drop-down list.
8. From the Pick Your Service drop-down list, select the connection name.
9. In the "Response section", click Status Code and do the following:
- Enter the expected status code, which you can get from the API document.
The variable corresponding to the status code will be auto- generated. - Enter the response value field, which includes the bot variable, response value, type, and data type.
- Click the Plus icon ( ) to add additional bot variables, if necessary.
- Click Save.
- Click Add New Response to add another status code and their corresponding bot variables.
10. Set a time for Request Timeout. Default time out is 8 seconds.
11. Click Save on the webhook block.
12. Click Save Draft on the flow to save your settings.
13. Click the Preview button to check if the flow is working.
Steps to edit a webhook block
You can edit a webhook block whenever required, even after the flow is published or in the drafts section, by following these steps:
1. Open the flow and click Edit.
2. Click the Webhook Block, which you may have named differently.
3. Choose Edit Block from the displayed options.
4. Make the required changes to the block and click Save.
5. Click Save.
6. Publish the flow.