Skip to main content

aiogotoconnect

Async Python client for GoTo Connect: send SMS via the Messaging v2 API and place outbound text-to-speech voice calls over SIP. Pure Python, asyncio only.

Used by ha-goto, the Home Assistant integration.

Formerly published as gotoconnect (v0.1.0); renamed so the unofficial client does not carry the bare product name. The old PyPI name stays claimed but dormant.

Install

pip install aiogotoconnect

Python 3.12+.

SMS

import asyncio
from aiogotoconnect import GoToOAuth, GoToMessaging

async def main():
    auth = GoToOAuth(client_id="...", client_secret="...", refresh_token="...")
    sms = GoToMessaging(auth.async_get_access_token)
    await sms.async_send_sms("+15551230000", ["+15551234567"], "Hello from aiogotoconnect")
    # GoTo may rotate the refresh token: persist auth.refresh_token after calls.

asyncio.run(main())

GoToMessaging takes any async callable returning a bearer token, so a host app (e.g. Home Assistant) can supply its own.

Voice calls

import asyncio
from aiogotoconnect import GoToVoice

async def main():
    voice = GoToVoice("sip-username", "sip-password")  # server="reg.jiveip.net"
    with open("message.wav", "rb") as f:  # 16-bit PCM WAV
        result = await voice.call_and_play("+15551234567", f.read(), ring_timeout=25, repeat=1)
    print(result)  # CallResult(answered=True, duration=4.2, reason='completed')

asyncio.run(main())

Audio is sent as G.722 wideband when GoTo accepts it, else G.711 PCMA; pass codecs=("pcmu",) to force PCMU.

reason is one of completed, remote-hangup, no-answer, busy, rejected. bye_confirmed is False only when we hung up but the server never answered (or refused) our BYE, so the far side may still think the call is up; it is True when no BYE was needed or it was confirmed. Bad SIP credentials raise GoToAuthError.

UDP requests are retransmitted (0.5 s, 1 s, 2 s, ...) until the server responds, and the Record-Route set from the answer is honoured on the ACK and BYE. Cancelling the call_and_play task hangs up (or CANCELs a ringing call) before the cancellation propagates.

Logging

Everything logs to logging.getLogger("aiogotoconnect.sip.call") at DEBUG: SIP start-lines and status codes plus state changes, never headers or credentials. examples/make_call.py --verbose turns it on.

Exceptions

All library errors derive from GoToError:

  • GoToAuthError: credentials rejected (OAuth refresh failed, SIP digest refused, SMS 401).
  • GoToApiError: a REST call returned a non-success status (.status).
  • GoToSipError: SIP registration/signalling failed, including network failures (timeouts, DNS, TLS errors are wrapped, never raised raw).
    • GoToCallError: the call itself failed (e.g. 4xx/5xx to the INVITE, no usable SDP).

Bad arguments raise plain ValueError before any network traffic: an invalid destination number, a WAV that is unreadable, empty or has more than two channels, or an empty/unknown codecs entry (default ("g722", "pcma"); the codec is picked from the server's answer).

Create the SIP device in GoTo

  1. In GoTo Connect Admin, go to Devices -> Add Device -> SIP Device.
  2. Copy the SIP Username, Password, and the device's SIP Server and Outbound Proxy. The registrar is typically reg.jiveip.net (the library's default); the outbound proxy is account-specific (e.g. <account>.jive.rtcfront.net) — pass it as proxy=. Calls proven live against GoTo used both.

Transport

UDP (port 5060) is the default. TLS (port 5061) is supported: GoToVoice(..., transport="tls"). TLS verifies the server certificate with the system CAs; pass ssl_context= to override. An outbound proxy= host, if set, is the connection target while server stays in the SIP URIs.

Live smoke test

GOTO_SIP_USERNAME=... GOTO_SIP_PASSWORD=... python examples/make_call.py --to +15551234567 --wav message.wav --transport tls

Development

python3 -m venv .venv
.venv/bin/pip install -e '.[dev]'
.venv/bin/python -m pytest

Metadata

Release files for aiogotoconnect 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiogotoconnect 0.3.0
File Size Uploaded
aiogotoconnect-0.3.0.tar.gz 24.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiogotoconnect 0.3.0
File Interpreter ABI Platform
aiogotoconnect-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 49.0 kB

Release files / aiogotoconnect-0.3.0.tar.gz

Download URL aiogotoconnect-0.3.0.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6af0a531bd06b7fcd83af74c7c8aee7b85f7eaeeaa3858995f0db31f64cca8dc
BLAKE2b-256 checksum
How to use checksums
5eb43025c3e216764eb7cf2dfcf5033288fdef71319cb3bc28dc843d885a446b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / aiogotoconnect-0.3.0-py3-none-any.whl

Download URL aiogotoconnect-0.3.0-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c0b54455f1965ccc68969352b42d2d5449115d7016e9cb4a8ef735c008f94ac
BLAKE2b-256 checksum
How to use checksums
33a2501008c1750918ede90e5d2b2d677f3c91bbb505e36831b27be8ef0adf18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.1

2 release files

This release

0.3.0 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page