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())

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 unknown codec.

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.2.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.2.0
File Size Uploaded
aiogotoconnect-0.2.0.tar.gz 20.6 kB Details

Built distribution (wheel)

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

Total release size: 40.7 kB

Release files / aiogotoconnect-0.2.0.tar.gz

Download URL aiogotoconnect-0.2.0.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
45ad6d810d02432be5115e067487e1a4593e0e692c6cf2de5a4b7acf8b87ff15
BLAKE2b-256 checksum
How to use checksums
4d839c240513ea21aa167a1601a989014140a258240e4f108d168d0b0d044df8
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.2.0-py3-none-any.whl

Download URL aiogotoconnect-0.2.0-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f802671c5d0b974b9523e6e064b70642b72a621591b5a6170f17e1644709dd1
BLAKE2b-256 checksum
How to use checksums
7c4cf6658fa781d5a442e48c73297493a9c6d0e7285b0a6c0df1c2cb467b7fd2
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

0.3.0

2 release files

This release

0.2.0 This release

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