Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Content

Table of Contents

Introduction

Webhooks are used to communicate between two different or same systems. You can use webhooks when you want central to send/receive any data from/to other systems. On Central, you can operate webhooks in 3 different manner, which are as follows -

...

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 steps to invoke any webhook in between the flow.

Step 1 : Configure Internal Webhook

List of Internal Webhook

You can use any of the following internal functions. How to configure them is listed below.

...

Flow Variable

Example

Description

$flow.key.cli_pause_update

true

The Direct Dial was successfully paused / unpaused

Content

false

The Direct Dial was could not be paused / unpaused

...

Step 1 : Configure Internal Webhook

First step is to configure a webhook(to which the details will be send). To configure a webhook, you can follow the below steps -

...

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

...

Add 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

...

  1. Method

  2. URL: Dynamic flow variables will work

  3. Authentication

  4. Headers

  5. Body Type

  6. Query Parameters:

    1. Mandatory

...

Configure Response:

  1. Response Type

  2. Path and how to find it

  3. Note: x to be replaced with ‘data’

...

Other Configurations

  1. Wait for response: How max seconds

...

Flow Variables available after Webhook widget

  1. Generic:

    1. Raw response

  2. On Success

  3. On Failture

...

Notes

...

After you select the custom option, you need to configure the webhook/API request. To configure the request, you need to following configurations -

  1. 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.

  2. 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.

  3. 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).

  4. Body Type : The type of the body in which the request will be send. It can be none, JSON or XML.

  5. Body : Here you need to provide the request body, according to the body type selected

  6. 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
  • You can mark any header or query parameter as ‘Mandatory’ by selecting the checkbox.

  • If any header or query parameter is marked as ‘Mandatory’ and if its value is not obtained at run-time then this widget will be failed and if the parameter is marked as ‘optional’ (that is the checkbox is not selected) then those parameters will be ignored if they cannot be parsed at run-time.

Step 2 : 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 for now.

Object Mapping : You can directly store a particular response object in the flow variable. To add any response object, click on the '➕' button.

In the ‘save in’, enter the flow variable in which you want to save the response object and in the ‘object map’, paste/enter the path of the object.

  1. ' JSON' Response Type : When the response type is JSON, in order to find the path of the object you can visit  http://jsonpathfinder.com.

    1. On this page, you can paste your JSON response and on the right side, click on the object whose path you need to find.

    2. You will be able to see the path at the top right corner.

    3. Copy that path and paste in the ‘object map’ area.

    4. Replace ‘X' with 'data’

    5. To know more, you can refer to the help section of the widget.

    6. You can mark any response object as ‘mandatory’, by selecting the checkbox.

  2. XML’ Response Type : When the response type is XML, you can contact our support team to find the path at support@phonon.io.

Step 3 : Other Configurations

After the response parameters are configured, you can configure some additional configurations as follows -

  1. 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’.

  2. Persist Response : Enable if you want to retain the value of flow variables after the flow execution is completed.

  3. Error code 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 -

    1. 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

$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

$flow.key.response_status_code

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.

...

  1. 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.

  2. This functionality will be modified in the near future.

FAQs

  1. What is a ‘response object’ ?