# v2.6.0: Crossposting to Threads Implements ADR-069. ## What changed - `starpunk/syndication.py`: `ThreadsClient` (target `threads`); media entries now carry their public `url`; `process_due()` calls each client's optional `maintain()` hook, which Threads uses to refresh its token. - `starpunk/config.py`: `THREADS_ACCESS_TOKEN`, `THREADS_USERNAME`, `THREADS_NAME`, `THREADS_MAX_CHARS` (500), `THREADS_MAX_MEDIA` (4). - `tests/test_syndication_threads.py`: a fake Graph API covering text, image and carousel posts; container polling; edits not following; deletes (including posts already deleted by hand); a lost publish reply; permanent and rate-limit errors; and token refresh, persistence and replacement. ## Configuration | Variable | Meaning | |---|---| | `THREADS_ACCESS_TOKEN` | Long-lived Threads user token. Enables the target. | | `THREADS_USERNAME` | Optional. Used for the Micropub `syndicate-to` uid (`https://www.threads.com/@name`) and for fallback links. | | `THREADS_NAME` | Label in the editor (default `Threads`) | After the first daily refresh, the working token lives in `DATA_PATH/threads_token.json`. The configured value only seeds it. Changing `THREADS_ACCESS_TOKEN` switches to the new token. ## Getting a token (one time) 1. At , create an app with the **Access the Threads API** use case. 2. Under the use case's permissions, add `threads_basic`, `threads_content_publish` and `threads_delete`. 3. Under **App roles → Roles**, add your Threads account as a Threads tester. Accept the invite in Threads (Settings → Account → Website permissions → Invites). The app can stay in development mode. 4. In the use case settings, add `https:///` as a redirect URI. Then open: https://threads.net/oauth/authorize?client_id=APP_ID&redirect_uri=https:///&scope=threads_basic,threads_content_publish,threads_delete&response_type=code After you approve, the browser lands on `https:///?code=...`. Copy the code (drop a trailing `#_`). 5. Exchange the code for a short-lived token, then exchange that for a long-lived one: curl -s -X POST https://graph.threads.net/oauth/access_token \ -F client_id=APP_ID -F client_secret=APP_SECRET \ -F grant_type=authorization_code -F redirect_uri=https:/// -F code=CODE curl -s "https://graph.threads.net/access_token?grant_type=th_exchange_token&client_secret=APP_SECRET&access_token=SHORT_TOKEN" 6. Set `THREADS_ACCESS_TOKEN` to the long-lived `access_token`. The app secret is only needed for these steps. StarPunk doesn't use it. ## Not done - Video, GIF and WebP images (Threads takes video by URL. StarPunk only stores still images, and Threads rejects GIF and WebP). - Edits (no API for them).