0

I'm using a Google form to collect submissions from reddit users. One of the fields in my form is reddit username. When a user makes a submission, I want to automatically send the username that was filled in a reddit PM acknowledging their submission, e.g. a "thank you for filling in the form!" message.

What is the easiest way to achieve this?

My current line of thinking is that:

  1. I will need a way to detect incoming submissions and send out that data to a Python reddit bot in some manner.
  2. The reddit bot will receive this data, format a message, and PM the user.

For step 1, I am comfortable working with Google Apps script. I currently have a setup where I'm able to send out form submission data to a Discord webhook, but I don't know how to set up a similar system for reddit. Getting the data out to my Python script is the part I'm a bit stuck in.

Is this approach valid or should I be going about it differently? Any advice will be much appreciated!

Sidewinder
  • 369
  • 3
  • 13
  • 1
    The question is too broad for the site. But, you can use reddit api directly from apps-script. Receive>form submission> send a PM to reddit user using reddit api(You'll register a bot in reddit to work as your apps-script). – TheMaster Dec 15 '18 at 19:36
  • Hi @TheMaster thanks for your comment! I can't see where exactly I can use the reddit API directly from apps script, could you elaborate just a bit or point me in the right direction for that? – Sidewinder Dec 15 '18 at 19:55
  • 2
    @Sidewinder [Reddit's API documentation](https://www.reddit.com/dev/api/) has everything you need. – TheAddonDepot Dec 15 '18 at 22:05
  • 1
    Are you already using `UrlFetchApp.fetch(url,options)` to send out an HTTPS request? That's how you'd connect to something external from Apps Script. – Alan Wells Dec 15 '18 at 23:08
  • 2
    @Side Dimu and Sandy have provided excellent directions. – TheMaster Dec 15 '18 at 23:55
  • @SandyGood that's right, for Discord I am using `UrlFetchApp.fetch("DISCORD WEBHOOK URL", api_config)` and the form data gets posted in a Discord channel. Instead of the webhook URL here I need to pass it to my own Python script. Do you have a recommendation on how to set up the receiving end? e.g. [something like this?](https://stackoverflow.com/a/38070665/5900486) – Sidewinder Dec 16 '18 at 02:53
  • I don't know anything about Python or how you would set up the receiving end. Where is your Python script? On a server somewhere? – Alan Wells Dec 16 '18 at 13:17
  • 2
    @side You must host your Python script somewhere, if you want to trigger it inside apps script. But, Like I said, There's no need for Python. Post to reddit api directly through UrlFetch – TheMaster Dec 16 '18 at 21:34
  • @TheMaster thanks, looking back I think that's the cleanest way to do it. I'll try that. – Sidewinder Dec 17 '18 at 16:42
  • @SandyGood it would be on an external server yes, but some further reading shows I might not need the Python middleman at all, and I could make do with UrlFetch direct with reddit's API, which I'll explore further. Thank you for taking the time to respond! – Sidewinder Dec 17 '18 at 16:43

0 Answers0