Hi, regarding the email about the webhook change ...
# permit-saas
r
Hi, regarding the email about the webhook change
"We want to let you know about an important upcoming change to the User Management Element when used with webhook-only configuration (i.e., without email settings).
[...]
Starting in 14 days:
This behavior will change. Instead of immediately creating the user, the webhook will now send an "invitation" event, and the user will only be created once the invitation is accepted.
Can we test this behavior in our environment first to see if everything is working as expected ?
a
Hi @Robin Simard, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
Based on the documentation, the User Management Element webhooks currently support several event types (1) . When a user invitation is sent through the User Management Element with email configuration enabled, the webhook sends an "invite_user" event with this payload :
Copy code
{
  email: str
  role: str
  tenant_id: str
  type: ElementsWebhookType = "invite_user"
}
For testing the new invitation behavior in your environment, you can: 1. Set up a test webhook endpoint to receive the invitation events 2. Configure the User Management Element without email settings (webhook-only configuration) 3. Monitor the webhook payloads to verify the new "invitation" event format The webhook endpoint should handle POST requests and return a 200 HTTP status code to acknowledge receipt . You can also configure a secret for webhook validation to ensure data is coming from a trusted source . For approving invited users programmatical
To learn more, see the sources I considered: [[1] Configure Webhooks](https://docs.permit.io/embeddable-uis/webhooks) [[2] Email Configuration and Templates](https://docs.permit.io/embeddable-uis/email-configuration-and-templates)
a
Hey @Robin Simard, right now this behavior works only if both email and webhook notifications are enabled. You can set up an email (just for testing) and try the webhook. In 14 days, webhook-only notifications will be in production.
r
Ok, so we have to handle the invite_user webhook, but the pending invite status and new Element iframe will come later and not after 14 days, right? We use the webhook to create the user in our platform and send them a welcome email with a temporary password.
a
The pending invite status is already exists when both email and web notifications are enabled. In 14 days, the pending invite status will be visible also when the webhook only is enabled
🙏 1
r
So if I understand correctly, in 14 days we won’t be able to skip the pending status or the email sent by Permit? And adding a tenant to Permit will only happen once the invited user accepts the invitation?
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
r
The first image shows our current flow
j
We have this behaviour when testing:
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
j
o
Correct, the approval call is the added requirement.
j
this function does not seem to exist: https://github.com/permitio/permit-python/blob/main/permit/api/users.py to do this:
Copy code
await permit.api.users.approve(
    user_key="new_user",
    email="new-user@example.com",
    invite_code="ed32bc43e2194a80a5ef5e0339943b44"
)
You seem to be right about the Python SDK; I’ll ask @Alon Boshi and @Shuvy Ankor to fix this
j
Thank you. Let me be honest. This is a very short notice to apply a fix in production in less than two weeks on our end. Especially if its not possible to do it.
o
How long would you like?
Side note: You can of course call the API directly as described above, even if not in the SDK. Though I 100% acknowledge it should be in the SDK
j
i’d say 1 month from the moment it is available from the python SDK. the onboarding process is crucial and it needs to be tested properly. The email states it is just to fix the webhook. but in reality its not the case, a lot of new things is going on in the new flow:
o
You got it 🙂
Can you clarify “a lot of new things is going on in the new flow” ?
j
before:
after:
o
Reading your images here - from the diff it seems like you have removed the webhook, and have replaced it with the email flow - that is not a requirement - you can continue to work with the webhook
We’d even recommend that (vs email)
Reading up the thread- Re:
So if I understand correctly, in 14 days we won’t be able to skip the pending status or the email sent by Permit?
• You can skip the pending status by immediately approving the invite (though that’s not recommended) • You don’t have to use the email feature at all
j
the email states:
If you’re using this feature, please review your implementation and ensure your webhook handler is ready to support this new flow.
we go to the doc: https://docs.permit.io/embeddable-uis/webhooks/ the doc:
there is a lot of confusion in our end.
o
Happy to answer any questions and clarify, as well as learn and improve ourselves and our docs. Thank you for your patience. Note the docs, don’t say anything about having to use the email feature
j
so to test the behavior, we check “email notification” on our end as well. and we get a totally different behaviour
o
What behavior are you getting ? And what behavior did you expect ?
j
is says there it will behave like Email Notification
o
Soon (After the 14 days) - it will behave like the email feature, meaning the user will only be created after approval
o
I think what he meant, is that if you wan to test the approval flow of user creation today you can try the email flow instead of the webhook flow
👍 1
j
we just want to validate now if the webhook will work with the new behaviour of the webhook.
so we were told we need to test it with “email notification” but we end up with a totally different behaviour and we are not really testing the webhook.
when we got the email. it was basically saying our website might not work properly anymore in two weeks. so i need to test it before to see if we need something to fix. but it is not clear to us on how to test it.
o
You can add the approve call now, it will have no effect; And when the new webhook-flow is enabled it will take effect. For testing using the approve function with an effect now, you can use the email flow. In the end of the day it’s the same logic- 1. User is invited and pending 2. User accepts invite - and approve it 3. User is created
The change is that users are not created automatically with an invite, they are created after approval. You could also mock the interaction if you need more testing on your side
I understand there’s been some confusion here, but the bottomline change is very limited in scope
j
do you have any sequence diagram that explains the flow? here’s this one as reference:
Copy code
sequenceDiagram
    title: Permit Current Invitation Behaviour
    
    App ->> Permit: Invite user

    Permit ->> Permit: Create permit user    

    Permit ->> App: Webhook: "create_user"

    App ->> User: Send user invitation
r
I can see some issues with skipping the approval One I can see is when a user sends an invitation and sees the pending invites in the interface. This will cause confusion on our customers, since there will be a delay between the time the user sends an invite and when the webhook is triggered to approve him
o
Here you go, I tried to be very detailed
Copy code
sequenceDiagram
    title: Permit New Webhook Invitation Behaviour
    
    App ->> Permit: Invite user

    Permit ->> Permit: Create Invite 

    Permit ->> App: Webhook: User invite was created

    App ->> User: Send user invitation

    User ->> App: Authenticates, Accepts invite

    App ->> Permit: Approve Invite
    Permit ->> Permit: Create User
j
So Permit will not send any email to the user?
o
there will be a delay between the time the user sends an invite and when the webhook is triggered to approve him
1. The webhook delay should be very small. 2. There is more delay until the invite is actually accepted - but this is how invites work in most applications
> So Permit will not send any email to the user? Not unless you toggle the email feature on And configure an email server for it
@Robin Simard Also you don’t have to wait for the webhook to approve the invite- you can do it immediately after creating it
j
Webhook: User invite was created
what is the “type” we receive?
it is
Copy code
"invite_user"
?
o
I’m sorry, can you explain the question - I”m not sure what you’re asking Type of what?
j
webhook communicates with payloads
o
Yes “invite_user”
j
thanks for the clarifications. i’ll analyse your schema with my colleague tomorrow.
o
Happy to try and help 🙂 Thank you for your patience
j
We won’t have to call “accept” of the python SDK if I understand well.
(the non-existing one)
o
Once it’s added you can call it to approve the invite. You can also call the API directly, whichever you prefer
j
a checkbox somewhere “test new invitation behaviour” would have been great.
if we are webhook only, how are we getting access to the accept token then?
no token from the weekhook
o
You don’t have a token (that’s just in email) , instead you have your webhook secret so you know it’s trustworthy
👍 1
j
we weren’t sure if each element invitations had to be accepted separately using the token
o
In email yes. The token is used to couple between a user (once logged in to the element) and its invite Different purpose than in the webhook In both flows you need to accept each invite.
j
then make sure the “accept” sdk update is ready soon. that would be really appreciated.
âś… 1
you said we need to approve the user calling the
approve
api.
user_invite_id
seems to be required when calling
approve
. The webhook does not provide it. https://api.permit.io/scalar#tag/user-invites/post/v2/facts/%7Bproj_id%7D/%7Benv_id%7D/user_invites/%7Buser_invite_id%7D/approve
o
It will be available in the webhook, once the change is applied
j
i did not find this information in the doc
s
Hi @Jules Robichaud-Gagnon We added this to the system (invite_id in webhook) and also the approve for Python SDK. It will be released for production tomorrow. We will update you on that.
I worked on it quickly today, I’m testing it and will publish it as soon as possible.
👍 1
Hi @Jules Robichaud-Gagnon Great news – we’ve just released a fix for you! 🎉 What’s new: • The Permit Python SDK now supports approving user invites • We’ve added
user_invite_id
to the invite user webhook • Updated documentation is available at: https://docs.permit.io/embeddable-uis/webhooks Important: Please make sure you’re running the latest version (2.8.1) to access these features. (Permit Python) Coming soon: We’ll be adding more user invite functions to the SDK. In the meantime, you can access all user invite functionality through our API: https://api.permit.io/scalar#tag/user-invites Here is an example of usage
Copy code
import asyncio
from permit import ElementsUserInviteApprove
from permit import Permit
permit = Permit(
    token="permit_key_*************_________",
)

async def main():
        approve_data = ElementsUserInviteApprove(
            email="<mailto:user@gmail.com|user@gmail.com>",
            key="<mailto:user@gmail.com|user@gmail.com>",
            attributes={}
        )
        approved_invite = await permit.api.user_invites.approve(
            user_invite_id="*******user_invite_id*****",
            approve_data=approve_data
        )
        print("Success:", approved_invite)

       
asyncio.run(main())
j
Thanks, we will test this very soon. I am glad you started to use mermaid diagrams. You need to update your documentation (https://docs.permit.io/embeddable-uis/email-configuration-and-templates/#2-approving-the-invited-user-using-an-sdk), “approve” was added to a different module.
users
-->
user_invites
This:
Copy code
await permit.api.users.approve(
    user_key="new_user",
    email="<mailto:new-user@example.com|new-user@example.com>",
    invite_code="ed32bc43e2194a80a5ef5e0339943b44"
)
should be:
Copy code
await permit.api.user_invites.approve(
    user_key="new_user",
    email="<mailto:new-user@example.com|new-user@example.com>",
    invite_code="ed32bc43e2194a80a5ef5e0339943b44"
)
The code: https://github.com/permitio/permit-python/blob/main/permit/api/user_invites.py
s
Thank youđź’Ş, we will also update the documents in the link you sent soon.
👍 1
j
https://github.com/permitio/permit-python/pull/119 user_invites was not added to the SyncClient. I created a PR to fix this.
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
j
no
e
Hi @Jules Robichaud-Gagnon I’ll let @Shuvy Ankor know about it, though he’ll probably only see it next week
s
Hi, @Jules Robichaud-Gagnon thank you very much! We will look into this as soon as possible.
👍 1
j
we have two environments why in one element of one of our environment we see the pending invitations? We do not have the “Email notification” checked.
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
e
Hi @Jules Robichaud-Gagnon, I’ll pass this on to @Shuvy Ankor. He’ll likely only be able to take a look next week
j
we found the problem. seems like a bug with permit dashboard. To reproduce the problem: 1. On our element we assigned an “Approval Component” and Saved 2. We delete the Approval Component from the Element page 3. We open the Element again and the “approvals” are still there
so basically we have 2 identical elements, one had an Approval Component in the past. This one will forever show the pending approvals.
o
Thanks for the report - will make sure @Shuvy Ankor and he’s team address this
j
This problem allowed us to fully test the process in advance to keep the old behaviour. We noticed a problem regarding Element. We were told we could accept the invitation right away in the webhook but it causes a UX problem. The user using Element sees the user as a pending pending unless he refreshes the page. I made a diagram to show the process.
(i know, i know, @Shuvy Ankor will check that next week)
s
Thanks for the detailed report! I’ll review everything early next week and follow up with you. If you spot any other issues in the meantime, just let us know.
j
In short. I won’t work on this more until: • new version of the sdk with my PR included is released • element has a fix (if you plan to implement one) For the unexpected approval process when we had none setup: • as a workaround we created a new Element and we deployed it. (we will make sure not to play with approval components with this one). You might have a problem to fix on your side through.
have a great weekend!
s
Thank you for your contribution to the Python SDK. I have included it. Thanks for that! (2.8.2)🚀 In addition, we have updated our documentation to clarify how to use it. Our team is working on resolving all the issues here, seeing the recent setbacks we’re zooming out and want to make sure we get this right once and for all. We are postponing any deadlines here until further notice, and we are aiming to have issues here resolved by the of this week, or early next
👍 1
j
I was told I might have something to test. What do I have to test?
o
Hi Jules, @Shuvy Ankor is off for a local holiday he'll be back Thursday. Meanwhile the new Python SDK has been released to the best of my knowledge .
j
o
I believe the issue was resolved, but if you want more details or confirmation you'd need to wait for Thursday
j
Ok, I will wait for the confirmation then. I do not want to test if nothing was fixed. It takes time to be able to test this.
s
Hi @Jules Robichaud-Gagnon I have several exciting updates to share with you: 1. Released Today: - The fix you requested has been implemented and the contribution you provided was integrated into the previous Python SDK version - Full support for all invite_user functions (list, get, delete) (available from version 2.8.3) 2. Coming This Week: - UI improvements including automatic element refresh after user invitations - Backward compatibility mode with option to hide waiting user lists - Backend performance enhancements for a smoother experience 3. Next Steps: - Auto-deletion of user management component when Access Request component is removed - Node SDK support for all invite user functions Timeline: Everything except the last two items (node sdk+ Auto-delete Access Request ) will be released by mid-next week. --- We’re always looking to improve! Is there any other feature you’d like to see? Your feedback has been invaluable in making our elements better. Thanks for being such an engaged user, and have a wonderful weekend!
j
@Shuvy Ankor, let me know if what under “Coming This Week” are deployed.
s
Hi, @Jules Robichaud-Gagnon The automatic refresh feature is now live in production! Please give it a try and let us know what you think. More updates are on the way this week.
j
only “UI improvements including automatic element refresh after user invitations” or all three? - UI improvements including automatic element refresh after user invitations - Backward compatibility mode with option to hide waiting user lists - Backend performance enhancements for a smoother experience
s
Everything is now live except for the backward compatibility mode - that should be published tomorrow. It will let you hide the pending users list in your user management element.
j
is that a permanent feature? because in our use case we would use it
s
What exactly is the question about?
j
is it a temporary patch for backward compatiblity to help people for the transition that will be removed eventually?
o
It will remain, and won't be removed until further notice
👍 1
a
Hey @Jules Robichaud-Gagnon, - Backward compatibility mode with option to hide waiting user lists Is now live ln production 🙂
👍 1
j
We found 3 problems 1. There is a problem with the toggle in the dashboard, it appears as toggled on even if we toggled it off and saved. (the element will still consider it as toggled off correctly, it only appears wrong in the dashboard). to toggle it on again we need to go back in the dashboard, toggle off, toggle on then save again. (See Screenshot showing a “toggled off” after a save in the dashboard) 2. There is a delay of more than 10 seconds seconds before it updates in Element. With “Pending Users” toggled off, the user will wonder where the invitation went. This is not useable as is. 3. Also with
Pending Users
toggled off, the spot in Element where the “pending users” would appear there is a
0
instead of a blank space (See Screenshot with the pointing arrow). Probably a templating issue.
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
j
no
In React a zero appears. you must make sure it is a boolean.
t
Hey @Jules Robichaud-Gagnon thanks for the detailed list. I've notified @Alon Boshi and the team of the issues.
👍 1
a
Hey @Jules Robichaud-Gagnon, Thanks for flagging this up! We really appreciate any help in improving the system to make it easier for you to use. We'll share a fix for 1 and 3 soon. About 2, I will talk with the team about your concern but for now, the 10-second delay isn’t actually a delay — it’s the expected behavior of the system. Instead of requiring you to refresh the page to see updates, the component automatically refreshes itself every 10 seconds to display the latest changes.
Hey @Jules Robichaud-Gagnon, A fix for 1 and 3 is live in production 🙂 Thanks again for using this feature and flagging this up!
👍 1