Ruby script to send automatic welcome message to new users

Hello, community! been a while since I posted but I hope everyone is doing well. I wanted to share with you a ruby script I created that automatically sends a welcome message to new users that join your discourse forum.

I plan to make it into an actual executable so it’s easier to work with for people who don’t want to dig into code but right now I simply plug in my api and username into the script and then use task scheduler or a cron tab to point to the script and execute it daily.

Enjoy :slight_smile:

7 Likes

Great stuff!

Optimally you might consider packaging this as a plugin to avoid having to have a separate executable or script: Beginner's Guide to Creating Discourse Plugins Part 1: Creating a basic plugin

Architecturally you might also consider using out-of-the-box Discourse Events to capture the moment when you’d like to send a user a message - this would avoid scheduling anything.

https://github.com/discourse/discourse/blob/2ee144c27f78749aebc4fe97bc62a9fde6cf50c2/app/models/user.rb#L919

But if you need it Discourse also has a great scheduler and there are plenty of plugins that create bespoke ‘Jobs’. Scheduling jobs from a plugin - #2 by simon

1 Like