This widget is used to make custom API calls that enables AVOXI Flow Builder to communicate with different systems by retrieving or sending data.
Responses from these API calls can be stored in variables and referenced further in the flow to make routing decisions.
How it works
- Scenario - Know if the caller is a valid customer based on customer id entered by caller before routing the call to a support queue
- Caller is prompted to enter customer Id
- Customer Id is collected using gather input widget and is stored in variable customerId. Refer gather input article for more details.
- Make an API call to respective endpoint to validate customer
- Sample Method & URL - GET request - https://testcrm.com/validateCustomer
- Pass “customer id” collected in gather input as a parameter to this request Parameter (key:value) - cId : <customerId>
- Sample response received : {“valid” : 1}
- Store the response in a variable - is_customer_id_valid
- Successful API calls will proceed with success path
This variable <is_customer_id_valid> can be used to make routing decisions using condition widget.
Configuration
- Add “Webhook” widget from Widget library
- Refer respective API docs for config details - sample API docs - https://genius.avoxi.com/api/v2/api-docs/
- Use widget config panel to manage specific configurations
- You can select one of the 3 request method and respective URL
- GET - Used to retrieve data
- POST - Used to submit information to specified resource
- PUT - Used to replace/update current information at target with request payload
- Pass required additional data using headers and parameters key value pairs
- Values can be plain text values or variables defined earlier in the flow. Differentiate values from variable by surrounding variable names with “<>” example - <customerId>
- This can include data like username, password, authentication tokens, etc
- Add headers and parameters using “+” button
- Use delete button to delete respective header/parameter key value pairs
- There is a list of internal call variables available in dropdown. eg - <call.from.number>, <call.from.name> and many more
- With POST method, request body can be sent in Form data, JSON or text format
- Name the webhook response key, This is used to reference variables defined in capture webhook response further in the flow. All the variables in capture webhook response are nested within webhook response key.
- If the API call made is successful, capture responses received in variables. These variables can be referred to elsewhere in the flow to make routing decisions (condition widget - coming soon)
- You can select one of the 3 request method and respective URL
- Configure “Success” and “Fail” path
- Success Path
- This represents that API call was successful
- Fail Path
- This represents that API call was not successful
- Success Path
Field Name | Description | Configuration | Sample values |
Name *Required Field |
Friendly name for your Webhook widget. | Text input | Validate customer Id |
Method *Required Field |
Request type of method - GET, POST, PUT | Select one of the available request type from the dropdown | GET |
URL *Required Field |
Request URL or the endpoint | Text input |
https://testurl.com
|
Headers & Parameters |
Pass required additional data using headers and parameters key value pairs
|
Add headers and parameters using the “+” button. Use delete button to remove respective pairs. |
Key - cId
Value - <customerId> (variable name surrounded by “<>”)
12345 (plain text value) |
Body | Body of your request - applicable for POST and PUT |
Form Data - key value pairs JSON - valid JSON Text |
|
Webhook Response Key | The webhook response key defines the webhook response to be referenced elsewhere in the Flow. | Text input | validateCustomer |
Capture response | Used to save information from the raw webhook response into variables.Select the object path or key from which to retrieve information and define a variable to apply the information to. |
Text input
Retrieve from - response object path or key
Apply to - variable name |
Retrieve from - customer.valid
Apply to - is_customer_id_valid |
Capture webhook response sample values
Example
Raw Webhook Response: {
"customerDetails": {
"name": "XYZ Corp",
"emailAddress": "test@xyz.com",
"valid" : "1"
}
}
Webhook Response Key: "customer"
Capture Webhook Response:
[
{ "retrieveFrom": "customerDetails.name", "applyTo": "customerName" },
{ "retrieveFrom": "customerDetails.valid", "applyTo": "isCustomerIdValid" }
]
AVOXI Call State: // how variables key value pairs are stored in AVOXI's system
{
"customer": {
"customerName": "XYZ Corp",
"isCustomerIdValid": "1"
}
}
The stored values can be referred to further in the flow using WebhookResponseKey.ApplyTo -> <customer.customerName> or <customer.isCustomerIdValid>
Troubleshooting
Webhook resposnes are captured within call journey for further troubleshooting. To check call journey navigate to 'Activity' and select a call to view the Call Details.
Connect app within Flow builder
- You can add you new connections while configuring webhooks in Flow Builder
- Navigate to Flow Builder > click “+Add”
- Add webhook widget, within webhook config panel, use “Auth” tab to configure connection details
- Within Authentication dropdown, select “+ Add New Credential”
- Search and select the app/CRM you want to connect to
- Based on the selected app, give the connection a name and configure details following instructions on screen.
- To use a preconfigured connection, search and select the app/CRM from Authentication list
Read more here.