API Error 422 for Invite Emails to users with existing account

Hello team,

I’m trying to setup an automation via Make.com to automatically invite users who purchase a new product from Kajabi to Discourse while adding them to a new group.

The issue is most (though not all!) of the people making these purchases already have an account in our forum. Based on reading through a number of other posts regarding the 422 error including the one linked below from 2021, I think the error is occurring because the emails are already associated with an account in Discourse.

But with the updated invitation system since that post, I was under the impression that this is no longer an issue, and I can bulk-invite users manually using a .csv to add them to a group even if they already have an account without throwing an error while still sending invites to those without an account.

So, how do I fix the issue? I’m using the standard API code from your API documentation for invites and it has worked in the past. I just cloned the existing (working) scenario in Make and adjusted the group name and start topic. For reference, here’s the API code I’m using:

 	{
  "email": "user@host.com",
  "skip_email": false,
  "max_redemptions_allowed": 1,
  "topic_id": 782,
  "group_names": "Group-Name"
}

Is it as simple as changing “false” to “true” in the “skip_email” section? Or would that not send invites to those without an account?

I also see the PUT function to add a user to a group, but I am working only with emails sent via webhook from Kajabi and I’m not sure how to set up a way to check emails for usernames to do this since I can’t use the email address for the PUT function as far as I can tell.

Thanks for any help!

Oh, I wanted to add that I used the same webhook link from Make in the outgoing webhook line for 3 separate products in Kajabi, but these products would not be purchased together as they are individual “add-on” options. I thought this might be the issue, but when I tested the scenario by sending a test outbound webhook from each product there were no errors. The error only started when a “real” user purchased the product, and that user had an account.

You can Reverse engineer the Discourse API and use the admin/users route and lookup the user via their email address and go from there?

Thanks for the link and suggestion. It seems a little beyond my capabilities but I’ll see what I can do without breaking anything.

Is there a reason why this can’t be resolved in the same manner that bulk invites via .csv can be when there are existing users without throwing an error to the whole process? Seems like there should be a simple way to do this by baking in a “if user exists, skip invite” line or something in the API…