[SpecklePy] Sending an invite to add the user to the speckle stream

Is it possible to add users to the Speckle Stream through SpecklePy API? If so, how can it be done? I haven’t found any information in the documentation nor examples on the official SpecklePy repository.

stream.update_permission() could possibly work, but does it actually add the people to the stream or is it only for users that are already added to it.

Within the api.resources.stream is the invite method. This doesn’t add a user to the stream permissions until that user has accepted the invite and created account with the same email

invite( stream_id, email, user_id, role, message )

where stream_id {str} is the id of the stream to invite the user to

and you should use either:
email {str} as the email of the user to invite OR user_id {str} the id of the user to invite (only valid for users already active on the server)

role {str} is the role to assign to the user (defaults to stream:contributor)

and lastly message {str} which is the message to send along with this invite to the specified user

this method returns a bool if the invite sending was successful.

An invite_batch method is also available.

It has been previously requested that there could be a webhook event for when an invite has been accepted, I’ll check what the status/progress is on that.

Also a previous discussion for this for when you have control of the server:

In that thread, @Baris has a solution (with .NET) to register users directly. This is, again, not for the public speckle.xyz but where the server is self-hosted.


This is exactly what I am looking for, thank you!