> ## Documentation Index
> Fetch the complete documentation index at: https://kwala.network/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# API integrations

> Call any Web2 API directly from your blockchain workflows

Kwala lets you call REST APIs, trigger webhooks, and invoke cloud functions directly from your workflows. You can also combine on-chain triggers with off-chain actions to connect blockchain events to external services though:

* **REST APIs**: Call any HTTP endpoint with custom payloads
* **Webhooks**: Trigger external services when blockchain events occur
* **Database queries**: Connect to external data sources
* **Cloud functions**: Invoke serverless functions on AWS, GCP, or Azure
* **External services**: Integrate with any service exposing an API

> [!NOTE]
>
> **API triggers vs API actions.** This page covers API **actions** — outbound HTTP calls your workflow makes (`Type: post`) after it runs. If instead you want to **start** a workflow with an inbound HTTP request from a Web2 system, you want an API **trigger**. See [API triggers](https://kwala.network/docs/concepts/triggers.md#api-triggers-web2-triggers).

## Configuration

API actions use `Type: post` to make HTTP requests:

```yaml theme={null}
Actions:
  - Name: Send_notification
    Type: post
    APIEndpoint: https://api.example.com/notify
    APIPayload:
      message: "Workflow executed successfully"
    RetriesUntilSuccess: 5
```

## Configuration fields

| Field | Required | Description |
| - | - | - |
| **Name** | Required | Unique identifier for this action |
| **Type** | Required | Set to `post` for HTTP requests |
| **APIEndpoint** | Required | The URL to send the request to |
| **APIPayload** | Optional | JSON payload for the request body |
| **Metadata** | Optional | Description of the API call |
| **RetriesUntilSuccess** | Optional | Retry attempts on failure |

## Common integrations

### Telegram notifications

You can use Kwala to send messages to Telegram chats or channels. The [Telegram notification automation](https://kwala.network/docs/use-cases/telegram-notification-automation.md) use case shows this integration in detail:

```yaml theme={null}
Actions:
  - Name: Telegram_notification
    Type: post
    APIEndpoint: https://api.telegram.org/bot<BOT_TOKEN>/sendMessage
    APIPayload:
      chat_id: YOUR_CHAT_ID
      text: "Hi! You have a new notification."
    RetriesUntilSuccess: 5
```

### Discord webhooks

Kwala supports Discord webhooks that enable sending messages to Discord channels. The following example from the [Cryptocurrency deposit alerts](https://kwala.network/docs/use-cases/cryptocurrency-deposit-alerts.md) use case demonstrates it:

```yaml theme={null}
Actions:
  - Name: discord_call
    Type: post
    APIEndpoint: https://discord.com/api/webhooks/<WEBHOOK_ID>/<WEBHOOK_TOKEN>
    APIPayload:
      content: "USDC Received on USDC Treasury Vault Smart Contract"
    RetriesUntilSuccess: 5
```

### Custom webhooks

The following example shows how you can trigger any webhook endpoint with dynamic event data:

```yaml theme={null}
Actions:
  - Name: Trigger_webhook
    Type: post
    APIEndpoint: https://your-service.com/webhook
    APIPayload:
      event: "transfer"
      from: "re.event(0)"
      to: "re.event(1)"
      amount: "re.event(2)"
    RetriesUntilSuccess: 5
```

To include blockchain data in your API payloads, use the `re.event()` syntax:

```yaml theme={null}
APIPayload:
  sender: "re.event(0)"    # First event parameter
  receiver: "re.event(1)"  # Second event parameter
  amount: "re.event(2)"    # Third event parameter
```

The index maps to the position of values in the event data. For address tracking workflows, `re.event(0)` returns the full transaction receipt which you can parse in your backend. For more details on dynamic data extraction, see [Functions](https://kwala.network/docs/concepts/functions.md).

### Using API trigger data in a payload

When the workflow is started by an API trigger, use `re.object(\"<field>\")` instead of `re.event()` to pull values from the request body:

```yaml theme={null}
APIPayload:
  customer: "re.object(\"name\")"
  amount: "re.object(\"amount\")"
  source: "kwala-workflow"   # fixed values pass through as written
```

`re.event()` reads positional on-chain event values; `re.object()` reads named fields from an API trigger body. Use whichever matches what started the run.

## Use cases

The following use case demonstrate API integrations in action:

> **[Telegram notification automation](https://kwala.network/docs/use-cases/telegram-notification-automation.md)**
>
> Send automated Telegram alerts

> **[Cryptocurrency deposit alerts](https://kwala.network/docs/use-cases/cryptocurrency-deposit-alerts.md)**
>
> Post Discord notifications on deposits

## Next steps

> **[API actions](https://kwala.network/docs/concepts/actions.md#api-actions)**
>
> Full API action reference

> **[System overview](https://kwala.network/docs/architecture/system-overview.md)**
>
> Understand the platform architecture


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.