Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Table of Content

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 -

  1. Internal Webhooks: Use any of the pre-made internal functions. Use this when you need to use any of the commonly used functions.

  2. Webhook Widget: Call any external API using dynamic data and configurable structure. Use this when you want to integrate and use any external API

  3. Flow End Webhook: Call the default external webhook for any flow. Use this when you need to push flow details on a particular webhook. TO BE DEPRECATED

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

1. Initiate Outbound Flow

Using this webhook, you can request to initiate any Outbound Flow of your account using it's API.

URL : http://192.168.1.42:3000/centraloutboundwebhook-v1/prod/

Method : createOutbound

R‌equest :

Flow Variable

Example

Description

$flow.syskey.apiVersion

1.0

Outbound Flow Version

$flow.syskey.securityID

<64 Character UUID>

Security ID

$flow.syskey.flowID

<8 Chacter UUID>

Flow ID

$flow.syskey.clientID

123123123

Client Identifier

$flow.syskey.delayMinutes

0

When to start the Outbound Flow from current system time.

$flow.syskey.contactNumbers

91997974 6666

Customer Numbers

Response :

Flow Variable

Value

$flow.key.obdResponseCode

200

$flow.key.obdReqID

Request ID

$flow.key.obdPhononUUID

Phonon UUID

2. shortURL

‌Using this webhook, you can shorten a long URL to a short URL.

URL: https://s.phonon.in/UrlShortner/phonon/shortUrl

Method: POST

Headers:

Headers

Title

Content-Type

application/json

Accept

application/json

Request:

{	
    "custToken": "abcd1234",	
    "longUrl": "https://google.co.in"
}

custToken is static at "abcd1234"

Response:

{  
    "shortUrl": "https://s.phonon.in/BEK4YYnx"
}

You can have your custom domain. Contact Support to help you with that.

3. updateUserPreferences

Using this webhook, you can update $user.key Flow Variables without requiring a Make Call widget. Great for usage in Email and SMS flows. Note: This will become an inert feature of $user.key flow variables soon resulting this to be obsolete.

URL: http://192.168.50.21:3000/centraloutboundwebhook-v1/test/

Method : POST

Request :

Flow Variable

Example

Details

$user.syskey.contactNumber

8000374XXX

Enter the unique ID of the Customer such as it's phone number.

$user.syskey.accountID

163

Account ID of the Central Account where the flow is

$user.key.XXXX...

Value

You can save or get any value

Response :

4. updatePauseStatusForCLI - Change Break Status of a Direct Dial Agent

‌Using this webhook, you can change the break status of a Direct Dial Agent. While the Direct Dial Agent is on break, s/he will not be considered for any calls allotment. For example, if your Dialer DID is 91806880080, you can create an Inbound Flow with the same DID with this webhook. DID Agents can call on the Inbound number to change their pause status anytime (or you can toggle it automatically).

Notes:

  1. In the Dialer Flow, you can get the Agent CLI using $call.agent.dnis.number or for Inbound Flow =>$call.cli.number

URL: http://192.168.60.15:3000/centraloutboundwebhook-v1/prod/

Method: POST

Request :

Flow Variable

Example

Description

$flow.key.pause

true

Set the Direct Dial Agent Pause Status to be true. Mandatory

Content

false

Set the Direct Dial Agent Pause Status to be false. Mandatory

$flow.key.cli

9879964805

CLI of the Direct Dial Agent. With or Without Country CodeMandatory

Content

919879964805

Content

Response :

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

How to Configure

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

  1. Go to Advanced → Webhook page

  2. Click on ‘add webhook’

  3. Select the method as ‘Post’

  4. Enter or paste the URL of the internal webhook that you need to call/invoke from the list below

  5. Select ‘none’ in the authentication method

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

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

  2. Enter Method : Enter the name of the method that you need to call

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

    1. Call : All the variables of ‘call type’ ($call.cli, $call.state, $call.start etc)

    2. $flow.key : All the variable of type ‘$flow.key’ ($flow.key.<keyname>) will be passed

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

  4. 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 :

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

  2. Make sure to whitelist your IP in the whitelist section of your account

  3. Once any specific method is called, the values will be appeared in the specified response variables.

Custom Webhook Widget

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

Step 1: Add Webhook Widget

  1. Add widget

  2. Select Custom

Step 2:

  1. Configure Request:

    1. Method

    2. URL: Dynamic flow variables will work

    3. Authentication

    4. Headers

    5. Body Type

    6. Query Parameters:

      1. Mandatory

  2. Configure Response:

    1. Response Type

    2. Path and how to find it

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

  3. Other Configurations

    1. Wait for response: How max seconds

  4. Flow Variables available after Webhook widget

    1. Generic:

      1. Raw response

    2. On Success

    3. On Failture

  5. Notes

Add Persisting Documentaion:

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 -

  1. Go to Advanced → Webhook page

  2. Click on ‘add webhook’

  3. Select the method as ‘Post’

  4. Enter or paste your external webhook URL and click on ‘check button’.

  5. Once you see a green tick beside check button, select the authentication method.

    1. None : If there is no authentication required

    2. Basic : If username and password is required

  6. Select the body type as ‘None’.

  7. Enable ‘Is default webhook' and click on save button.

Step 2 : Enable webhook in flow

Open the ‘Details section’ of the flow for which you want to send details to the webhook.

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 :

{	
    "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"
  }
  ]
  }

Outcome : Everytime the flow is executed, all the flow details (as mentioned in the format) will be send to the default webhook selected.

Note :

  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

  • No labels