Fiddling with Integromat: Steem Subreddit Link Auto-Forwarding

in #life6 years ago

Today I wanted to write about some task automation I was playing with while we were getting the Steem Subreddit up and running.

Steem Subreddit

As background, there's now an announcement by @acidyo with a cool initiative to drum up activity on the subreddit and to encourage participation. This will serve as a discussion forum for those that are not familiar with Steemit to learn about the platform. I know I was not alone in coming to this subreddit to find information about Steemit only to find nothing but a post graveyard, and now we have moderation control of the subreddit to tidy things up and direct meaningful discussion. Do check it out! (I created a reddit account after my steemit account for the purposes of answering questions I found on the steemit subreddit, and this is how I met @lunaticpandora)

Task Automation

If you are not yet familiar with IFTTT, I highly recommend playing with it or snooping around various recipes people have created. You can use it to trigger automated actions, for example, for notifying you to bring an umbrella when there's rain expected, and if you have smart devices, tools for automatically triggering various devices or otherwise augmenting smart assistants.

In fact, one of the major reasons why the Steemit subreddit was a post graveyard was exactly because many people set up IFTTT integrations to automatically post to Reddit. Back in the day, I was manually trying to redirect users of the subreddit to send their links elsewhere, to no avail. At the time, there was no active moderator either, so that made it impossible to do any sort of cleanup initiative. Now these link dumps are automatically marked as spam by automoderator rules.

So as far as the subreddit goes, everything was great. But there were actually people that were actively using the subreddit as a post promotion. I then asked, well, I wonder if we can redirect the links to another place automatically? This turned out to be pretty tricky!

Redirecting Links

What's interesting is that Reddit has the concept of personal RSS feeds that you can use to get a feed of for example your spam queue for a specific subreddit. So I thought, okay, let's use IFTTT's RSS to Reddit recipe and just dump the content to a separate subreddit I set up for this purpose.

Some of you can probably guess what happened. Well the RSS feed has things that had <table> HTML tags, and the format was not suitable for directly posting on Reddit. Ideally you'd want to extract just the link portion of the feed content and just post that. Game over for IFTTT. There's no multi-step processor, you'd have to write a custom service or something like that.

Zapier

This is when I started to look at alternatives. Zapier came to mind as a way of allowing multi-step processing. One of the steps was to extract the feed content and extract the link out. I saw that you can make custom Javscript formatters that are quite flexible, and I immediately started making something to extract the content I wanted. What was amazing about Zapier was that it had a rich interface where you could see sample feed data and test each individual component to make sure that it was extracting the piece that you expected to extract. I have nothing but praise for how much of a pleasure it was to play around with Zapier.

In a typical @eonwarped style, guess what I found out after I was able to extract the link information? Zapier has no Reddit action integration. Meaning, I couldn't set it up to post the link. I was floored, as I had simply assumed it would be there. Alright, what else is there?

Integromat

Integromat filled what I needed, and more! It also has a great interface, and I did not even need to make a custom javascript code. Here's a peek at what I ended up with:

integromatreddit.PNG

So starting with the RSS feed, you see a step that extracts elements from HTML, and I selected "Links". You can see from the screenshot that it simply allowed me to choose the Link element out of the "Description" portion of the RSS content.

guitextextractor.PNG

This outputs a collection of link elements. I only wanted the one corresponding to the user specified link, and thankfully it allowed me to specify a filter to the output.

filterlink.PNG

The specific format of the RSS content, at least for link style posts, is that the text part of the hyperlink simply says [link], and that's what I matched.

lastpieces.PNG

Now the last pieces of the flow does the following:

  1. Post the link to the /r/steemitposts subreddit.
  2. If successful, Post a comment to the link saying who submitted the link.
  3. If failure, ignore. This can happen for example when a duplicate link has been submitted.

That's right, integromat's flow control offers a way to handle errors gracefully, and that is pretty cool! There's a ton of other features as well that I have not played with as well, but the type of workflows you can set up are quite complex! The free version of integromat allows for 1000 operations per month, and I think I might end up hitting that with this flow, but let's see...

Summary

You can see the full setup in action on the /r/steemitposts Subreddit. At the moment though, the subreddit rules are marking all my automated link posts as spam so I have to approve them. I think I just need to set up an automoderator to approve them though.

Anyway that was a great deal of fun, and wanted to share my process. Let me know if you have any questions below or want to share in gushing about how cool this is. If you are looking for a task that needs automation, the solution may lie here.

Sort:  

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 62892.68
ETH 2581.23
USDT 1.00
SBD 2.73