Ability to add group/badges by slug/alternative name while using the API


As I’m currently working on integrating a website with Discourse, I’m running into the issue that there is no programatically consistent way to map external names to badges or groups, nor to create them (with the bare minimum of information) on the fly.

I think it would be a big benefit to anyone wanting to integrate anything with/onto Discourse to be able to specify/use a unique, persistent name in the communication.

I’ve browsed the code for this and as the slugs are (generally) automatically generated based on the display_name, I’m not sure if slugs would be the way to go. On the other hand, being able to specify a slug or “internal name” for badges/groups/user_fields/etc would be awesome.

Examples #1

  • External source wants to add a badge to a user1
  • Badge does not exist
  • Badge gets created with (temporary) reference name
  • Admins change the badge name/settings
  • External source does call to add badge to user2

Example #2

  • Admin fixes a typo in “example group” name
  • External source looks up group id for “example group”
  • External source does call to remove user from “example group”

Both examples would break while using the name/display_name but would both benefit from an additional handler.

Caveat; if the external source would statically map the IDs of everything, that could also work, but it would be more challenging when using development/test/acceptance/prod environments.