Usage for Threads¶
Note
Agoras supports Threads via agoras threads.
Threads is Meta’s text-based conversation platform. Agoras provides full CLI support for posting, sharing, and managing Threads content.
Required Credentials¶
Before using Agoras with Threads, you’ll need to manually extract the following credentials from your Meta App in the Meta Developer Console. These credentials are required for OAuth 2.0 authentication.
App ID (
THREADS_APP_ID): Your Meta Developer App ID, used as the OAuth client identifierApp Secret (
THREADS_APP_SECRET): Your Meta Developer App Secret, used for OAuth authentication
See Threads credentials for detailed instructions on how to create a Meta App, enable the Threads API product, and obtain these credentials.
Available Actions¶
The Threads platform supports the following actions:
authorize- Set up OAuth 2.0 authentication (required first step)post- Create text and image postsvideo- Upload videosshare- Share/repost existing contentdelete- Delete a Threads post
Creating a Post¶
Post text to Threads:
agoras threads post \
--text "Hello from Agoras on Threads!"
Post with an image:
agoras threads post \
--text "Check out this image!" \
--image-1 "https://example.com/image.jpg"
Note
You must run agoras threads authorize first before using these commands.
Uploading a Video¶
Upload a video to Threads:
agoras threads video \
--video-url "https://example.com/video.mp4" \
--video-title "My Threads Video"
Note
You must run agoras threads authorize first before using this command.
Deleting a Post¶
Delete a Threads post:
agoras threads delete \
--post-id "threads_post_id"
Note
You must run agoras threads authorize first before using this command.
Post the last URL from an RSS feed into Threads¶
This command will parse an RSS feed located at --feed-url, and publish the last --max-count number of entries published in the last --post-lookback number of seconds. The post content will consist of the title and the link of the feed entry.
Note
You must run agoras threads authorize first before using this command.
Please read about how the RSS feed should be structured in the RSS feed section. This ensures that the feed is correctly parsed and that the post content is properly formatted.
agoras utils feed-publish \
--network threads \
--mode last \
--feed-url "${FEED_URL}" \
--max-count "${MAX_COUNT}" \
--post-lookback "${POST_LOOKBACK}"
Post a random URL from an RSS feed into Threads¶
This command will parse an RSS feed at --feed-url and publish one random entry that’s not older than --max-post-age. The post content will consist of the title and the link of the feed entry.
Note
You must run agoras threads authorize first before using this command.
Please read about how the RSS feed should be structured in the RSS feed section. This ensures that the feed is correctly parsed and that the post content is properly formatted.
agoras utils feed-publish \
--network threads \
--mode random \
--feed-url "${FEED_URL}" \
--max-post-age "${MAX_POST_AGE}"
Google Sheets Scheduling¶
Agoras can schedule Threads posts using Google Sheets. This allows you to plan and automate post publishing.
Run Scheduled Messages¶
Process scheduled messages from a Google Sheet:
agoras utils schedule-run \
--network threads \
--sheets-id "${GOOGLE_SHEETS_ID}" \
--sheets-name "Threads" \
--sheets-client-email "${GOOGLE_SHEETS_CLIENT_EMAIL}" \
--sheets-private-key "${GOOGLE_SHEETS_PRIVATE_KEY}"
Note
You must run agoras threads authorize first before using this command.
Sheet Format¶
Your Google Sheet should have the following columns:
status_text: Post text contentstatus_link: URL to include in poststatus_image_url_1throughstatus_image_url_4: Image URLs (optional)date: Scheduled date (format: DD-MM-YYYY)hour: Scheduled hour (format: HH, 24-hour format)state: Post state (pending,published,error)
Example sheet row:
status_text,status_link,status_image_url_1,status_image_url_2,status_image_url_3,status_image_url_4,date,hour,state
"Hello Threads!","https://example.com","https://img1.jpg","","","","21-11-2024","17","pending"
Scheduling Logic¶
Posts with
state="pending"and scheduled time in the past are processedPosts are created at the scheduled date and hour
Sheet state is updated to
publishedafter successful postingIf posting fails, state is updated to
errorUse
--network threadsto process only Threads posts, or omit to process all networks