Skip to content

Quickstart

By the end of this guide your phone will ring, play an audio file, and hang up. No AI yet - that’s Recipes. This is the smoke test that proves your account, API key, number, and webhook endpoint are all wired up correctly.

Time: ~5 minutes if you have the prerequisites ready.

  • A Teler account with an active API key
  • One Teler phone number on your account (your from_number)
  • A phone you can receive the call on (your to_number)
  • A publicly reachable HTTPS endpoint (we’ll use ngrok for local dev)
  • Python 3.9+ or Node 20+ (or just curl)
  • A publicly reachable audio file in MP3 or WAV format
Terminal window
pip install teler

When Teler initiates a call, it asks your server what to do. Your server returns a JSON Call Flow. For this quickstart we’ll return a play action.

flow_server.py
from flask import Flask, jsonify
app = Flask(__name__)
@app.post("/flow")
def flow():
return jsonify({
"action": "play",
"media_url": "https://your-host.example.com/hello.mp3",
})
if __name__ == "__main__":
app.run(port=3000)
Terminal window
pip install flask
python flow_server.py

Teler must reach your /flow endpoint over public HTTPS.

Terminal window
ngrok http 3000

Copy the https://<random>.ngrok-free.app URL. That’s your flow_url base.

from teler import Client
client = Client("YOUR_API_KEY")
call = client.calls.create(
from_number="+91XXXXXXXXXX", # your Teler number
to_number="+91XXXXXXXXXX", # the phone that will ring
flow_url="https://<random>.ngrok-free.app/flow",
status_callback_url="https://<random>.ngrok-free.app/status",
record=True,
)
print(call.id)

Your phone rings. Pick up. The audio plays. The call ends. Done.

Teler also POSTs call-status events (call.initiated, call.answered, call.completed) to your status_callback_url. This smoke test doesn’t need to handle them (a 404 there won’t stop the call), but production apps should. See Webhooks.

  1. Your code called the Teler API with from, to, flow_url, and status_callback_url.
  2. Teler dialed your phone (to_number) from your Teler number (from_number).
  3. When you answered, Teler issued a POST to your flow_url asking for instructions.
  4. Your flow server returned { "action": "play", "media_url": "..." }.
  5. Teler streamed that audio to the call, then ended it.
SymptomLikely causeFix
403 Forbidden (Invalid API Key.)Bad API keyCheck the X-API-Key header / SDK constructor
422 (x-api-key field required)Missing API keySend the X-API-Key header (or pass the key to the SDK constructor)
502 / 504 on initiateUpstream call origination failed or timed out (e.g. from_number not usable on your account, or a routing/carrier issue)Use a number provisioned on your Teler account and retry
Phone never ringsFlow server unreachable from the public internetMake sure ngrok is running and the URL is HTTPS
Call connects but silencemedia_url not reachable, wrong codec, or 404Visit the URL in a browser; it must download an MP3/WAV directly
Flow server gets a request but call dropsFlow JSON malformed or response > 5sReturn valid JSON and respond within 5 seconds