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

# Tata Smartflo Setup

> Configure Tata Smartflo for inbound and outbound calling with the Vocobase API

# Tata Smartflo Setup

This guide walks you through connecting your Tata Smartflo account to Vocobase for BYOP WebSocket calling.

<Note>
  Configure Tata Smartflo with the Partner API (`PUT /api/v2/config/telephony/tata-smartflo`) for the default connection. To create multiple named Tata Smartflo connections, use `POST /api/v2/telephony/connections`. Once Tata Smartflo is configured, start calls programmatically using `POST /calls/start` with `"provider": "tata_smartflo"`.
</Note>

## Prerequisites

* A Tata Smartflo account with panel **email and password** credentials
* API access enabled by Tata Smartflo for your account
* At least one Smartflo DID returned by `GET /v1/my_number`
* An approved Vocobase partner account with `"tata_smartflo"` present in `allowed_telephony_providers` (check `GET /config`)
* A public HTTPS backend URL where Smartflo can reach the Vocobase resolver and lifecycle webhook

<Tip>
  If `"tata_smartflo"` is not yet listed in your partner config's `allowed_telephony_providers`, contact your Vocobase account manager to enable it.
</Tip>

## Step 1: Get your Tata Smartflo credentials

<Steps>
  <Step title="Find your Smartflo panel credentials">
    Use the same **email and password** you use to sign in to the Smartflo panel. Vocobase uses these credentials server-side to mint short-lived Tata Smartflo API tokens when it calls Smartflo on your behalf.

    <Warning>
      These credentials grant access to your Smartflo account. Treat them like any other production secret.
    </Warning>
  </Step>

  <Step title="Enable API and Voice-Bot streaming access">
    Ask Tata Smartflo to enable API access and Dynamic Voice-Bot streaming for your account. The Smartflo panel must be able to call your Vocobase backend at the Dynamic Voice-Bot endpoint and lifecycle webhook URL.
  </Step>

  <Step title="Identify the DID you will use">
    Smartflo DIDs come from `GET /v1/my_number`. Copy the number you plan to use as the caller ID or inbound DID.

    The number should be stored in E.164 format in Vocobase (e.g., `+918011223344`).
  </Step>
</Steps>

## Step 2: Configure Tata Smartflo in Vocobase

Send the credentials through the Partner API. `email`, `password`, and `from_number` are required; `base_url` is optional and defaults to the Tata Smartflo API host.

<Note>
  This endpoint updates your default Tata Smartflo connection. To create multiple named Tata Smartflo connections, use `POST /api/v2/telephony/connections` and store the returned `connection_id`.
</Note>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT https://api.vocobase.com/api/v2/config/telephony/tata-smartflo \
    -H "Authorization: Bearer rg_live_abc123def456ghi789jkl012" \
    -H "Content-Type: application/json" \
    -d '{
      "email": "ops@example.com",
      "password": "your-smartflo-password",
      "from_number": "+918011223344",
      "base_url": "https://api-smartflo.tatateleservices.com"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.vocobase.com/api/v2/config/telephony/tata-smartflo",
    {
      method: "PUT",
      headers: {
        "Authorization": "Bearer rg_live_abc123def456ghi789jkl012",
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        email: "ops@example.com",
        password: "your-smartflo-password",
        from_number: "+918011223344",
        base_url: "https://api-smartflo.tatateleservices.com"
      })
    }
  );
  const result = await response.json();
  console.log(result);
  ```

  ```python Python theme={null}
  import requests

  response = requests.put(
      "https://api.vocobase.com/api/v2/config/telephony/tata-smartflo",
      headers={
          "Authorization": "Bearer rg_live_abc123def456ghi789jkl012",
          "Content-Type": "application/json"
      },
      json={
          "email": "ops@example.com",
          "password": "your-smartflo-password",
          "from_number": "+918011223344",
          "base_url": "https://api-smartflo.tatateleservices.com"
      }
  )
  print(response.json())
  ```
</CodeGroup>

A successful response confirms credentials were stored:

```json theme={null}
{
  "success": true,
  "data": {
    "email": "ops@example.com",
    "from_number": "+918011223344",
    "base_url": "https://api-smartflo.tatateleservices.com",
    "message": "Tata Smartflo credentials updated successfully."
  }
}
```

<Tip>
  Your Smartflo password is encrypted at rest and never returned in API responses.
</Tip>

### Create a named connection

For new BYOP builds, prefer named connections so each Smartflo account or DID set has a stable `connection_id`.

```bash theme={null}
curl -X POST https://api.vocobase.com/api/v2/telephony/connections \
  -H "Authorization: Bearer rg_live_abc123def456ghi789jkl012" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "tata_smartflo",
    "name": "Tata Smartflo - Sales",
    "tata_email": "ops@example.com",
    "tata_password": "your-smartflo-password",
    "from_number": "+918011223344",
    "base_url": "https://api-smartflo.tatateleservices.com"
  }'
