> ## Documentation Index
> Fetch the complete documentation index at: https://docs.postqueen.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Threads setup

> Register the Threads application and give PostQueen its keys

Threads runs on a Meta for Developers app that you create and PostQueen reads the keys of. On
PostQueen Cloud this is already done; these steps are for your own instance.

<Info>
  This integration requires that you have setup a Meta for Developers account already. You can start by going to the [Meta/Facebook Developer Portal](https://developers.facebook.com/apps).

  This is a complex integration, and it may take some time to get it right. If you have any issues, please open an issue on [GitHub](https://github.com/GkhanKINAY/postqueen-app/issues) or email [support@postqueen.ai](mailto:support@postqueen.ai).
</Info>

<Warning>
  Threads requires the `THREADS_APP_ID` and `THREADS_APP_SECRET` environment variables on the **backend**. If either is missing or unset when the backend starts, Threads will not appear in the channel list at all. You will think the provider is broken when really the env vars never got loaded. After adding them, **restart PostQueen** and confirm Threads is offered in the Add Channel dialog before troubleshooting further.
</Warning>

<Steps>
  <Step title="Create an app">
    Go to Meta for Developers and [create a new app](https://developers.facebook.com/apps/creation/). Give your app a name and email.

    <Frame>
      <img src="https://mintcdn.com/forceplay/Gsgj4WOu3HFxkte6/images/providers/threads/threads_app_name.png?fit=max&auto=format&n=Gsgj4WOu3HFxkte6&q=85&s=7701489088730809d108c73b55b382f3" alt="Create app" width="659" height="421" data-path="images/providers/threads/threads_app_name.png" />
    </Frame>
  </Step>

  <Step title="Request access to Threads">
    Select *Access the Threads API*.

    <Frame>
      <img src="https://mintcdn.com/forceplay/Gsgj4WOu3HFxkte6/images/providers/threads/threads_request_api.png?fit=max&auto=format&n=Gsgj4WOu3HFxkte6&q=85&s=93c2faf7aa9cafc724211a164a394f2c" alt="Request access" width="992" height="498" data-path="images/providers/threads/threads_request_api.png" />
    </Frame>
  </Step>

  <Step title="Add business details, or skip">
    <Frame>
      <img src="https://mintcdn.com/forceplay/Gsgj4WOu3HFxkte6/images/providers/threads/threads_business.png?fit=max&auto=format&n=Gsgj4WOu3HFxkte6&q=85&s=9b1197f4ef3a85a5595e4961e4432b4b" alt="Add business details" width="743" height="337" data-path="images/providers/threads/threads_business.png" />
    </Frame>

    If you are unable to skip or move to the next step, and get a message saying "There are no business portfolios available to connect to this app", go to your [Meta Business Suite Settings](https://business.facebook.com/latest/settings/business_users) and make sure you have enabled Two-Factor Authentication (2FA) for your account.
  </Step>

  <Step title="Finish creating the app">
    You should not have any extra requirements to publish and maintain access.
  </Step>

  <Step title="Configure API access">
    On the app dashboard, Select "Access the Threads API" to begin customizing the API access.

    Add all four of these. `threads_basic` is selected for you; the other three are not:

    * `threads_basic`
    * `threads_content_publish`
    * `threads_manage_replies`
    * `threads_manage_insights`

    <Frame>
      <img src="https://mintcdn.com/forceplay/Gsgj4WOu3HFxkte6/images/providers/threads/threads_access.png?fit=max&auto=format&n=Gsgj4WOu3HFxkte6&q=85&s=c27516881226f0c23c12c24ff7e065c6" alt="Configure API access" width="996" height="314" data-path="images/providers/threads/threads_access.png" />
    </Frame>

    <Warning>
      Threads is the one network where a missing scope does not stop the connect. The channel
      appears, looks healthy, and then replies and analytics fail later with no obvious cause. Add
      all four now rather than finding out which one you skipped a week from now.
    </Warning>
  </Step>

  <Step title="Set threads API settings">
    * Click the "Settings" tab. Copy your "Threads App ID", and set the postqueen environment variables `THREADS_APP_ID` to this value.
    * Click the "Show" button next to the Threads App Secret, and set the postqueen environment variable `THREADS_APP_SECRET` to this value. Note that the next box is quite small, make sure you scroll across the copy the full value. It should be 32 characters long.

    <Snippet file="oauth2redirect.mdx" />

    **Your Threads OAuth2 Redirect URI:**

    * Production: `https://postqueen.example.com/integrations/social/threads`
    * Local development: `https://redirectmeto.com/http://localhost:4200/integrations/social/threads`
    * Docker: `https://redirectmeto.com/http://localhost:4007/integrations/social/threads`

    <Warning>
      Threads will not send a visitor back to a plain `http` address, so when your `FRONTEND_URL` is not `https` she wraps the callback through `redirectmeto.com` on its way home. That wrapped address is the literal string she sends to Threads, which makes it the one you register. Local development and Docker both fall into this case. Register the bare `localhost` URI instead and the login stops on Threads with a redirect mismatch.
    </Warning>

    <Warning>
      You have to "click" the URL to make it active, otherwise the form will not save.
      You can use the same value for the **Uninstall Callback URL** and **Delete Callback URL**, but note that PostQueen does not support either at this time. The form will not save unless you enter something.
    </Warning>

    <Frame>
      <img src="https://mintcdn.com/forceplay/Gsgj4WOu3HFxkte6/images/providers/threads/threads_api_settings.png?fit=max&auto=format&n=Gsgj4WOu3HFxkte6&q=85&s=0f44e49b1ffd492b7fb827d4b912a372" alt="Set threads API settings" width="1022" height="533" data-path="images/providers/threads/threads_api_settings.png" />
    </Frame>

    Go back to the 'Dashboard' view of the Facebook developers portal and click "Finish customization". Make sure you clicked through the setup wizard, and select "Yes I'm finished" to complete the setup. The API may not work until you have done this.
  </Step>

  <Step title="Restart PostQueen">
    Stop PostQueen if it is running, and then start it again to pick up the new environment variables.

    You should not try to add a Threads account to PostQueen at this time.
  </Step>

  <Step title="Add the Threads account as a tester">
    * In the sidebar go to "App roles" -> "roles".
    * Select the "Testers" tab. Click "Add People".
    * Under *Additional Roles for this App*, select *Threads Tester*.
    * Enter usernames of the threads users you want to test the app. Probably your own username. Note that this is probably different from your Meta developers account which is tied to Facebook.
  </Step>

  <Step title="Allow the app on your threads account">
    * On threads.com, open your [account settings](https://www.threads.net/settings/account);
    * Open [Website permissions](https://www.threads.com/settings/website_permissions), and switch to the "Invites" tab;
    * If all has gone well, you should have a pending invite. Accept that invite.

    <Frame>
      <img src="https://mintcdn.com/forceplay/Gsgj4WOu3HFxkte6/images/providers/threads/threads_invite.png?fit=max&auto=format&n=Gsgj4WOu3HFxkte6&q=85&s=e74c742e4e1f47fed63fb8a339a1b1a8" alt="Threads invite" width="736" height="446" data-path="images/providers/threads/threads_invite.png" />
    </Frame>
  </Step>

  <Step title="Start testing">
    * Go back to the Meta developers portal, and in the sidebar, click *Testing*, and then open the *Open Graph API Explorer*.
    * In the header, dropdown the API selector and change it to threads.net v1.

    <Frame>
      <img src="https://mintcdn.com/forceplay/Gsgj4WOu3HFxkte6/images/providers/threads/threads_api_version.png?fit=max&auto=format&n=Gsgj4WOu3HFxkte6&q=85&s=ab0a20b03d605b00c0f02600caa56321" alt="API Version" width="598" height="199" data-path="images/providers/threads/threads_api_version.png" />
    </Frame>

    * In the right sidebar, under *Access Token*, click *Generate Threads Access Token*. This will open a new window where you can select the Threads account you want to test with - it should be an account that accepted the earlier invite. If everything has worked successfully you should be provided with a very long alphanumeric access token - you do not need to do anything with this, but it proves things are working correctly.
  </Step>

  <Step title="Good luck!">
    At this stage things should be working correctly, try a test post from PostQueen to confirm.

    This is a complex integration, and it may take some time to get it right. If you have any issues, please open an issue on [GitHub](https://github.com/GkhanKINAY/postqueen-app/issues) or email [support@postqueen.ai](mailto:support@postqueen.ai).
  </Step>
</Steps>

<Check>
  The channel is in the left sidebar with its avatar and name. That is the whole confirmation: if it
  is in the list, she can post to it.
</Check>

## Next steps

<CardGroup cols={2}>
  <Card title="What she can post to Threads" icon="https://mintcdn.com/forceplay/LL5FipRv-7nhg1To/images/channels/threads.svg?fit=max&auto=format&n=LL5FipRv-7nhg1To&q=85&s=e6d5e345aadd64a283fe46d18b204c88" href="/providers/threads" width="64" height="64" data-path="images/channels/threads.svg">
    Limits, post types and settings
  </Card>

  <Card title="Configuration reference" icon="list" href="/configuration/reference">
    Every variable she reads
  </Card>

  <Card title="Connect errors" icon="plug-circle-xmark" href="/troubleshooting/oauth-connect">
    Invalid state, invalid\_grant and the rest
  </Card>

  <Card title="Another channel" icon="plug" href="/providers/overview">
    Every network, and what each one asks for
  </Card>
</CardGroup>
