I tried setting this up this AM and was running into a 400 error. With a little bit of debugging, I found that the auth-related steps need to go in the headers section as instructed, but the actual form values (email, group name, and custom message) need to go in the data section as key/value sets.
Once I made that change, though, it worked perfectly!
Thanks for testing that! What I’m finding is that when no custom_message or group_names are included in the request, passing the email in the Headers works. It’s not the correct way to pass the email address though. I’ve updated the guide to use the Data section for setting the email address, and have included examples for adding users to groups and including a custom message.
I’m not aware of other services that are similar to Zapier, but I’m sure there are some out there. You can make requests directly to the Discourse API without using a third party service. The main requirement for doing this is that you have an application to make the requests from. This can be something a simple as a WordPress site.
Creating an invite will send an email to invited user’s email address. That email contains a link to a page where the invited user can set their name and password, and login to their new account. The email address for the new account is set by the email address that you used for the invite.
Only users who have been sent an invite can create an account through this page. If you would like to only allow invited users to register for your site, go to the Login section of your Site Settings and select the invite only site setting.
The best way to get a sense of how invites work is to invite yourself to your site. You can use a throw-away gmail address for this. You will need to log out of the site before you will be able to accept your invite.
It is possible to invite a new user to a topic with a similar approach to what is outlined above, but the URL that you setup in the Action step needs to point to the topic. For example, to invite a user to a topic with the id 123 you would add the URL https://forum.example.com/t/123/invite to the Action step. You would then add the email and the optional custom_message and group_names parameters in the same way as they are outlined in the guide.
Make sure that you are using the group’s name and not the name of the category that you allow the group to access. You can find the group’s name in the URL for the group, or from the group’s Name field:
If that does not resolve the issue, make sure that the Discourse API key you add to Zapier is a global All Users API key. Also, make sure that the API Username set on Zapier has permission to add users to the group. Any admin username on your site will work for this.
Let me know if this doesn’t resolve the issue for you.
You can invite the user to multiple groups by adding a comma separated list of group names to the group_names field on Zapier. Discoure doesn’t have the concept of sub-groups, so you will need to add the name of each group you want to invite the user to.
From the screenshot you have provided, it looks like you are trying to give the user access to a category and all of its subcategories. Instead of creating a group for each subcategory you could just allow a single group to access the category and all of its subcategories. This is configured on the Security section of the category’s edit page.
I have another question, maybe you (or @simon) could help me in that :
With Zapier, is there a way to give access to a New group, for people who are already members of Discourse ?
Basically, here is my workflow :
1/ A member joins one of my courses
2/ Zapier takes his email from my learning platform, and send him an invite to my Discourse + add him automatically to the right group, related to the course he just joined.
3/ Sometime, a few months later, this same member will join Another course : So, with my actual process, my Zapier will send him a new invite to Discours, whereas he is already a member, so the invite will not work.
I would need Zapier to give him access to a new group, if he is already a member of my Discourse.