[SOLUTION FOUND!] In the "Submit a Post" function in the "Reddit" module, the "Image Post" post type does not work as the user expects

In the “Submit a Post” function in the “Reddit” module, the “Image Post” post type does not work as the user expects.

When I try to use the “Submit a Post” function and select “Image post” in the settings, and then specify the correct URL to the image (from any site, from any source, with any file, including links to images from the reddit site itself (specifically links to the image, not to the post with the image)), then during the operation of this module I get the following error:
“The operation failed with an error. [[“BAD_IMAGE”,“Invalid image URL.”,“url”]]”

UPD:
Reddit module and URL does not work as expected by the user. More details in my next posts!

Outdated information:
The error occurs somewhere inside the make.com service when communicating with Reddit, it is not the fault of the users.
If it is the “fault of the users”, then an explanation is required in the documentation on the make.com website, in what format the link should be sent in the “URL” field for “Submit a Post” with the “Image Post” type in the “Reddit” module.
Or give an example of how to use, for example, the HTTP module, which would allow creating similar functionality for Reddit (with the ability to post images).
The PRAW library has such a feature as posting images to Reddit, which means that make.com could use similar functionality and API in the “Reddit” module.

1 Like

I FOUND OUT what links reddit accepts in the Reddit module on make.com

ANSWER ON HOW TO FIX THE PROBLEM:
You need to first upload images to the AWS server belonging to Reddit using an HTTP request, having received a link to your image from AWS. And you need to send this link to the URL of the “Reddit” module - in this case, the post will be created and you will no longer receive the error “[[“BAD_IMAGE”,“Invalid image URL.”,“url”]]”

Example correct URL for Reddit module:
https://reddit-uploaded-media.s3-accelerate.amazonaws.com/[your_ID_of_image]

You should create your credentials on the Reddit API website (Reddit - Dive into anything), having received a Client ID and Client Secret (plus username and password your reddit account) to use them when sending images to the Reddit AWS server.

I don’t have a simple solution yet on what HTTP request to create (how to fill it) in make.com, but you can create such a link yourself using PRAW (after doing some research on how it does it) or using this simple JS program that also takes the solution from PRAW - https://www.npmjs.com/package/reddit-api-image-upload?activeTab=readme
This link has a full explanation of how reddit works in terms of image uploading.

When I have a full automated solution (based on HTTP requests) for make.com, I will add to my post here =)

Example app on reddit:

2 Likes

So, I did what I was talking about, right in blueprints make.com!

Now the images are posted to any subreddit on reddit from any source!

I will provide a template with this functionality later in this topic, but for now I will describe an example of creating a blueprint script manually:

  1. Create a script like this (in my case, the data (links to images, passwords and other data) are taken from Google Drive). To upload an image to the reddit servers, at least three HTTP requests will be required. I describe each request in detail below.

  2. In the first HTTP module, you should use the “Basic Auth” function, in which you set the Client ID and Client Secret from the Reddit website (creating an app for reddit, as I indicated above).
    Then, you set the fields in the Query String:
    ‘grant_type’ : ‘password’
    ‘username’ : ‘[YOUR_NICKNAME_ON_REDDIT]
    ‘password’ : ‘[YOUR_PASSWORD_ON_REDDIT]
    ‘User-Agent’ : ‘bot:[YOUR_CLIENT_ID]:v1.0.0 (by /u/[YOUR_NICKNAME_ON_REDDIT]) Uploading image to submit it later’

And specify the URL https://www.reddit.com/api/v1/access_token

  1. In the second HTTP module with the usual request type, you should perform a POST request to the address https://oauth.reddit.com/api/media/asset.json with the following data:
    In headers:
    ‘Authorization’ : ‘Bearer [insert from previous module ‘data: access_token’]

In body:
‘filepath’:‘[name_for_your_image_file]
‘mimetype’:‘[your_mimetype_for_your_file]

Before sending the image to the AWS server, you should download it from the site from which you are trying to publish it. For this, you can, for example, use SpreadsSheet WebHub with the Download File From Url function.
As a link for this module, specify a link to your public image on any site (in my case, I get this link from google sheets).
Example:

  1. And now in the last HTTP module, you need to fill in all the received data and send it to the AWS server along with the binary data of the image file.

From the previous HTTP module, you should take 13 fields from the “args.fields” variable and submit them to the Body of the last HTTP request, as shown in these pictures:



How to fill in the fields of this last module:


  1. HOORAY! Now we have our long-suffering link to the image, which we are already sending to the Reddit module (although after so many HTTP requests, you can make another HTTP request for submit a post on Reddit, since the Reddit module is already practically useless in this scheme at the moment).
    To do this, you point to the variable from the last HTTP module in the URL field in the Reddit module in Image Post mode:
    data.PostResponse.Location[1]

I hope this information will help you solve a huge number of problems with auto-publishing on Reddit!

Hopefully the make.com developers will do all three of these things inside the Reddit module so we don’t have to make so many extra HTTP requests!

4 Likes

For anyone who needs a fixed “Reddit - Submit a Post” module, please vote for this ticket on the make developer forum:
https://www.make.com/en/app-improvement-ideas/p/reddit-generate-an-image-url

UPD:
You can insert any valid placeholder link into the reddirect URI.
Use link “https://www.integromat.com/oauth/cb/reddit” in reddirect URI (recommend).
Or just insert the link “http://localhost:8080”, it should work.

You can get the Client ID and Client Secret from here after clicking the “Create app” button.

1 Like