Foyer API
Webhooks (coming soon)
Webhooks are not available yet. They are planned for the next phase of the Foyer API. Until then, check for new calls with since, as below.
What is planned
You give Foyer an HTTPS address, and Foyer tells it when something happens:
| Event | When |
|---|---|
call.ended | A screened call ended. |
voicemail.received | A caller left a voicemail. |
call.needs_review | Foyer held a call for your review. |
call.processed | The transcript and recording of a call are ready. |
Each event will be signed, and will carry only ids and a time, never what the caller said. Your code then fetches the details with its own key and permissions. The event names and format may change before release; this page will have the exact details.
People using the connector in Claude or ChatGPT will not need webhooks: the assistant asks Foyer when you talk to it.
Until then: check with since
Ask for calls that started since your last check, with a few minutes of overlap so a call that was still in progress is not missed, and remember which calls you have already handled. Every five minutes is plenty and uses about 300 requests a day.
import os
import time
from datetime import datetime, timedelta, timezone
import requests
API = "https://api.hifoyer.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['FOYER_API_KEY']}"}
seen = set()
last_check = datetime.now(timezone.utc)
while True:
time.sleep(300)
since = (last_check - timedelta(minutes=15)).isoformat()
last_check = datetime.now(timezone.utc)
resp = requests.get(f"{API}/calls", headers=HEADERS, params={"since": since, "limit": 100}, timeout=30)
resp.raise_for_status()
for call in reversed(resp.json()["data"]):
if call["id"] not in seen:
seen.add(call["id"])
print("New call:", call["outcome_label"], "-", call["summary"])A call's summary, transcript and recording can finish a little after the call ends. To catch a voicemail's text, see the voicemail to Slack recipe, which waits until voicemail.state is transcribed.