Best answer

Assign role after WooCommerce Order

  • 17 May 2020
  • 8 replies
  • 884 views

Userlevel 1

Hi, I’m currently trying to create a Discord bot that automatically gives a user a role upon order_paid in WooCommerce. There is an additional billing field on my site where users can input their Discord usernames, in the format ‘Example#1234’.

In Zapier, I’ve set it up to grab this data correctly, however when I try to ‘Add a Role’ for Discord on Zapier, it can only find users from their display name only.
In-depth: The full username is ‘Example#1234’ but Zapier can only search for ‘Example’. If it finds a user for ‘Example’ it will give that person the role. This doesn’t work because there can be two people named the same thing or have the same characters in their name. 
Either way I tried to use Zapier’s formatter to truncate the input from ‘Example#1234’ to ‘Example’ (so it would be able to find someone at least), but the truncate function only allows you to:
1. Set a Maximum character limit,
2. Skip the first nth characters,
3. Remove ONLY the last 3 characters and append ‘...’ to the end for some reason. (??? wtf just make it remove the last x characters)


Zapier assigns roles/other functions for Discord accounts based off their UserID (a long string of numbers). How would I be able to get Zapier to assign a role based off the literal username & ID of someone?

icon

Best answer by sphynxautomation 7 June 2020, 05:47

View original

8 replies

Userlevel 7
Badge +8

Hi @trihardgg ,

Thanks for reaching out! I am escalating this to Support as they can better assist by looking at your specific Zap and configuration. 

They will be in touch just as soon as they can!

Userlevel 2
Badge +2

@trihardgg Try Formatter → Text → Split Text (string.split). Make the input the full username and the character to split on ‘#’ (don’t type the ‘ or ‘ just the # character). For the output, choose First. The formatter will take the full username (example: User#1234), split it into two pieces on the ‘#’ character (User, 1234) and output the first value of the two values (User).

This doesn’t solve your problem of picking the appropriate person if there are multiple users with the same displayname, but hopefully it solves the first issue at least.

Userlevel 7
Badge +8

Hey there @trihardgg - It looks like @sphynxautomation gave you a pretty solid answer, but we also have a Support ticket should you need additional help from our team. Thanks so much!

Userlevel 1

This doesn’t fix the issue. I also am having this issue and am directly selecting from the plain text of a G-Mail e-mail the user ID, and passing it in to Discord user search from the account, and it’s returning an error.

The user exists. The e-mail is being found by the G-Mail search. The body text is being captured. This is really an issue impeding Zapier being useful for Discord at all.

Userlevel 7
Badge +8

This doesn’t fix the issue. I also am having this issue and am directly selecting from the plain text of a G-Mail e-mail the user ID, and passing it in to Discord user search from the account, and it’s returning an error.

The user exists. The e-mail is being found by the G-Mail search. The body text is being captured. This is really an issue impeding Zapier being useful for Discord at all.

 

Hi @Nathaniel Hatten - Thanks for chiming in! Could you send us a screenshot of the error you’re seeing? That would give us context of which error you’re encountering and for our team to look further into the issue.

Thank you!

Userlevel 1

@steph.n thank you for the follow-up. I’ve raised a ticket. I’ll post the results here if they are beneficial for the community.

Sincerely,
Nathaniel Hatten

Hello @Nathaniel Hatten , did you solve your problem and assigned user name with (#) specific role?

Userlevel 1

@sphynxautomation The need for this has come up again for me, thanks for the reply. 

I’ve added a filter after your steps to only continue if ‘User Discriminator’ is in the inputted Discord username, which solves the issue of duplicate usernames. 

Reply