...
Internal Webhooks: Use any of the pre-made internal functions. Use this when you need to use any of the commonly used functions.
Webhook Widget: Call any external API using dynamic data and configurable structure. Use this when you want to integrate and use any external API
Flow End Webhook: Call the default external webhook for any flow. Use this when you need to push flow details on a particular webhook.
Status title To be deprecated
1. Internal Webhook
Custom webhooks are internal webhooks which can be used to pass on the data in between the flow execution.
Using webhook widget, you can simply invoke any configured internal webhook in between the flow and call any specific method to push some data.
You do not need to bother about the request body or need to specify the variables that needs to be passed. You can simply follow the 2 below steps to invoke any webhook in between the flow.
...
Flow Variable | Example | Description |
$flow.key.cli_pause_update |
| The Direct Dial was successfully paused / unpaused |
Content |
| The Direct Dial was could not be paused / unpaused |
Step 0: Enable HTTP Support
Make sure that http service is enabled for your account. If it is not enabled, then you can send a mail to request for the same on support@phonon.io
Step 1 : Configure Internal Webhook
...
Go to Advanced → Webhook page
Click on ‘add webhook’‘Add Webhook’
Select the method as ‘Post’
Enter or paste the URL of the internal webhook that you need to call/invoke from the above list below
Select ‘none’ ‘None’ in the authentication method
Select the body type as ‘None’ and click on save button.
Step 2 : Save Variable (Optional)
If you want to provide any parameters then first you can store that parameter in any flow variable using operation widget (General Assignment Method). This step is completely optional.
Step 3 : Select configurations
In the webhook widget, you need to perform following configurations -
Select URL : Once you have configured the webhook
...
Note |
---|
If ‘HTTP Support’ is not enabled in your account, then you will be able to see a check button beside URL which will check the domain and URL that you have entered. After you have entered the URL of the webhook, you need to click on the check button in order to validate the URL. Once a green tick is visible on the screen, you will be able to |
...
save the webhook |
...
. |
...
Enter Method : Enter the name of the method that you need to call
...
Select Parameters : Select the parameters that you want to pass. Query parameters are the type of variables that will be passed based on the method selected. You can select multiple parameters.
Call : All the variables of ‘call type’ ($call.cli, $call.state, $call.start etc)
$flow.key : All the variable of type ‘$flow.key’ ($flow.key.<keyname>) will be passed
$user.key : All the user key variables will be passed ($user.key.<keyname>) will be passed. To know more about variables, you can click here.
...
Document API : You can use this area to document your API that is you can explain or provide some insights of the purpose of this webhook call/API. This is an optional field.
Note :
Make sure your HTTP usage is enabled for your account. If not, then you can send a mail to request for the same on support@phonon.io
Make sure to whitelist your IP in the whitelist section of your account
Once any specific method is called, the values will be appeared in the specified response variables.
Custom Webhook Widget
Info |
---|
Use this when you want to call any external API with predefined structure. All Flow Variables will work in any section of the widget. |
Introduction
This webhook widget is use to call any external API using dynamic data and configurable structure. You can use this when you want to integrate and use any external API in between or at the end of the flow execution.
Step 1: Add Webhook Widget
In the flow designer select the webhook widget and add to the designer screen and connect with the appropriate widget. Now double click on the widget to open the configurations -
Now the select the ‘custom’ option in the URL
Step 2: Configure Request
After you select the custom option, you need to configure the webhook/API request. To configure the request, you need to following configurations -
Method : You need to select the method based on the action you need to perform in the API request. The methods supported are GET, POST, PATCH, DELETE, PUT, OPTION, HEAD.
Authentication : The authentication method that is required to perform the action on the URL. You can select ‘none’ if there is no authentication required or you can select ‘basic’ and provide username and password for authentication.
Headers : Some APIs require you to send particular headers along with sending request, typically to provide additional metadata about the operation you are performing. So by clicking on ‘add headers’ and you can provide headers that are necessary by providing its key and value. You can add multiple headers and mark them as mandatory as well (if required).
Body Type : The type of the body in which the request will be send. It can be none, JSON or XML.
Body : Here you need to provide the request body, according to the body type selected
Query Parameters : Query parameters are appended at the end of the URL. They are extensions of the URL that are used to help define specific content or actions based on the data being passed. You can add multiple query parameters by clicking on ‘add query parameter’ and also mark them as mandatory by selecting the checkbox. You can provide the key and value of the query parameter in their respective text box.
Info |
---|
|
Step 3 : Configure Response
Once the request is configured, you need to configure the response of that request in webhook widget. In order to configure response, follow below steps -
Response Type : Select the type of the response that you will be receiving from API call. The response type can be JSON or XML.
Object Mapping : You can directly save a particular value from the response data in a Flow Variable. To store a response value in a Flow Variable, click on the '➕' button.
In the ‘Save In’ column, enter the Flow Variable in which you want to save the response value.
In ‘Object Map’, enter the path of the response value you want to save. To get the path for:
'JSON' Response Type : When the response type is JSON, in order to find the path of the object you can visit http://jsonpathfinder.com.
On this page, you can paste your JSON response and on the right side, click on the object whose path you need to find.
You will be able to see the path at the top right corner.
Copy that path and paste in the ‘object map’ area.
Replace ‘X' with 'data’
To know more, you can refer to the help section of the widget.
You can mark any response object as ‘mandatory’, by selecting the checkbox.
‘XML’ Response Type: When the response type is XML, you need to put the XML Path of the response value. Unfortunately, there is no simple online tool that you can use to get that value. You can read about XML Path here and test your path with sample data here. If you need more help, contact our Tech Support Team to help you with the path at support@phonon.io
Step 4 : Other Configurations
After the response parameters are configured, you can configure some additional configurations as follows -
...
Wait for response : Enable if you want to wait for the response of your request. You can play hold music meanwhile by enabling ‘Enable hold music’. The maximum response wait time is ‘60 seconds’.
...
Persist Response : Enable if you want to retain the value of flow variables after the flow execution is completed. Use this only if you need to save the data and use it later, example as a UDF in Reports.
Flow Variables : Once the execution of webhook widget is over, you will be able to get some of the values in the specified flow variables which are as follows -
...
Step 2 : Save Variable (Optional)
If you want to provide any additional parameters then first you can store that parameter in any flow variable using operation widget (General Assignment Method) and then that variable can be parsed. This step is completely optional.
Step 3 : Select configurations
In the webhook widget, you need to perform following configurations -
Select URL : Once you have configured the webhook, you will be able to see that URL in the webhook widget. Select the URL of the webhook that you need to invoke.
Enter Method : Enter the name of the method that you need to call
Select Parameters : Select the parameters that you want to pass. Query parameters are the type of variables that will be passed based on the method selected. You can select multiple parameters.
Call : All the variables of ‘call type’ ($call.cli, $call.state, $call.start etc)
$flow.key : All the variable of type ‘$flow.key’ ($flow.key.<keyname>) will be passed
$user.key : All the user key variables will be passed ($user.key.<keyname>) will be passed. To know more about variables, you can click here.
Document your API (Notes) :
It is a place to write any information about the webhook, such as expected request, expected response, meaning of response, etc.
Wyswig Summernote Editor without Image and Video capabilities (Only text)
Collapsible
Max 1000 characters are allowed
...
Step 4 : Other Configurations
After the 1st tab(request), 2nd tab would be ‘response’ in which no configurations are needed. On the 3rd tab, you will be able to perform following configurations -
Wait for response : Enable if you want to wait for the response of your request. You can play hold music meanwhile by enabling ‘Enable hold music’. The maximum response wait time is ‘60 seconds’.
Persist Response : Enable if you want to retain the value of flow variables after the flow execution is completed. Use this only if you need to save the data and use it later, example as a UDF in Reports.
Note :
Make sure to whitelist your IP in the whitelist section of your account
Once any specific method is called, the values will be appeared in the specified response variables.
2. Custom Webhook Widget
This webhook widget is use to call any external API using dynamic data with predefined structure. You can use this when you want to integrate and use any external API in between or at the end of the flow execution. In order to configure a ‘custom API’, you can follow below steps -
Step 1: Add Webhook Widget
In the flow designer select the webhook widget and add to the designer screen and connect with the appropriate widget. Now double click on the widget to open the configurations -
Now the select the ‘custom’ option in the URL
Step 2: Configure Request
After you select the custom option, you need to configure the webhook/API request. To configure the request, you need to following configurations -
URL : Enter or paste the URL endpoint of the API request. The URL must start with https. If HTTP service is enabled for the account, then you will be able to use http URLs.
Method : You need to select the method based on the action you need to perform in the API request. The methods supported are GET, POST, PATCH, DELETE, PUT, OPTION, HEAD.
Authentication : The authentication method that is required to perform the action on the URL. You can select ‘none’ if there is no authentication required or you can select ‘basic’ and provide username and password for authentication.
Headers : Some APIs require you to send particular headers along with sending request, typically to provide additional metadata about the operation you are performing. So by clicking on ‘add headers’ and you can provide headers that are necessary by providing its key and value. You can add multiple headers and mark them as mandatory as well (if required). You can remove any header by clicking on the ‘delete icon’.
Body Type : The type of the body in which the request will be send. It can be none, JSON, XML or form data.
Body : Here you need to provide the request body, according to the body type selected
Query Parameters : Query parameters are appended at the end of the URL. They are extensions of the URL that are used to help define specific content or actions based on the data being passed. You can add multiple query parameters by clicking on ‘add query parameter’ and also mark them as mandatory by selecting the checkbox. You can provide the key and value of the query parameter in their respective text box. You can remove any parameter by clicking on the ‘delete icon’.
Document your API (Notes) :
A place to write any information about the webhook, such as expected request, expected response, meaning of response, etc.
Wyswig Summernote Editor without Image and Video capabilities (Only text):
Collapsible
Max 1000 characters are allowed
Info |
---|
Marking mandatory
Flow Variables Supported
|
...
Step 3 : Configure Response
You can extract the value you need from the response you've received from your API call and map it to any flow variable
Response Type : Select the type of the response that you will be receiving from API call. The response type can be JSON or XML.
Object Mapping : You can directly save a particular value from the response data in a Flow Variable. To store a response value in a Flow Variable, click on the '➕' button.
In the ‘Save In’ column, enter the Flow Variable in which you want to save the response value.
In ‘Object Map’, enter the path of the response value you want to save. To get the path for:
'JSON' Response Type : When the response type is JSON, in order to find the path of the object you can visit http://jsonpathfinder.com.
On this page, you can paste your JSON response and on the right side, click on the object whose path you need to find.
You will be able to see the path at the top right corner.
Copy that path and paste in the ‘object map’ area.
Replace ‘
x.
' from that path with 'data.
’. Example: Replacex.glossary
withdata.glossary
You can mark any response object as ‘mandatory’, by selecting the checkbox.
Info |
---|
Array De-serialisation
Example:
|
...
‘XML’ Response Type: When the response type is XML, you need to put the XML Path of the response value. To find out the XML Path, use this Online tool: XMLToolBox to get the XML Path. You can read about XML Path here and test your path with sample data XMLToolBox. If you need more help, contact our Tech Support Team to help you with the path at support@phonon.io
Step 4 : Other Configurations
After the response parameters are configured, you can configure some additional configurations as follows -
Wait for response : Enable if you want to wait for the response of your request. You can play hold music meanwhile by enabling ‘Enable hold music’. The maximum response wait time is ‘60 seconds’.
Persist Response : Enable if you want to retain the value of flow variables after the flow execution is completed. Use this only if you need to save the data and use it later, example as a UDF in Reports.
Flow Variables : Once the execution of webhook widget is over, you will be able to get some of the values in the specified flow variables. There is a collapsible menu under success and failed section. You can click on that to know about these specified flow variables in the widget. The flow variables are as follows -
On Success -
Flow Variable | Description | Example Value |
---|---|---|
$flow.key.response_status | API call Success or Failure status | SUCCESS |
$flow.key.response_status_code | Status Code for response(2XX) | 200, 401 etc |
$flow.key.response_duration | Duration in seconds for the API to return data | 0.11 |
$flow.key.response_raw | Raw response received from server, null if empty | {...} |
$flow.key.response_error | If API resulted in error, Boolean true or false | false |
b. On Failure -
Flow Variable | Description | Example Value | ||
---|---|---|---|---|
$flow.key.response_status | API call Success or Failure statusSUCCESS | FAILED | ||
$flow.key.response_status_code | Status Code for response | 401, 200 etc | ||
$flow.key.response_status_type | Type of error, based on status code | Status Code for response(2XX) | 200 |
|
$flow.key.response_duration | Duration in seconds for the API to return data | 0.11 | ||
$flow.key.response_raw | Raw response received from server, null if empty | {...} | ||
$flow.key.response_error | If API resulted in error, Boolean true or false false |
b. On Failure -
Flow Variable | Description | Example Value | ||
---|---|---|---|---|
$flow.key.response_status | API call Success or Failure status | FAILED. True if error occured | true | |
$flow.key.error_reason | Reason for failure |
| Status Code for response | 401, 200 |
$flow.key.response_status_type | Type of error, based on status code | Redirection | ||
$flow.key.response_duration | Duration in seconds for the API to return data | 0.11 | ||
$flow.key.response_raw | Raw response received from server, null if empty | {...} | ||
$flow.key.response_error | If API resulted in error, Boolean true or false | true | ||
$flow.key.error_reason | Reason for failure | SERVER_ERROR |
Once the execution of the webhook widget is completed, according to the response the flow will move forward. That is for success response, it will move in ‘line 0’ and for failure response, it will move in ‘line 1’.
Flow End Webhook
On flow complete webhooks are used when you want to push/send all the flow details to the default webhook once the flow gets completed.
In order to send the details on flow complete, you need to follow below steps -
Step 1 : Configure webhook
First step is to configure a webhook(to which the details will be send) and set it as ‘default webhook’. To configure a webhook, you can follow below steps -
...
Go to Advanced → Webhook page
...
Click on ‘add webhook’
...
Select the method as ‘Post’
...
Enter or paste your external webhook URL and click on ‘check button’.
...
Once you see a green tick beside check button, select the authentication method.
None : If there is no authentication required
Basic : If username and password is required
...
Select the body type as ‘None’.
...
|
Info |
---|
Moving Forward : Once the execution of the webhook widget is completed, according to the response the flow will move forward in that direction, that is
|
3. Flow End Webhook
On flow complete webhooks are used when you want to push/send all the flow details to the default webhook once the flow gets completed.
In order to send the details on flow complete, you need to follow below steps -
Step 1 : Configure webhook
First step is to configure a webhook(to which the details will be send) and set it as ‘default webhook’. To configure a webhook, you can follow below steps -
Go to Advanced → Webhook page
Click on ‘Add Webhook’
Select the method as ‘Post’
Enter or paste the URL of the webhook that you need to set as default webhook.
Select the authentication method
None : If no authentication is required
Basic : If username and password is required. If you have selected this option, you need to provide the username and the password for the URL.
Select the body type as ‘None’ and click on save button.
Note |
---|
If ‘HTTP Support’ is not enabled in your account, then you will be able to see a check button beside URL which will check the domain and URL that you have entered. After you have entered the URL of the webhook and applied the authentication (if any), you need to click on the check button in order to validate the URL. Once a green tick is visible on the screen, you will be able to save the webhook. |
...
Step 2 : Enable webhook in flow
...
Enable ‘webhook for the flow’ and done. After ever execution of this flow, all the flow details will be send to the default webhook in the predefined format.
...
Predefined Format :
Code Block |
---|
{ "callDetails": [ { "calleeNumber": "Phone number of the callee", "connectTime": "Timestamp of call when started", "didNumber": "DID used in call", "duration": "Total Call duration in seconds", "endTime": "Timestamp of call when ended", "hangupCause": "Hangup cause code of the call", "incoming": True if the call was incoming false otherwise, "startTime": "Timestamp of call when started" } ], "keys": [ { "name": "$flow.key.variable1", "value": "value of variable" }, { "name": "$flow.key.variable2", "value": "value of variable" } // This will be repeated for all the variables passed during the call ], "phonon-uuid": "Phonon uuid of the call", "recordingUrls": [ { "recordedFileName": "file name of the recording", "recordedFilePublicPath": "URL of the recording, where it is stored" } ] } |
...
If you want to send some additional data at the end of the flow in some different format, then you can use a webhook widget after ‘on flow complete’ widget.
This functionality will be modified in the near future.
FAQs
What is a ‘response object’ ?