And we we could really use a working example of a plugin that has a form submission type action built into it. Our plugin has two things, at a high level:
some configuration items
a form that a user would input some text into, and then ‘submit’ to process
So if anyone knows of any plugin that has these two types of features, we would really appreciate a link to it so we can review how it works.
Can you say more about what you’re doing? What are you changing with the form? Can this be a theme component? Is what you’re submitting to an existing endpoint or one that you’re adding?
@pfaffman We want to create a simple form that prompts the user for four things:
Sender
Receiver
Subject
Body
The user will fill out these fields, and then click a button to trigger an endpoint that sends the email.
Specifically, the form will include the four elements, and once the “Send” button is clicked, it will invoke the endpoint to send the message.
I’m not sure if that’s exactly what you’re looking for, but the main goal is to allow an admin user to input text (the email subject and body) and click a button to send it to a user in Discourse.
In the future, we’d like to extend this so that the user can trigger multiple messages from one sender to multiple receivers. We want to manipulate parameters like the total number of messages and the delay between each one, to control how many messages are sent and how spaced out they are.
Maybe back up one step further and describe the actual problem you’re trying to solve.
Do you mean that you want to send a direct email (so the message will not exist in Discourse), or that you want to send a PM that goes to the user (which in most cases will generate an email notification).
You want to change who the sender of the PM is? That seems like the only thing that’s missing from the existing PM interface, is that right?
Thanks for the clarification! To give a bit more context, we’re working with a large user base and want to re-engage users who haven’t interacted with our app in a while. The goal is to send a private message (PM) to a large number of users from a specific sender, with control over several parameters:
Sender: The admin user will specify the username of the sender directly in the form.
Subject & Body: The admin can customize both the subject and the body of the PM.
Control over Volume: We want to control how many messages are sent at once to avoid spamming users.
Timing: The key concern is ensuring we can control how fast the messages are sent, in order to avoid overwhelming our email domain and getting flagged for spam. We’ll need to be able to space the messages out by defining delays between each message (and the corresponding email) to prevent triggering spam filters.
The ultimate aim is to get users to open the private message (which will also generate an email notification) and encourage them to return to our app.
We already have a simple Ruby script that can accomplish this task and is fully working. Currently, we’re triggering it manually by accessing the VM via SSH, which is a bit cumbersome. What we’d like to do now is adapt this script into a plugin so that an admin can easily trigger it via the UI, with the ability to input the settings (sender, subject, body, number of messages, delay between them, etc.) directly from the admin interface.
We’d like to achieve this via a plugin interface that lets the admin easily input these settings, trigger the process, and monitor the progress of the messages being sent.
I’d probably do something like have the users in a group and plan to send to all users in the group. When a message got sent, you’d set a value in a user_custom_field and use some existing topic as the text and sender of the message. A job would run every so often and send however many messages you want. I’d put the group and custom field value in settings.
Then you wouldn’t need an interface or to create a new route at all; you could just use existing settings. And you could see what had happened using the data explorer, so you wouldn’t need to develop an interface for either.
But if you want to make some fields that people enter in the UX, you should check out the <Form> thing that I mentioned already.