Can one auto-generate a post?


(christine from particle) #1

Can one auto-generate a post, either through an existing plugin or through a ruby script or sql? If so what is the syntax? I’d love for people to get a PM when they get a badge for example.


(Jeff Atwood) #2

Yes, I believe @techapj can point you to the sample.

You can also use querystring to pre-fill a post.


(Sander Datema) #3

This could be the bot you’re looking for…

https://github.com/discourse/try-bot


(Arpit Jalan) #4

See this API sample for creating a new topic:


(christine from particle) #5

Hey, I think those are the bots (and api refs) I’m looking for!

Thanks, y’all!


(christine from particle) #6

Is it a complicated process to make the autogenerated post a PM?


(Kane York) #7

No. I think there’s an archetype parameter? Open your browser’s dev tools and try creating a private message to see what your code is supposed to do.


(christine from particle) #8

Thanks everyone. I have the basics of this working. Now I’d love to have these PMs send in response to certain actions, like particular custom badges or helpful flags. I noticed that the try-bot plugin is basically listening for a post_created event. Are there similar events for badges and flags?


(Kane York) #9

Nope, those would need to be added :slight_smile:


(christine from particle) #10

Ah, I thought maybe they might!

I think I see the place where I could trigger the PM, but to maximize modularity I’ve been asked to try to do this in a plugin. Whatcha think? Impossible?