# Custom Webhooks

## Before You Begin

* You need to be able to make HTTP Calls from your account. By default, we only allow HTTPS. Send a mail to <support@phonon.io> to request to enable HTTP in your account.
* Whitelist your IP in [Whitelist](/central/essential-components-1/whitelist.md) page.
* For Request parameters, you can use [Store Variable](/central/widgets/store-variable.md) widget.
* Method names are listed below

## createOutbound

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

&#x20;[`http://192.168.1.42:3000/centraloutboundwebhook-v1/prod/`](http://192.168.1.42:3000/centraloutboundwebhook-v1/prod/)

{% tabs %}
{% tab title="Request" %}

| 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                                          |
| {% endtab %}                 |                     |                                                           |

{% tab title="Response" %}

| Flow Variable              | Value       |
| -------------------------- | ----------- |
| $flow\.key.obdResponseCode | 200         |
| $flow\.key.obdReqID        | Request ID  |
| $flow\.key.obdPhononUUID   | Phonon UUID |
| {% endtab %}               |             |
| {% endtabs %}              |             |

## shortURL

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

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

{% tabs %}
{% tab title="Direct" %}
**URL:** `https://s.phonon.in/UrlShortner/phonon/shortUrl`

**Method:** `POST`

**Headers:**

| **Headers**  |                  |
| ------------ | ---------------- |
| Content-Type | application/json |
| Accept       | application/json |

**Request:**

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

{% hint style="info" %}
custToken is static at "abcd1234"
{% endhint %}

**Response:**

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

{% hint style="info" %}
You can have your custom domain. Contact Support to help you with that.
{% endhint %}
{% endtab %}
{% endtabs %}

## 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/`](http://192.168.50.21:3000/centraloutboundwebhook-v1/test/)

**Method:** `POST`

{% tabs %}
{% tab title="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                                  |
| {% endtab %}               |            |                                                                |

{% tab title="Response" %}

{% endtab %}
{% endtabs %}

## updatePauseStatusForCLI - Change Break Status of a Direct Dial Agent <a href="#updatepausestatusforcli" id="updatepausestatusforcli"></a>

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. DD Agents can call on the Inbound number to change their pause status anytime (or you can toggle it automatically).

**Notes:**&#x20;

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/`](http://192.168.60.15:3000/centraloutboundwebhook-v1/prod/)

**Method:** `POST`

{% tabs %}
{% tab title="Request" %}

| Flow Variable    | Example      | Description                                                           |
| ---------------- | ------------ | --------------------------------------------------------------------- |
| $flow\.key.pause | `true`       | Set the Direct Dial Agent Pause Status to be true. `Mandatory`        |
|                  | `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 Code`Mandatory` |
|                  | 919879964805 |                                                                       |
| {% endtab %}     |              |                                                                       |

{% tab title="Response" %}

| Flow Variable                 | Example | Description                                         |
| ----------------------------- | ------- | --------------------------------------------------- |
| $flow\.key.cli\_pause\_update | `true`  | The Direct Dial was successfully paused / unpaused  |
|                               | `false` | The Direct Dial was  could not be paused / unpaused |
| {% endtab %}                  |         |                                                     |
| {% endtabs %}                 |         |                                                     |

**To Dos**

1. Get the current status of a Direct Dial Agent
2. The reports for break visibility are under development.
3. Stress testing of the API is due.&#x20;

### XML in webhook -

Webhook Widget now supports the XML content type along with JSON to make it even more universal.&#x20;

You can use XML in both Request Body as well as in Response mapping.

To do XML Response Mapping, read our XML Response Mapping guide [here](https://documentation-phonon-io.gitbook.io/central/release-notes/to-do).

![Zoom Webhook XML Widget.png](https://preview.3.basecamp.com/4429570/blobs/3a72d862-6530-11ea-b211-a0369f740db1/previews/full/Webhook%20XML%20Widget.png)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation-phonon-io.gitbook.io/central/widgets/webhook/custom-webhooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
