Best answer

How do I auto-assign Discord roles based on Chargebee subscriptions?

  • 29 July 2022
  • 4 replies
  • 31 views

Does anyone have any experience connecting chargebee to discord to auto-assign roles to users based on subscription? Any pointers would be appreciated. 

icon

Best answer by jesse 8 August 2022, 21:57

View original

4 replies

Userlevel 7
Badge +11

Hi @Coinrule!

I think that you’d need to start with a couple of Zaps, one using the Chargebee trigger New subscription and one for Subscription Details Updates. For the last step in the Zap, you’ll need to use a Discord action that adds the relevant user role, but you’ll need to add a step (or maybe two) in the middle of the Zap, to tell the Zap which role to add to the user based on the subscription details. To do that, you’ll need to create a table that matches the subscription to the relevant role, you can create the table in an app like Google Sheets or you can use the Formatter by Zapier Lookup table function. If you have quite a few different roles and/or change the roles on a regular basis, I’d recommend using a Google Sheet as it’s easier to update. 

 

When you create your table, you’ll need the name of the subscription (as it comes through from the Chargebee trigger) in one column and the ID of the discord role in the second column. You can find the ID of the role by looking at the roles in the dropdown field in the Zapier Discord Add Role action:

 

So, overall you Zap will likely look a bit like this:

  1. Subscription updated in Chargebee
  2. Find user in Discord
  3. Lookup table (either using Formatter or use a lookup row step in Google Sheets)
  4. Add role to user

As I mentioned, I’m guessing that you will also want to have a Zap that will account for New Subscriptions too. 

 

I hope that helps!

 

Thanks a lot! I’ll try this out, hopefully it works!

@Danvers Thanks for your help!

I was able to successfully set up steps 1, 3 and 4 (from the advised steps below). However, I was unable to setup step 2 - Find user in discord. Could you please advise more on setting up this step? The aim is to automatically find a user on discord once their subscription has been updated or a new subscription has been created on chargebee. My question is, what value should be entered on step 2 Zap (Find user in Discord) to successfully setup this step?

  1. Subscription updated in Chargebee
  2. Find user in Discord
  3. Lookup table (either using Formatter or use a lookup row step in Google Sheets)
  4. Add role to user
Userlevel 7
Badge +9

Hey @Coinrule just stepping in for Danvers here! Ahh, as it turns out, that step is going to be a bit tough with the way that action is currently set up. There is more context here but essentially, because you cannot yet search on email address (a Discord API limitation), you will need to set up a sort of Lookup table to find the correct Discord username by email address. That means, you will need to know this information ahead of time and keep the table up to date manually, which may not be feasible for you.

In the meantime, I’ve added your vote to this feature request. Should it become possible or we have any updates, we’ll share them on the thread I linked you to. Sorry for the bummer news but if you come up with any cool workarounds, we’d love to have you come back and share! I know it would benefit so many others running into the same limitation. 

Reply