An async Python client for the real-time feeds of 1322 Monitors (1322.io), covering all eight sources: X (Twitter), Truth Social, Instagram, YouTube, TikTok, Binance Square, News and FOMO. Each source has its own WebSocket feed and key, managed in one 1322 dashboard; this package connects to each of them through the same async interface, with typed events, auto-reconnect and tracked-list REST helpers. Install from PyPI with pip install 1322-python (the import name is client1322). TikTok and FOMO are in version 0.2.0 and later. Maintained by 1322 Monitors.
Delivery, clocked to arrival on each source's WebSocket: X 150-250ms from publication on X, measured daily (selected X Ultimate accounts ~100ms average, measured); Truth Social regular lanes 150-250ms, with the @realDonaldTrump and @WhiteHouse priority lanes ~50ms average from the moment a post goes public; Instagram ~350ms median from the moment a post goes public on Instagram; YouTube uploads and Shorts, Binance Square posts, and TikTok uploads, reposts and go-lives sub-second from the moment they go public or live (a YouTube deletion and a TikTok live end follow once confirmed); FOMO events within seconds; News sub-second from the moment the article is publicly available (an outlet's own publish time can be earlier than that moment, so 1322 clocks News from public availability). No X developer account, Meta app, YouTube Data API quota or TikTok developer app is involved.
Plans from $79/month (FOMO Lite); X from $250/month for 100 accounts. A one-day evaluation is available on request, reviewed by the team, no card.
The client streams over each source's WebSocket, so your plan needs WebSocket delivery on every source you connect. It is included in X, Instagram and FOMO plans. On Truth Social it is a paid add-on (+$150/month), and on YouTube, TikTok, Binance Square and News a paid add-on (+$100/month); a Pack includes it on every source. See 1322.io/pricing.
from client1322 import Client
async with Client(platform="x", api_key="YOUR_API_KEY_HERE") as client:
async for event in client.stream():
print(event)The PyPI distribution name is 1322-python (Python package names on
PyPI may start with a digit; Python module names cannot). The importable
module is client1322. So you pip install 1322-python but
import client1322 in code. Every example in this repo uses the real
import name.
From PyPI:
pip install 1322-pythonOr straight from GitHub, if you want the unreleased main:
pip install git+https://github.com/1322monitors/1322-pythonRequires Python 3.10+.
1322 documents each source separately: its own REST base URL, WebSocket URL, key and event payload shape (see 1322.io/docs for the authoritative contract). This package keeps that per-source reality (it does not invent a common REST API that doesn't exist, and every source still connects to its own WebSocket feed with its own key) but gives you the same connection lifecycle, reconnect behavior and streaming interface for each source it covers:
- One shape:
async with Client(platform=..., api_key=...) as client:thenasync for event in client.stream():, for every covered source. - Typed events: every event is a
dataclasswith real field types (TypedDict-typed nested payloads), not a loosely-typeddict. Fullpy.typedsupport for IDEs and type checkers. - Auto-reconnect: exponential backoff (1s, 2s, 4s, 8s, ... capped at 30s), matching 1322's documented reconnection policy, implemented once and shared by every source adapter.
- Additive tweet merge: X tweets arrive across up to four progressive
stages (
tweet.mini.update->tweet.update->tweet.update.expanded->tweet.full);TweetMergerimplements 1322's documented merge rules (longest text, unioned media, deepest reply/quote chain, highest metrics, never overwrite a filled field with an empty one) bytweet.idso you don't have to. - Thin REST helpers:
track()/untrack()/list_tracked()/health()and friends, matching each source's documented management API (YouTube REST is not wrapped yet, see below).
| Source | platform= |
REST base | WebSocket connection | Docs |
|---|---|---|---|---|
| X / Twitter | "x" (or "twitter") |
api.1322.io |
fixed URL per stream (normal / ultimate), key in the X-API-Key header |
docs/x |
| Truth Social | "truth" |
truth.1322.io |
pass ws_path + ws_key from the API access page |
docs/truth |
"instagram" |
1322.io |
wss://1322.io/IG?key=<api_key>, the same key as REST |
docs/instagram | |
| YouTube | "youtube" |
youtube.1322.io (not wrapped yet) |
pass ws_url with ?key=<ws_key> from GET /v1/dashboard |
docs/youtube |
| Binance Square | "binance" |
binance.1322.io |
ws_path / ws_key fetched from GET /v1/dashboard |
docs/binance |
| News | "news" |
newsfeed.1322.io |
ws_path / ws_key fetched from GET /v1/dashboard |
docs/news |
| TikTok | "tiktok" |
tiktok.1322.io |
ws_path fetched from GET /v1/ws/status; pass ws_key (the separate WebSocket key), sent as the X-WS-Key header |
docs/tiktok |
| FOMO | "fomo" |
fomo.1322.io |
ws_url / ws_key fetched from GET /v1/dashboard; one key for REST and the stream |
docs/fomo |
About YouTube: the client wraps the YouTube WebSocket stream and its
three event types (upload, upgrade, deletion). It does not wrap
YouTube REST yet: track, untrack and list (POST /v1/track,
POST /v1/untrack, GET /v1/list) and GET /v1/dashboard are documented
at 1322.io/docs/youtube; call them with
your own HTTP client for now. The adapter also does not fetch the stream
URL for you: take ws_url and ws_key from GET /v1/dashboard (or the
API access page) and pass ws_url="<ws_url>?key=<ws_key>".
Runnable examples for all eight sources live in
examples/. Each one reads its key from an environment
variable and consumes the event stream; all but YouTube also call a REST
helper first. Quick summaries:
from client1322 import Client, TweetMerger
from client1322.platforms.x import MiniTweetUpdate, TweetFull, TweetUpdate, TweetUpdateExpanded
merger = TweetMerger()
async with Client(platform="x", api_key="YOUR_API_KEY_HERE", tier="normal") as client:
async for event in client.stream():
if isinstance(event, (MiniTweetUpdate, TweetUpdate, TweetUpdateExpanded, TweetFull)):
merged = merger.merge(event.tweet) # dedupe + additive merge by tweet.id
print(merged["author"]["handle"], merged["body"]["text"])tweet.type is TWEET, RETWEET, QUOTE or REPLY, and
tweet.created_at is Unix milliseconds. Deletions arrive as
DeletedTweet (tweet.deleted). On a hybrid plan, run one client per
stream (tier="normal" and tier="ultimate"), each with its own key, and
feed both into the same TweetMerger.
Also available: client.list_tracked(), client.add_tracked("exampledesk"),
client.remove_tracked("exampledesk"), client.list_keys(),
client.get_tweet(tweet_id, full=True), client.resolve_username("exampledesk").
async with Client(
platform="truth", api_key="YOUR_API_KEY_HERE",
ws_path="YOUR_WS_PATH_HERE", ws_key="YOUR_WS_KEY_HERE",
) as client:
async for post in client.stream():
kind = "retruth" if post.is_retruth else "quote" if post.is_quote else "post"
print(kind, post.key, post.username, post.text)Each frame is one Truth Social post with no type field; dedupe on
post.key. On a retruth, post.username is the account that retruthed.
Also available: client.track("examplecampaign"), client.untrack(...),
client.list_tracked(), client.limits(), client.status(), client.health().
async with Client(platform="instagram", api_key="YOUR_API_KEY_HERE") as client:
async for post in client.stream():
print(post.post_type, post.key, post.username, post.text)post.post_type is post, reel, story or carousel; dedupe on
post.key. Fields such as is_collab, collab_with, is_pinned,
is_paid_partnership and location are None unless the post has that
context.
Also available: client.track("examplebrand"), client.untrack(...),
client.list_tracked(), client.limits(), client.health().
from client1322.platforms.youtube import DeletionMessage, UploadMessage, UpgradeMessage
async with Client(
platform="youtube", api_key="YOUR_API_KEY_HERE",
ws_url="YOUR_WS_URL_HERE?key=YOUR_WS_KEY_HERE",
) as client:
async for event in client.stream():
if isinstance(event, UploadMessage):
print(event.subtype, event.video["id"], event.channel["name"], event.video["title"])
elif isinstance(event, UpgradeMessage):
print("image upgraded:", event.upgrade["video_id"], event.upgrade["url"])
elif isinstance(event, DeletionMessage):
print("deleted:", event.video["id"])upload is the primary event (subtype is video or short); upgrade
is conditional and most videos never produce one; deletion is a separate,
later event. Channel fields and video["title"] can be None. No YouTube
REST helpers yet (see "About YouTube" above).
from client1322.platforms.binance import BinancePinUpdateEvent, BinancePostEvent
async with Client(platform="binance", api_key="YOUR_API_KEY_HERE") as client:
async for event in client.stream():
if isinstance(event, BinancePostEvent):
print(event.post["id"], event.post["username"], event.post.get("tendency"), event.post.get("text"))
elif isinstance(event, BinancePinUpdateEvent):
print("pin change:", event.pin["username"])Every frame is {type, data} with type binance.post or
binance.pin.update; event.post / event.pin is the data object.
Also available: client.track("examplecrypto"), client.untrack(...), client.dashboard().
async with Client(platform="news", api_key="YOUR_API_KEY_HERE") as client:
async for article in client.stream():
print(article.feed, article.title, article.url)One message per article from every feed you subscribe to; dedupe on
article.guid. Feed names must match the available feeds list in the docs
exactly, for example BBC News.
Also available: client.dashboard(), client.subscribe("BBC News"),
client.unsubscribe(...).
from client1322.platforms.tiktok import TikTokContentEvent, TikTokMediaReadyEvent
async with Client(
platform="tiktok", api_key="YOUR_API_KEY_HERE", ws_key="YOUR_WS_KEY_HERE",
) as client:
async for event in client.stream():
if isinstance(event, TikTokContentEvent):
print(event.type, event.account.get("username"), event.object.get("kind"), event.object.get("url"))
elif isinstance(event, TikTokMediaReadyEvent):
print("file for", event.event_id, event.object.get("media_url"))The TikTok stream needs the TikTok WebSocket add-on (+$100/month on a TikTok plan, included in a Pack; see pricing). The REST helpers work without it.
TikTok uses two separate keys: api_key is the REST key and ws_key is
the WebSocket key, both on the API access page. The stream path is read
from GET /v1/ws/status unless you pass ws_path, and ws_key goes in the
X-WS-Key header (there is no query-string key; the API key on the stream
returns 401). event.type is tiktok.upload.created,
tiktok.repost.created, tiktok.live.started or tiktok.live.ended.
Uploads, reposts and go-lives arrive sub-second from the moment they go
public or live; a live end follows once it is confirmed, with the same
room_id as its start. A TikTokMediaReadyEvent repeats the event_id of
an upload you already have, with its signed media_url; it is not a second
post. Dedupe on event_id.
Also available: client.track("examplecreator") (or sec_uid=...),
client.untrack(...) (username, sec_uid= or track_id=),
client.list_tracked(), client.dashboard(), client.status(),
client.limits(), client.ws_status(), client.health().
from client1322.platforms.fomo import FomoThesisEvent, FomoTradeEvent
async with Client(platform="fomo", api_key="YOUR_API_KEY_HERE") as client:
async for event in client.stream():
if isinstance(event, FomoThesisEvent):
print(event.author.get("username"), event.coin.get("symbol"), event.thesis.get("text"))
elif isinstance(event, FomoTradeEvent):
print(event.user.get("username"), event.side, event.coin.get("symbol"), event.trade.get("usdAmount"))One key for REST and the stream; ws_url and ws_key are read from
GET /v1/dashboard unless you pass ws_url. The first event after
connecting is FomoLiveModeActivated; after that each event carries the
envelope's op, id (dedupe on it) and ts (Unix ms). Money and amounts
are decimal strings. Other events: FomoTokenVerifiedEvent,
FomoNewAccountEvent, FomoSignalEvent (multi_user, listing,
milestone) and FomoProfileUpdateEvent (off until you add
profile_update to user_events). WebSocket delivery is included in every
FOMO plan. FOMO events arrive within seconds.
FOMO is an independent social trading app; 1322 is not affiliated with or
endorsed by FOMO.
Also available: client.track_user("exampletrader"), client.untrack_user(...),
client.track_coin("solana:<address>"), client.untrack_coin(...),
client.set_feeds(["verified_all", "listings"]),
client.set_filters(min_trade_usd=500, trade_sides=["buy"]),
client.list_tracked(), client.dashboard(), client.ws_status().
Each source has its own key, shown on the API access page of your 1322
dashboard. Never hardcode a key in source; read it from the environment
instead. See .env.example for the variables each example
expects. Run the client on your own server, never in browser code: your
key must stay private, and the REST endpoints are not built for
cross-origin (CORS) browser requests.
stream() reconnects automatically on disconnect using 1322's documented
policy: exponential backoff starting at 1 second, doubling each attempt, and
capped at 30 seconds. No events are queued while disconnected -- this
matches 1322's documented server behavior, so a client that's offline will
simply miss whatever happened during that window, the same as any other
1322 WebSocket client. Server-sent WebSocket pings are answered
automatically by the underlying aiohttp transport; you don't need to
handle that yourself. Pass auto_reconnect=False to Client(...) to
disable reconnection (stream() then returns after the first disconnect),
and backoff_base=/backoff_cap= to tune the delay curve.
git clone https://github.com/1322monitors/1322-python
cd 1322-python
python -m venv .venv && source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -e ".[dev]"
pytestThe test suite (tests/) covers backoff math, additive tweet merging, and
event parsing for all eight sources against payload shapes taken from
1322.io/docs, plus an end-to-end Client.stream()
reconnect test driven against a fake aiohttp session (no real socket, no
API key needed). Every event-parsing fixture uses illustrative example
data, not production traffic.
Maintainer note: the package is published on PyPI as 1322-python. To cut a
release, bump version in pyproject.toml and __version__ in
src/client1322/__init__.py, add a CHANGELOG.md entry,
tag vX.Y.Z, then python -m build && twine upload dist/* with the
project's PyPI token.
- 1322-client - the TypeScript/JavaScript client
- social-monitor-examples - minimal per-source consumers
- binance-square-realtime - Binance Square example
- truthsocial-stream - Truth Social example
- 1322-benchmark - latency measurement CLI
MIT, see LICENSE.