In the TTS console, navigate to Applications > your app > Integrations > MQTT and note the public MQTT endpoint hostname and port (1883 for plain TCP, 8883 for TLS).
Generate API key credentials with the appropriate rights (Read application traffic, Write downlink) from the API Keys section; use the application ID as the MQTT username and the API key as the password.
Subscribe to uplink messages using the topic v3/APP_ID@TENANT_ID/devices/+/up to receive all device uplinks as JSON, or narrow to a specific device by replacing + with DEVICE_ID.
To schedule a downlink, publish a JSON payload to v3/APP_ID@TENANT_ID/devices/DEVICE_ID/down/push; include the frm_payload as base64-encoded bytes, f_port, and optionally confirmed flag.
Parse the uplink JSON structure: decoded_payload contains the formatter output, uplink_message.rx_metadata includes gateway RSSI and SNR, and received_at is the server-side timestamp.
Use TLS on port 8883 and verify the server certificate against the TTS CA to prevent MQTT credential interception on untrusted networks.
Known gotchas
The MQTT username format must include the tenant ID (APP_ID@TENANT_ID) for The Things Industries cloud; on self-hosted TTS the format may differ — check the console for the exact string.
Downlinks published to the /down/push topic are added to the queue; use /down/replace to overwrite any existing pending downlinks rather than accumulating a queue of stale commands.
TTS rate-limits downlinks per device based on the selected frequency plan's duty cycle; scheduling too many confirmed downlinks causes queuing delays and potential session resets.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp