Add new badges

Is there a way to add 30 new badges at once? from excel maybe?

2 Likes

Hello Noam :wave:

There is currently no way to add multiple badges at once through the interface.
I think the best way would be to create a script that will load a data file (CSV or anything else as long as you can easily parse the data) and use Discourse’s API to create the badges.

It would do a POST request to https://www.your-discourse.com/admin/badges.json using the following JSON payload, for example:

{
	"allow_title": true,
	"multiple_grant": true,
	"listable": true,
	"auto_revoke": false,
	"enabled": true,
	"show_posts": true,
	"target_posts": false,
	"name": "Test badge",
	"description": "Badge desc",
	"long_description": "Badge long desc",
	"icon": "air-freshener",
	"badge_grouping_id": 5,
	"badge_type_id": 1
}

Does such a solution sound good to you?

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.