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

AI-generated summary

TyIsI requests the ability to use slugs or alternative names for groups and badges in the Discourse API to enable consistent integration with external systems. Currently, relying on display names is problematic because changes to names break integrations. They suggest that using a unique, persistent identifier—like a slug—would allow external sources to create and reference groups and badges reliably, even when names are modified. This would be especially useful across different environments (development, production, etc.) where static ID mapping is impractical.

Hi!

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.

Thanks,
Ty