Guide Metadata Editor
Block Type:

https://zero.sh/guides/find-brand-mentions-and-new-leads-on-reddit

Find brand mentions and new leads on Reddit

Automatically monitor Reddit for a specific keyword. Monitor your brand or find new leads automatically.

Zero can visualize data coming from any source.

This guide will show you how to integrate it with Reddit. As with our other guides you have a complete editable example below.

We will build a simple table, but you can use the same concepts and apply them to any other block type. If you need any help do not hesitate to contact us.

Reddit calls itself The front page of the internet and while that's subjective it is true that it's the home of a lot of discussion and conversation. In those you can find new leads, happy customers or angry ones.

It's a good idea to keep an eye on that, so today we will build a table to track reddit posts!

Reddit has an excellent API and it doesn't require any authentication.

Let's get started!

With Zero you always need two things in order to build a chart/table or any other block

  1. Some Data
  2. Format that data so that it matches the required schema.

To get the data is very simple. You can use the api function and just fetch the correct endpoint:

const term = "Apple"
const {data} = await api.get(`https://www.reddit.com/search.json?q=${term}`)

Just like that step one is done. Data will now contain all the posts containing the keyword Apple.

Each block has it's own required schema. For the table block we need to return an array of objects. So that each key in the object will be a column.

We can easily modify the data object and return the data in the correct format:

const posts = data.data.children
return posts.map(p => ({
  title:`[${p.data.title}](https://www.reddit.com/comments/${p.data.id})`,
  upvotes:p.data.ups
}))

Since I'm interested only on the title and the upvotes I return only those, but of course you can return any other key you want.

The title has this weird format: [${p.data.title}](${base}/comments/${p.data.id}) This is because the table block allows to have some markdown in it, that's the simple markdown format to create a link, so that the title is clickable and it will take me directly to the post.

In a similar way, instead of searching the whole Reddit you could just return the top posts for a specific subreddit. If you sell for example a Shopify plugin, it might be usefull to monitor the subreddit /r/shopify and so on.

That would be as easy as:

const subreddit = "shopify"
const base = `https://reddit.com/r/${subreddit}`
const {data} = await api.get(`${base}/top.json`)
const posts = data.data.children
return posts.map(p => ({
  title:`[${p.data.title}](${base}/comments/${p.data.id})`,
  upvotes:p.data.ups
}))

That's it! Feel free to play with the example below and create a free account to start tracking your keywords!

Editable Block Example

Below you have a live example. Feel free to change the settings and reload the block.

Loading block preview

Need Help?

Have a look at the docs or the examples above

Questions?

Chat with us or leave a message below