Metadata-Version: 2.4
Name: dial-sdk
Version: 0.6.2
Summary: Official Dial SDK — phone numbers, SMS, WhatsApp, and voice calls for AI agents
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27
Requires-Dist: pubnub>=7
Requires-Dist: pydantic>=2
Description-Content-Type: text/markdown

# dial-sdk

Official Python SDK for [Dial](https://getdial.ai) — phone numbers, SMS, WhatsApp, and voice calls for AI agents.

## Install

```bash
pip install dial-sdk
# or
uv add dial-sdk
```

Requires Python 3.11+.

## Quickstart

The client is async. Construct it with a `DialConfig`, then call its methods inside an `async with` block:

```python
import asyncio
from dial_sdk import DialClient, DialConfig, SendMessageParams, MakeCallParams

async def main():
    async with DialClient(DialConfig(api_key="sk_live_...")) as dial:
        # List your numbers
        numbers = await dial.list_numbers()
        from_id = numbers[0].id

        # Send an SMS
        await dial.send_message(SendMessageParams(
            to="+15551234567",
            from_number_id=from_id,
            body="Hello from Dial",
        ))

        # Place an AI voice call
        call = await dial.make_call(MakeCallParams(
            to="+15551234567",
            from_number_id=from_id,
            outbound_instruction="You are a friendly assistant confirming an appointment.",
        ))
        print(call.id, call.status)

asyncio.run(main())
```

`DialConfig.base_url` defaults to `https://getdial.ai`. Override it for local or self-hosted setups.

## Live events

Incoming messages and call transcripts stream via an async generator:

```python
async with DialClient(DialConfig(api_key="sk_live_...")) as dial:
    async with dial.new_events_connection() as events:
        async for event in events:
            print(event)  # MessageEvent / CallEvent / CallTranscribed / ...
```

## Client methods

| Method | Description |
| --- | --- |
| `list_numbers()` | List the phone numbers on your account |
| `purchase_number(params)` | Buy a new number (`PurchaseNumberParams`) |
| `set_number_properties(...)` | Update a number's nickname / inbound instruction |
| `send_message(params)` | Send an SMS or WhatsApp message (`SendMessageParams`) |
| `list_messages(...)` | List messages, optionally filtered |
| `make_call(params)` | Place an outbound AI voice call (`MakeCallParams`) |
| `list_calls(...)` | List calls, optionally filtered |
| `get_call(call_id)` | Fetch a single call |
| `new_events_connection()` | Open a live event stream |

## Related

- [`dial-langchain`](https://pypi.org/project/dial-langchain/) — these capabilities as LangChain tools.
- [Documentation](https://docs.getdial.ai)
