Extract string from Tweet

(Darren) #1

Hi. I’m building a flow that searches for a Twitter message to a specific user account, then uses a string from the Tweet to search a Google sheet.

So, Tweet will have a username and a zipcode - and all I want to use is the zipcode. What do I need to do in my flow to strip out the stuff I don’t need from the Tweet and just be left with the zipcode?

Thanks!

(Karen Barker) #2

Hi @Darren,

Could you give an example of the exact format the messages come in? Is there a common format that we could use the Text Split Text option on to always return the 2 pieces of data?

(Darren) #3

Hi Karen - yes.

I’m expect the message to have a twitter username (always the same one) and a UK postcode. Eg the content of the message would be:

@twitterusername postcode

The format for postcode isn’t fixed, its a combination of letters and numbers up to 8 chars in length, so what i wanted to so with tjhe tweet message would be:

  1. Strip out the twitter username ( always same string)
  2. Remove all spaces from the string that is left
  3. Use the resulting string to search a google sheet ans select a cell to tweet back to the original tweeter.

Make sense?

D

(Karen Barker) #4

Hi @Darren

There’s a flow here which should show you how this needs to work.

Basically the first action is to take the message received in the trigger and split the message on all spaces. We know that the 1st split will always include the twitter username so this can be ignored, but we may have 1 or more extra results from the postcode section of the string. We need to join these back together so the 2nd action in my flow handles doing this. The output should then be a postcode without spaces that you can use to search the Google Sheet. :slight_smile: