# Custom integration through API

In some cases, you might want to use FlowBridge to integrate the AI agent directly in your applicaiton, rather than FlowBridge taking control over the bot’s webhook. FlowBridge has APIs available for each integration channel, allowing you to forward webhook requests from social channels from your application, directly to your Voiceflow Integration

Same use cases could be:

* You have a Telegram Web App bot and you want to integrate a chat bot for communications, but still maintain control over the webhooks being sent from your bot, within your web app
* You have built custom UI around a social app for your clients and you need to store incoming webhook information but want to use FlowBridge exclusively to handle the connection to Voiceflow

## How it works

Using FlowBridge in combination with a custom backend is very simple. All you need to do is forward the entire request from the social channel to your relevant integration endpoint which can be found by clicking the `Integration Info` button on the view client integration page

<figure><img src="/files/0iTf34BuYCtBSMrDicnt" alt=""><figcaption></figcaption></figure>

This will display both the verification token as well as the URL to the integration API. Once you forward the entire request, FlowBridge will handle it as if it's being sent from the social provider and function as normal.

## Setting custom variables from API to Voiceflow

Through the Conversation API endpoint, you can also send custom variables which will automatically be populated within Voiceflow. For example, maybe you want to send specific custom information from your application like the `paymend_id` so you can process it within the AI agent. To do this, within the root object you are sending to the FlowBridge API which contains the entire social channel's webhook object, you add a new object called `variables` which contains an JSON object of key-value pairs where the key will be the variable, and the value, the value the variable is populated with.

```json
{
	...., //The entire Webhook Payload Data
	"variables": {
		"payment_id": "F3Slm04s"
	}
}
```

Now if you create a variable in your voiceflow project called `payment_id`, you can now reference this variable which will contain `F3Slm04s` as the value.

As an example, this is what it would look like for Telegram. It includes the original webhook data with an additional key-value pair as an object on the root of the webhook data object.

```json
{
    "update_id": 2564212,
    "message": {
        "message_id": 55,
        "from": {
            "id": 651365146,
            "is_bot": false,
            "first_name": "First",
            "last_name": "Last",
            "username": "the_username",
            "language_code": "en",
            "is_premium": true
        },
        "chat": {
            "id": 654132135,
            "first_name": "First",
            "last_name": "Last",
            "username": "the_username",
            "type": "private"
        },
        "date": 1738493999,
        "text": "This is my message"
    },
    "variables": { // This part has been added
        "payment_id": "F3Slm04s" // Once you create `payment_id` in Voiceflow, it will have the value you set here
    }
}
```

## Telegram Specific

For telegram, there are some additional steps to using this, you can check out the [Using the conversation API for telegram](/documentation/social-integrations/telegram/using-the-conversation-api-for-telegram.md) page


---

# 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://docs.flowbridge.app/documentation/advanced-use-cases/custom-integration-through-api.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.
