Show random row from Google Sheets and tweet it

Hey there,
I want to start a poem quiz on Twitter. Therefore I want to tweet a short text part of a random poem and the users can comment the correct name of the poem and the author in a tweet. Every user who sends a comment should receive an automated response with the full poem, the name of the author and the title of the poem.

What have I done so far?

  • Google sheet with filled in data. ‘Poem’, ‘Author’, ‘Title’ and ‘Full poem’. (see screenshot)
  • The data of the google sheet is read correctly. (see screenshot)


My questions:

  1. If I want to select a poem in the Twitter node, there is only 1 poem. But there are 3 poems in the Google Sheet, which are read correctly in the Google sheet node. Where are the other 2 poems? :wink: (Screenshot attached)

  2. At the moment I have 3 poems in the Google sheet (later on there will be around 300). Every poem is in a row. How can I set a random number between 1 - 3, so a random row will be set, which will be tweeted?

  3. How can I setup an automated answer tweet to those people, who commented on the tweet? I want to send them a tweet in the following structure:

Thanks for guessing the poem. The correct answer is:
‘Title’ by ‘Author’:
‘Full poem’

My workflow at the moment:

I know these are a lot of questions, but maybe someone is able to give me a little advice, how I can solve some of my problems?

Thanks for all your help!
Floyd

They are there. You probably think there is only one in the Twitter node because n8n is resolves the expression {{$node["Google Sheets1"].json["Poem"]}} to the first poem. It does that, only for testing purposes, but when you run the workflow, it should tweet the 3 poems.

Good question. You can use the Item List node for that. One does the random sorting and then you pick one.

Example Workflow
  1. How can I setup an automated answer tweet to those people, who commented on the tweet? I want to send them a tweet in the following structure:

Ideally, you would use the Twitter trigger to do this, but sadly we do not have a Twitter Trigger yet. Not even sure if the Twitter API supports the event “On Reply” so to speak. It will be a matter of checking the API to see what is possible and then implement that trigger, or perhaps, the possibility to do polling instead.

1 Like

Thanks for your help so far @RicardoE105,

Ideally, you would use the Twitter trigger to do this, but sadly we do not have a Twitter Trigger yet. Not even sure if the Twitter API supports the event “On Reply” so to speak. It will be a matter of checking the API to see what is possible and then implement that trigger, or perhaps, the possibility to do polling instead.

Ok, I understand. It´s not possible at the moment. What do you mean by “possibility to do polling instead”?

Thank you for your time and help.

I mean by polling this: What is HTTP Long Polling? | PubNub

Ok, I understand. It´s not possible at the moment.

Sadly not. Someone in the community already requested the Twitter trigger. You can upvote it.

3 Likes

:pleading_face::heart: oh wow. Hopefully soon.

Thanks @RicardoE105 for the tip with the requested feature. Upvoted it. Let´s see what will happen :wink:

Thanks for your help.

2 Likes