# Add user to group via webhook with email

**URL:** <https://meta.discourse.org/t/add-user-to-group-via-webhook-with-email/265305>\
**Category:** WordPress\
**Created:** [May 17, 2023, 9:44am UTC](https://meta.discourse.org/t/add-user-to-group-via-webhook-with-email/265305 "2023-05-17T09:44:36Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![illusionandcards](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/illusionandcards/32/306500_2.png) [@illusionandcards](https://meta.discourse.org/u/illusionandcards)\
**Post date:** [May 17, 2023, 9:44am UTC](https://meta.discourse.org/t/add-user-to-group-via-webhook-with-email/265305/1 "2023-05-17T09:44:36Z")

</div>

Good day,

I am trying to add users from Wordpress to private groups in Discourse via webhook.

I use [WP Discourse](https://github.com/discourse/wp-discourse) plugin as a SSO login method and I don’t allow users to change their username in Discourse. I made this because I thought that this way I could use the username from Wordpress to add them to a group in Discourse. Because, I thought they would be the same.

The problem is that when the username is generated automatically in Wordpress, sometimes uses their email as their username. But Discourse doesn’t allow this in usernames, so it breaks the username at “@”.

> Example:  
> Wordpress email: [jhon@gmail.com](mailto:jhon@gmail.com)  
> Wordpress username (generated automatically): [jhon@gmail.com](mailto:jhon@gmail.com)  
> Discourse username (generated through [WP Discourse](https://github.com/discourse/wp-discourse) SSO): jhon

This is not allowing me to use the wordpress user to add them to a group.

Is there an easier way to make this?

It would be awesome to be able to add users to a group with their email instead of username. The email is always available in any app (CRM, Wordpress, etc), so it won’t be needed the extra step to make a “GET” request to the API to get the username from that email and then PUT them in the group.

I use Fluent Forms to send this data to the webhook from Wordpress when they send a form, so I can’t make the GET request and then PUT the username.

Thank you!

---

_[View the full topic](https://meta.discourse.org/t/add-user-to-group-via-webhook-with-email/265305)._
