Twitter workflow API loop

Hello bubblers,

I’ve been working on Bubble for a few months and I love it ! I started to connect Bubble with APIs with API connector to raise my level. I started to use the Twitter API to get discussions from the same author (for those who know how to use twitter to get threads).

  • 1st step : I managed to connect the twitter api and to get the information I needed in API Connector ! First victory :wink:

  • 2nd step : I succeeded manually with a button and a repeating group to rebuild and go up the discussion (thread) from the last tweet to the first tweet. Because in Twitter to go up a discussion (thread). You have to start from the last tweet to go back to the first tweet and rebuild a discussion (Thread).

  • Step 3: Automate the reconstruction of the discussion (thread) Tweet by Tweet to go back to the first tweet. To do this, I have to make two loops that retrieve the id of the previous tweet to be able to go back to the previous tweet like that until the first of the discussion (thread). To do this, I have to go through the Workflow API and I’m having trouble ! :sweat:

In api connector, i connected to the Twitter api and in my example in the image below I get :


  • tweet id → This is the id of the last tweet of the discussion (Thread) of the author → “id”: “1377698889113931785”

  • author_id → the author of the tweet and the discussion (thread) → “author_id”: “1286341463597604864”

  • The conversation-id → The first id of the tweet of the conversation (thread) → “conversation_id”: “1376914220411985926”

  • The in_reply_to_user_id → As it’s a discussion (thread) I got the id of the author which is the same for all tweets. → “in_reply_to_user_id”: “1286341463597604864”

  • The “referenced_tweets” which contains → “type”: “replied_to” and
    “id”: “1377270074634076166” which is the id of the previous tweet it replies to.

-And the text → the content of the tweet.

In the Workflow API I have to create two loops that respond to each other to retrieve the id of the last tweet and go back to the previous tweet to the first tweet of the discussion (thread).

In API Workflow I must first get the id of the last tweet of the thread

  • “id”: “1377698889113931785” then I get the parameters to go back to the previous tweet to which it replies.

The id of the previous tweet to which it answers is in “referenced_tweets” it is “id”: “1377270074634076166” and I check if the author id always corresponds to the same author “author_id”: “1286341463597604864” and if the id corresponds to the conversation id which is equal to the first tweet of the discussion (thread) “conversation_id”: “1376914220411985926” and the loop stops.

I hope I was clear ! Not so simple.

I started the API Workflow with an endpoint with my tweet id and I get the data from the API and then I can’t set up my loop.



Can you advise me to make my loops?
Thanks for your feedback

1 Like

https://developer.twitter.com/en/docs/twitter-api/conversation-id

Hey @afouquet31 ,
Congrats on this. Unfortunately I’m blocked at your first stage. I’m trying to get Twitter threads using the API connector as well, but I only manage to get a single tweet. Not the replies (thread).
Could you share your setup on this?

Here’s what I currently have:

And the response:

Thanks in advance for your help!