question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to submit a link including a flair

See original GitHub issue

I am submitting links successfully with this code:

    const response = await redditAPI
      .getSubreddit('amihot')
      .submitLink(
        {
          title: newRedditPost.title + ' ' + subreddit.titlePostfix,
          url: newRedditPost.imageUrl
        }
      )

However, some subreddits require the use of flairs. See for example this one: https://www.reddit.com/r/amihot/submit The flair is actually mandatory. How do I submit a flair as I post? I tried this:

    const response = await redditAPI
      .getSubreddit('amihot')
      .submitLink(
        {
          title: newRedditPost.title + ' ' + subreddit.titlePostfix,
          url: newRedditPost.imageUrl,
          flair: "Female"
        }
      )

But it didn’t work.

Thanks!

Kara

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
SpyTeccommented, Apr 25, 2021

Hi,

Just opened #317 that will fix this. After it’s been verified and merged I’ll release a new version with this fix.

I believe you will then be able to do:

const linkFlairs = await redditAPI.getSubreddit('amihot').getLinkFlairTemplates()
const femaleFlair = linkFlairs.find(o => o.flair_text === 'Female')
const response = await redditAPI
  .getSubreddit('amihot')
  .submitLink(
    {
      title: newRedditPost.title + ' ' + subreddit.titlePostfix,
      url: newRedditPost.imageUrl,
      flair_id: femaleFlair.flair_template_id
    }
  )

If that doesn’t work you might have to add flair_text: '' to the form as well. But I doubt it as it would only be used if you can edit the flair text

0reactions
lilsweetkaracommented, Jan 28, 2022

I am sorry for the noise… I was just wondering if these two branches made it into the main program?

  • feat/flair-templates-newlink
  • feat/submit-options

I am sorry if the answer is obvious, I don’t know how to check

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Add Link/Post Flairs on Reddit - YouTube
How To Add Link / Post Flairs on Reddit. Watch later. Share. Copy link. Info. Shopping. Tap to unmute. If playback doesn't begin...
Read more >
What Is Reddit Flair (and How to Use It)
If you want to add a post flair to an existing post, open it first, then select the three-dots menu icon > Add...
Read more >
What is Reddit flair and how to flair a post
Click on “ADD USER FLAIR” just below your name. Choose your preferred flair from the list and click “APPLY” to save changes.
Read more >
How to submit link flair with a post? I keep getting a 400 error
Submitting with a title and url works fine. Code is as follows: subreddit.submit(url='whateverurl.com', title='Test Title', flair_text='This ...
Read more >
What Is Reddit Flair? How to Use It
In the latter case, select the Choose Community button in the upper left of the Post editor. Selecting a community will reveal the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found