generated from freelawproject/new-project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 14
One‐Time Setup to enable Threads
Elisa edited this page Nov 6, 2024
·
5 revisions
These steps only need to be completed once to set up the requirements to add Threads bots.
To access the Threads API, you need a Facebook Developer Account and a Facebook App configured with the appropriate use case.
- Create a Facebook Developer Account: If you don’t have one, go to Facebook for Developers and sign up.
-
Create a New App:
- Go to My Apps > Create App (or click here).
- Select "Access the Threads API" as the primary use case for this app.
- Complete the app creation process, providing basic details as prompted.
-
Customize access to the Threads API:
- From your app’s Dashboard, go to the left navigation bar and select Uses cases.
- Click the
Customize
button next to the Access the Threads API use case. - In the Permissions tab, enable the following permissions:
- threads_basic: For basic access to Threads.
- threads_content_publish: For publishing content on Threads.
- In the Settings tab, set the Redirect Callback URLs to
<DJANGO_BASE_URL>/threads_callback
(in prodhttps://bots.law/threads_callback
). Do not forget to press enter after typing the URL since the text box accepts multiple inputs, otherwise it won't be saved.
-
Get the App Credentials:
- In the Settings > Basic section of your app, note down the Threads App ID and Threads App secret. You’ll need these to fetch the access token for Threads.
In the .env
file, set the following variables:
THREADS_APP_ID="YOUR_APP_ID"
THREADS_APP_SECRET="YOUR_APP_SECRET"
THREADS_CALLBACK_URL="DJANGO_BASE_URL/threads_callback" # URL that points to the threads_callback view
- Make sure the bots.law S3 bucket allows the actions
s3:PutObject
,s3:GetObject
ands3:PutObjectAcl
for the AWS account used. - Make sure the bucket also allows the
s3:GetObject
action for everyone. - For reference, this policy has the minimum statements required for the integration to work (authenticated user can put objects in the bucket, and everyone can read them)
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<AWS_ACCOUNT_ID>:user/<USER>"
},
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:PutObjectAcl"
],
"Resource": "arn:aws:s3:::<BUCKET_NAME>/*"
},
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::<BUCKET_NAME>/*"
}
]
}
After completing these steps, you can now proceed to create new Threads channels.