Need help posting automating Twitter Thread Posts

Hello everyone,

I am trying to automate my Twitter thread posts using AI.

The concept:

  1. Take an idea from a Google sheets - lets say “Neuralink and the Future of Human-AI Integration”

  1. Run it through Perplexity API to do the search

  1. Parse the response using text parser

  1. Reformat it into a twitter post using OpenAI (I am using “|||” as my delimiter between posts)

  1. Parse the response again to remove the delimiter and break it into an array bundle

  1. Run an iterator to get unique operations and bundles

  1. Pass that to HTTP request which would ideally post initial tweet to Twitter and then every subsequent tweet after by grabbing the reply to id field of the previous tweet.
[
    {
        "statusCode": 403,
        "headers": [
            {
                "name": "perf",
                "value": "7469935968"
            },
            {
                "name": "content-type",
                "value": "application/problem+json"
            },
            {
                "name": "cache-control",
                "value": "no-cache, no-store, max-age=0"
            },
            {
                "name": "content-length",
                "value": "316"
            },
            {
                "name": "x-transaction-id",
                "value": "8e7af3f7901bfe05"
            },
            {
                "name": "x-response-time",
                "value": "3"
            },
            {
                "name": "x-connection-hash",
                "value": "21a30219e79a970bc46a939d68451bd7dee9db4e1170f2a4474fcf584b496de1"
            },
            {
                "name": "date",
                "value": "Sat, 16 Mar 2024 17:59:41 GMT"
            },
            {
                "name": "server",
                "value": "tsa_b"
            },
            {
                "name": "connection",
                "value": "close"
            }
        ],
        "cookieHeaders": [],
        "data": {
            "title": "Unsupported Authentication",
            "detail": "Authenticating with OAuth 2.0 Application-Only is forbidden for this endpoint.  Supported authentication types are [OAuth 1.0a User Context, OAuth 2.0 User Context].",
            "type": "https://api.twitter.com/2/problems/unsupported-authentication",
            "status": 403
        },
        "fileSize": 316
    }
]

The issue I am running into is the last step - HTTP Request.

I think there are two issues to be solved to make this work:

  1. OAuth 1.0a vs OAuth 2.0 - which to use and is HTTP request the right one to use? Twitter connection does have in reply to field available which I why I wanted to use HTTP Request

  2. How to loop through the Iterator operations so that it does not post every operation in one go - Is there a way to break down 17. Value in the request content so the first post is Operation 1 bundle before running another HTTP request to grab the post ID from Twitter?

Any help is greatly appreciated! Tried to get it solved myself but I am stuck at this point.

Cheers!