Webhooks

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

  1. Add “Webhook” widget from Widget library
  2. Refer respective API docs for config details - sample API docs - https://genius.avoxi.com/api/v2/api-docs/ 
  3. Use widget config panel to manage specific configurations
    1. You can select one of the 3 request method and respective URL
      1. GET - Used to retrieve data
      2. POST - Used to submit  information to specified resource 
      3. PUT - Used to replace/update current information at target with request payload
    2. Pass required additional data using headers and parameters key value pairs
      1. Values can be plain text values or variables defined earlier in the flow. Differentiate values from variable by surrounding variable names with “<>” example - <customerId>
      2. This can include data like username, password, authentication tokens, etc
      3. Add headers and parameters using “+” button
      4. Use delete button to delete respective header/parameter key value pairs
      5. There is a list of internal call variables available in dropdown. eg - <call.from.number>, <call.from.name> and many more
    3. With POST method, request body can be sent in Form data, JSON or text format
    4. 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.
    5. 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)
  4. Configure “Success” and “Fail” path
    1. Success Path
      1. This represents that API call was successful
    2. Fail Path
      1. This represents that API call was not successful
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

  1. You can add you new connections while configuring webhooks in Flow Builder
  2. Navigate to Flow Builder > click “+Add”
  3. Add webhook widget, within webhook config panel, use “Auth” tab to configure connection details
  4. Within Authentication dropdown, select “+ Add New Credential” 
  5. Search and select the app/CRM you want to connect to
  6. Based on the selected app, give the connection a name and configure details following instructions on screen.
  7. To use a preconfigured connection, search and select the app/CRM from Authentication list

Read more here.

 

Give feedback about this article

Was this article helpful?

Have more questions? Submit a request

Updated:

October 8th, 2024

Author:

Tasleem Rayali

Updated By:

Tasleem Rayali

KB ID:

2297636

Page Views:

1336

Tags:

api, variable, webservice call, end point, data dip

Can’t find what you’re looking for?

Contact our award-winning customer care team.