```

<Note>
  `agent_number` wiring for outbound `click_to_call` is pending Tata confirmation. Do not pass `agent_number` unless Vocobase has confirmed the value to use for your Smartflo account.
</Note>

## Step 3: Confirm the partner sees Tata Smartflo as configured

Fetch your partner configuration. The response should now include Tata Smartflo in `allowed_telephony_providers`:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET https://api.vocobase.com/api/v2/config \
    -H "Authorization: Bearer rg_live_abc123def456ghi789jkl012"
  ```
</CodeGroup>

```json theme={null}
{
  "success": true,
  "data": {
    "name": "acme-corp",
    "allowed_telephony_providers": ["twilio", "tata_smartflo"],
    "telephony": {
      "twilio": { "configured": true, "account_sid": "conf****ured", "from_number": "+14155551111" },
      "tata_smartflo": {
        "configured": true,
        "email": "ops@example.com",
        "base_url": "https://api-smartflo.tatateleservices.com",
        "from_number": "+918011223344"
      }
    },
    "...": "..."
  }
}
```

`telephony.tata_smartflo.configured: true` confirms the credentials and from-number landed. Presence in `allowed_telephony_providers` is what gates your ability to start a Tata Smartflo call.

## Step 4: Make a test call

Start an outbound call with `"provider": "tata_smartflo"`. If your partner account has multiple active Tata Smartflo connections, include `connection_id`.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.vocobase.com/api/v2/calls/start \
    -H "Authorization: Bearer rg_live_abc123def456ghi789jkl012" \
    -H "Content-Type: application/json" \
    -d '{
      "agent_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "to_number": "+919876543210",
      "provider": "tata_smartflo",
      "connection_id": "9b7f1c44-c87f-4f0c-9124-3c802a9c1a20"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.vocobase.com/api/v2/calls/start",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer rg_live_abc123def456ghi789jkl012",
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        agent_id: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        to_number: "+919876543210",
        provider: "tata_smartflo",
        connection_id: "9b7f1c44-c87f-4f0c-9124-3c802a9c1a20"
      })
    }
  );
  const result = await response.json();
  console.log(result);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api.vocobase.com/api/v2/calls/start",
      headers={
          "Authorization": "Bearer rg_live_abc123def456ghi789jkl012",
          "Content-Type": "application/json"
      },
      json={
          "agent_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
          "to_number": "+919876543210",
          "provider": "tata_smartflo",
          "connection_id": "9b7f1c44-c87f-4f0c-9124-3c802a9c1a20"
      }
  )
  print(response.json())
  ```
</CodeGroup>

```json theme={null}
{
  "success": true,
  "data": {
    "call_id": "c1234567-abcd-1234-abcd-123456789012",
    "session_id": "s1234567-abcd-1234-abcd-123456789012",
    "status": "pending",
    "provider": "tata_smartflo",
    "connection_id": "9b7f1c44-c87f-4f0c-9124-3c802a9c1a20",
    "from_number": "+918011223344",
    "to_number": "+919876543210",
    "agent_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}
```

Vocobase manages the Smartflo API token, WebSocket resolver, media path, and lifecycle ingestion. Partners only need to configure credentials, complete the Smartflo panel provisioning checklist, and pass `"provider": "tata_smartflo"` when starting calls.

## Partner provisioning checklist

Complete these items with Tata Smartflo before live traffic:

| Area                       | Required setup                                                                                                                                                                                                                                                                                      |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| API authentication         | Use the Smartflo panel email and password. Vocobase mints Tata Smartflo bearer tokens server-side; partners do not send tokens in call-start requests.                                                                                                                                              |
| Dynamic Voice-Bot endpoint | Configure `https://<backend>/api/tata/resolve-wss?secret=<TATA_RESOLVE_SECRET>` as the Dynamic Voice-Bot endpoint URL. Map Smartflo variables `$callId`, `$fromNumber`, `$toNumber`, and `$status`. Vocobase must answer within `<= 2000 ms` with exactly `{"success":true,"wss_url":"wss://..."}`. |
| Lifecycle webhook          | Configure `https://<backend>/api/tata/lifecycle` as the lifecycle webhook URL. Enable `Call answered by Customer (Click to call)` and `Call hangup (Missed or Answered)`, plus the equivalent inbound answered and hangup triggers. Set `Content-Type` to `application/json`.                       |
| DIDs                       | Smartflo DIDs come from `GET /v1/my_number`. Inbound DIDs must be routed in the Smartflo panel to the Voice-Bot streaming app so incoming calls invoke the Dynamic Voice-Bot endpoint.                                                                                                              |
| Outbound agent leg         | Outbound `agent_number` wiring is pending Tata confirmation (spike S1). Keep this unset until Vocobase confirms the required Smartflo value for your account.                                                                                                                                       |

<Warning>
  The Dynamic Voice-Bot resolver response is strict. Extra keys, non-200 responses, invalid JSON, or responses slower than 2000 ms can cause Smartflo to drop the call.
</Warning>

## Troubleshooting

### "Tata Smartflo not configured" or 403 on `/calls/start`

* Confirm `"tata_smartflo"` is in `allowed_telephony_providers` from `GET /config`. If it is not, contact your Vocobase account manager.
* Confirm `email`, `password`, and `from_number` were saved (`telephony.tata_smartflo.configured: true`).

### `CONNECTION_AMBIGUOUS` error

* Your account has multiple active Tata Smartflo connections. Call `GET /api/v2/telephony/connections?provider=tata_smartflo` and pass the desired `connection_id` in `POST /api/v2/calls/start`.

### Smartflo rejects credentials

* Re-check the email and password against the Smartflo panel sign-in.
* Confirm Tata has enabled API access for the Smartflo account.
* If you recently changed the panel password, re-send `PUT /api/v2/config/telephony/tata-smartflo` with the new password.

### Inbound calls do not reach the agent

* Confirm the DID appears in `GET /v1/my_number` for your Smartflo account.
* Confirm the DID is routed in the Smartflo panel to the Voice-Bot streaming app, not only to a regular queue or SIP endpoint.
* Confirm the Dynamic Voice-Bot endpoint URL includes `secret=<TATA_RESOLVE_SECRET>` and maps `$callId`, `$fromNumber`, `$toNumber`, and `$status`.

### Calls answer but do not update status in Vocobase

* Confirm the lifecycle webhook URL is `https://<backend>/api/tata/lifecycle`.
* Confirm Smartflo is sending the answer and hangup triggers with `Content-Type: application/json`.
* Check whether Tata Smartflo is sending an equivalent inbound trigger for inbound calls.

## Updating credentials

Changed your Smartflo password? Re-send `PUT /api/v2/config/telephony/tata-smartflo` with the new `password`. This endpoint always requires `email`, `password`, and `from_number` together, so include all three plus `base_url` if you use a custom host.

For named connections, create a replacement connection or update the default connection endpoint until credential rotation support is available for that connection.

## Next steps

<CardGroup cols={2}>
  <Card title="Telephony Connections" icon="settings" href="/telephony/connections">
    Create and manage multiple named connections.
  </Card>

  <Card title="Inbound Calls" icon="phone-incoming" href="/inbound-calls">
    Sync and assign inbound Smartflo DIDs.
  </Card>

  <Card title="Bring Your Own Phone" icon="phone" href="/telephony/byop-setup">
    Overview of all supported BYOP providers.
  </Card>

  <Card title="Quick Start" icon="rocket" href="/quickstart">
    Create an agent and make your first call.
  </Card>
</CardGroup>
