Hi I have two feature requests that are causing us...
# ask-a-descoper
c
Hi I have two feature requests that are causing us issues integrating. 1. We need to customize the invite email and not just text but dynamic content like user props and tenant id. 2. We need to be able to generate magic links for non-test users so we can send our own emails. Thanks!
s
1. To solve this, you can use our backend management SDK for invites, so you can send the email yourself in code. We are planning to enhance in future invite email templates customzations 2. You can use your own email sender connector, like Sendgrid or any SMTP email provider , and change the emails body and subject
message has been deleted
c
Hi Meir! so for 1. we have an issue with multi-tenancy. we were planning on using the backend management sdk for the invites however we would like to send url query params to send the workspaceId in the invite and there doesn't seem to be a way.
Copy code
const resp = await descopeClient.management.user.invite(
  user["loginId"],
  user["email"],
  user["phone"],
  user["displayName"],
  // You can create with userTenants or roles, not both in the same action
  roles,
  // userTenants,
// Feature request: new option for query params to decorate the url on the invite link
 [user['custom']]
);
the reason we want to do this. is we want to know which workspace the user is invited to so we can show them the correct workspace in the client on login. Edit: Oh I think I see what you mean. instead of using
Copy code
descopeClient.management.user.invite
I should just do
Copy code
descopeClient.management.user.update
to manually add a tenant and not send the descope email and then send my own email. as for 2. the specific problem we are running into is we don't want to send an invite link and then have a user get another email for the magic link in a separate email causing them to have two emails just to login for the first time. it would be great if we can send a magic link in the invite template but currently there is no way to do that.
s
1. yes, that was what I meant, there is ability to add custom fields to user https://github.com/descope/node-sdk/blob/main/lib/management/user.ts#L108 , so you can see in user page, but no way today to use them in the email ,but will add it as feature request
about 2, can you maybe explain your onboarding flow step by step ? might be able to give a better solution
c
awesome thanks! we will do that! and actually we chatted about 2. we are going to change our flow! this isn't needed anymore!
thanks for all the help!
s
NP, feel free to ask/ping anytime
a
Hey @square-vr-55083! @colossal-appointment-48082 and myself are finally getting to this feature and just wanted to ask a couple more questions. Just to clarify our requirements, we want to send email invites with custom invite links so that the newly invited user can be linked to a specific workspace, rather than just our
/invite
landing page. 1. Which calls from descope should we be calling from our backend? What is the difference between create and invite? It seems like we should manually
create
the invited user and then handle the email separately? 2. How does the SendGrid connector come into play here? It looks like we don't really need that, and instead we should be using the SendGrid API directly to send our customized email? Here is how I imagine our backend code should look, let me know if this makes sense!
Copy code
// do something
...
const resp = await descopeClient.management.user.create(...)
if (resp.ok) {
  sendgridClient.email(...)
}
s
Hey @agreeable-river-38895 We are currently working on enabling custom email invite templates , let check about timelines , as it might be worth to wait a bit for this feature release
a
Unfortunately our deadline is this Friday!
s
I see You will need to use the create method, since the invite one will send an email in our default format
Sendgrid not relevant ,it will be only after we ship new feature
b
@square-vr-55083 @agreeable-river-38895 did this get released?
Team, can we somehow “prevent” the default magic link and other mails from being sent from Descope? Can we add a “hook” in between so that we send send the mailers and then Descope can handle the session management part from there on?
s
you mean send them from your own email provider ?
b
I mean we want to use SengGrid. But as I mentioned earlier as well on another thread, our clients want emails to be shot from their own domain addresses, which we have configured on our sendgrid. On Descope I can only configure one default email send account, thus their purpose is not solved. If we can stop the mail from going along, we can send it on our own.
s
one approach you can take Is setup multiple sendgrid connectors, one for each customer than, in flow, have a condition to split for each customer, an action, with it's own connector: