Best answer

How can I make a zap from Twitter not include a link when it posts


I have a zap to send twitter posts to tumblr. for image posts it will post the image correctly but it will also still post the image link itself in the body text of the tumblr post, which goes back to my twitter. i’d also prefer it didn’t include the tweet’s hashtags in the body text.  i can’t figure out how to filter this information,  can anyone help? 

icon

Best answer by SamB 9 January 2023, 15:08

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

11 replies

Userlevel 7
Badge +14

Hi @fuure01 

Good question.

Please post detailed screenshots with how your Zap steps are configured along with the resulting post in order for us to have context, thanks.

sure thing! 
config: 
 

this is preventing it from triggering if it is a retweet or a reply 

the resulting post: 
 

so i just don’t want that https link to still be there basically? 

​​​​​​

 

Userlevel 7
Badge +11

Thanks for sharing those helpful screenshots @fuure01.

Ah, it looks like the link is added in the Caption field on the Tumbler step. As that field contains the text that’s supplied from the tweet it’ll need to be removed from it. The quickest way would probably be to use a Code by Zapier step to remove the hashtags and links from the text Twitter is sending. Then you’d select the text output from the Code step in your Tumbler step instead. 

Code by Zapier steps are a bit advanced so may not be the best option for you. But I did some playing around and it looks like this could work:

//Let's set the twitter text to be our "tumblerText"
var tumblerText = inputData.twitterText;

//Let's remove the hashtags
var removeHashtags = /\#\w\w+\s?/g;
tumblerText = tumblerText.replace(removeHashtags, "")

//Let's remove the links
var removeLinks = /(?:https?|ftp):\/\/[\n\S]+/g;
tumblerText = tumblerText.replace(removeLinks, "")
return {tumblerText}


You’d use a Run Javascript action that would look something like this:
597b35e64187dced1c124a990c1de75b.png

You’d just need to select the Text field from Twitter rather than manually typing in the text like I did in the above example.

Want to give that a try and let us know if it works for you? Keen to help get you all set here! 🙂

Hey thanks for the detailed instructions! I set up the code step after the trigger step like so:
 

and it returned 

 

Userlevel 7
Badge +11

You’re very welcome @fuure01!

Ah, it looks like some of the default code that sits in that Code field is still present. I’ve highlighted the text that needs removing in the screenshot below:
ed389ed7627cc869dc51bb69af07f709.png
Or if easier, you can just clear everything from that field, then copy and paste the code into it again.

Please let us know whether that does the trick! 

Hi thanks again, so I removed the other code, unfortunately it’s still sending the same error O: 

 

it doesn’t seem to like that last function part? hehe

 

Userlevel 7
Badge +12

Hi @fuure01!

It looks like you’re almost there, you just need to remove a bit more of the code:

 

 

If you delete that part it should work as intended. Let us know how you get on!

ahskfjh sorry that was entirely my bad. i fixed it and the code ran this time! unfortunately the result still contained the links and hashtags D: 

 

Userlevel 7
Badge +11

Thanks for letting us know @fuure01

Hmm, that’s odd. Did the Code action output the correct text, with the hashtags and links removed, or did it error again?

If it did remove them, then my guess is the Text field from Twitter still selected in the Tumbler action. In the Tumbler action the Caption field should have the text that’s output by the Code action selected, not the text from Twitter. It should look something like this:

35af3457dd46dfcbe41734dbbce35911.png

Can you double-check that the Caption field (on the Tumbler action) has the text from the Code step selected as shown above? 

Hopefully that’ll sort it. But if that’s not the case and the Code step didn’t remove the hashtags and links, can you send over a screenshot of what appeared when you tested that Code step? I’m eager to help you get up and running on this! 🙂

hi that did the trick!! ( i noticed you did say that in your first post sorry again!) thank you for your help and patience. i have also learned a lot! expect me to be back now and then as i learn to automate my artposting on various platforms thru zapier <3 have an excellent day. 💙

Userlevel 7
Badge +11

Yay! I’m so glad it’s working now, @fuure01! 😁🎉

Yes, please do reach out in Community if you’re ever running into any issues or have any questions at all. We’re always happy to help, and I hope you have an excellent day too!