Skip to main content

selfping

Text yourself from your code. One function, one key, and texts can only go to your own verified phone number, so there is no recipient field to get wrong and a leaked key cannot message anyone else.

pip install selfping
from selfping import send_ping

send_ping("Deploy finished. 0 errors.")

That's it. The key is read from the SELFPING_API_KEY environment variable, or pass it directly:

send_ping("New signup: jane@example.com", api_key=my_key)

send_ping returns what the API sent back, so you can see how many texts are left:

result = send_ping("Backup finished in 4m12s")
print(result.remaining, result.truncated)

remaining is the number of texts left this month, or None for a key without a monthly limit. truncated is True only when a message over 1600 characters was trimmed.

Requests time out after 15 seconds. Pass timeout in seconds to change that:

send_ping("Nightly import done", timeout=5)

From the terminal

selfping login                 # paste your key once
selfping "Deploy finished"     # send a text
some-job | selfping            # send what you pipe in
selfping run -- pytest         # text me when this finishes
selfping --version             # print the version

run texts you "pytest finished in 4m12s" or "pytest FAILED in 38s (exit 1)" and exits with the command's own exit code, so it drops into scripts, cron and CI unchanged. Add --label deploy to name it. Without a key, run stops before starting the command.

To try it without installing anything, use uvx selfping "Hello" or pipx run selfping "Hello".

Unknown options are rejected rather than sent as text. To send a message that starts with a dash, put -- first: selfping -- "-5 degrees and falling".

selfping login saves the key to ~/.config/selfping/credentials, readable only by you, and selfping logout removes it. When SELFPING_API_KEY is set it takes priority, which is the better fit for cron, CI and agents. There is deliberately no --key flag, so your key never lands in shell history.

Getting a key

Sign up at selfping.com/login with your phone number, prove you own it with a one-time passcode, and generate a key at selfping.com/dashboard. Free accounts get 10 texts a month, no credit card.

What people use it for

  • A text when a training run, migration or long job finishes
  • A text when the nightly cron fails instead of silently dying
  • A text when someone signs up, pays, or fills out your contact form
  • A text from your AI agent when it finishes a long run or needs a decision

Errors

send_ping raises SelfPingError when a text is not sent. It carries:

  • message: what went wrong, in plain language
  • status: the HTTP status, or 0 when SelfPing could not be reached or the request timed out
  • code: a stable code such as invalid_key, out_of_credits, rate_limited or delivery_failed, plus timeout and network_error for problems on the way
  • hint: what to do next
  • retry_after: seconds to wait before trying again, when the API says so
from selfping import SelfPingError, send_ping

try:
    send_ping("Backup finished in 4m12s")
except SelfPingError as err:
    if err.code == "out_of_credits":
        print(f"Out of texts. Retry in {err.retry_after} seconds.")
    else:
        print(err.status, err.message, err.hint)

SelfPing gives the credit back when a send fails with delivery_failed. Every error code is listed at selfping.com/docs#errors.

A notification should not take your job down with it. In a script where the text is a nice-to-have, catch SelfPingError and carry on.

One send, one credit

Every send costs exactly one credit, long or short. Keep messages under 160 characters anyway: short texts read best on a lock screen. Lead with the outcome, include the numbers that matter, and say whether anything needs you.

Notes

  • No dependencies. It uses the standard library, on Python 3.9 or newer.
  • send_ping blocks until SelfPing answers. In async code, call it with asyncio.to_thread(send_ping, "message").
  • There is no recipient parameter anywhere in SelfPing. A key texts the number that created it, only.
  • Guides: Python and cron and runnable examples.
  • Pricing: free 10 texts/month, Hobby $5/month for 100, Business $19/month for 400. selfping.com/pricing
  • There is a JavaScript package too: selfping on npm.

Metadata

Release files for selfping 1.0.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 selfping 1.0.0
File Size Uploaded Provenance Actions
selfping-1.0.0.tar.gz 12.3 kB With provenance Details for selfping-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 22.3 kB

Release files / selfping-1.0.0.tar.gz

Download URL selfping-1.0.0.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
da6caa841f82af97d8946e0fca40b171629a3ae343299ce3999f43ff44edc370
BLAKE2b-256 checksum
How to use checksums
bdb17c21721855f723bfd1a7f3caf27541edd612729c7666bc240a4b61617acf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 5, 2026.

Transparency log

Release files / selfping-1.0.0-py3-none-any.whl

Download URL selfping-1.0.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4256fcfbc917b1077a3a7e946944fed97b90499eff221b66f54305c241247815
BLAKE2b-256 checksum
How to use checksums
1ab9f4aeeae921377e9b67d60e806d2437bd20544ad7ca68beb03ffa290d12d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 5, 2026.

Transparency log

Security for selfping 1.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for selfping-1.0.0.tar.gz

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 Dec 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

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