# Add custom badge by querying an api

**URL:** https://meta.discourse.org/t/add-custom-badge-by-querying-an-api/64038
**Category:** Support
**Created:** [June 6, 2017, 3:16pm UTC](https://meta.discourse.org/t/add-custom-badge-by-querying-an-api/64038 "2017-06-06T15:16:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![meldsza](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meldsza/32/120840_2.png) [@meldsza](https://meta.discourse.org/u/meldsza)
#### Post date: [June 6, 2017, 3:16pm UTC](https://meta.discourse.org/t/add-custom-badge-by-querying-an-api/64038/1 "2017-06-06T15:16:49Z")

</div>

I need a way to add a donator badge to users by querying a custom api. How can i make this a possibility?  
Can i use sso to set badges?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [June 6, 2017, 3:33pm UTC](https://meta.discourse.org/t/add-custom-badge-by-querying-an-api/64038/2 "2017-06-06T15:33:13Z")

</div>

You can add users to a group via SSO and Grant a badge to every user in that group.

---

<div class="post-metadata">

### Author: ![meldsza](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meldsza/32/120840_2.png) [@meldsza](https://meta.discourse.org/u/meldsza)
#### Post date: [June 6, 2017, 4:24pm UTC](https://meta.discourse.org/t/add-custom-badge-by-querying-an-api/64038/3 "2017-06-06T16:24:45Z")

</div>

so how do i add badge on group add?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [June 6, 2017, 4:35pm UTC](https://meta.discourse.org/t/add-custom-badge-by-querying-an-api/64038/4 "2017-06-06T16:35:14Z")

</div>

> [@Grant a badge for all members of a group](https://meta.discourse.org/t/automatically-grant-a-badge-for-all-members-of-a-group/18147):
>
> I just created a badge for all the awesome [plugin authors](https://meta.discourse.org/badges). Creating a badge targeting a group is quite easy, just type this into the SQL box: select user\_id, created\_at granted\_at, NULL post\_id from group\_users where group\_id = ( select g.id from groups g where g.name = 'GROUP\_NAME\_IN\_LOWER\_HERE' ) I will add a trigger for this at some point so granting is faster, in the mean time just go to /sidekiq/scheduler and kick off the badge job to rush it. See [Triggered custom badge queries](https://meta.discourse.org/t/triggered-custom-badge-queries/19336) for mo…

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:44pm UTC](https://meta.discourse.org/t/add-custom-badge-by-querying-an-api/64038/5 "2024-06-08T12:44:42Z")

</div>

This topic was automatically closed after 2558 days. New replies are no longer allowed.
