Skip to main content
Solved

Is collab.id the same as user.id?

  • June 22, 2023
  • 1 reply
  • 176 views

  • New Participant
  • 4 replies

Hi Rui,


Thank you very much for your answer. This is exactly what I was looking for.


Now I think the way to achieve my goal is to create a webhook with ‘COLLABORATION.ACCEPTED’ trigger, that way I can assign the approval task to the user. So I need the user id to assign the task.

But is ‘collab.id’ the user id? The API documentation doesn’t say so but I note that you wrote ‘Collaborator:’.


Cheers

Best answer by rbarbosa Box

Hi @Ooshot ,


To your question, the collaboration id is not the user id.


Within the collaboration object, which essentially links a file or folder to a user, there is a section called accessible_by. This represents the user “collaborated”.


So in the previous example if we add this line before deleting the collaboration:


print(

        f"Collaboration User: {collab.accessible_by.id} {collab.accessible_by.type} {collab.accessible_by.name} {collab.accessible_by.login}"

    )


You get the user object that was collaborated:

Collaboration User: 18685785980 user barbasr@gmail.com barbasr@gmail.com


You can also list the existing collaborations by file or folder. In the previous example:


# get the folder collaborators

    collaborators = folder.get_collaborations()

    print(f"Folder {folder.name} ({folder.id}) collaborators:")

    for collaborator in collaborators:

        print(

            f"\tCollaborator: {collaborator.id} {collaborator.status} role: {collaborator.role} invite: {collaborator.invite_email})"

        )


With the COLLABORATION.ACCEPTED webhook, you get the collaboration.id, from there you get the user, for which you can create a task.


Note that my example was collaborating a folder, and tasks are only applicable to files.


Here is some documentation examples specific for the Python SDK:



Cheers

View original
Did this topic help you find an answer to your question?

1 reply

rbarbosa Box
  • Developer Advocate
  • 553 replies
  • Answer
  • June 22, 2023

Hi @Ooshot ,


To your question, the collaboration id is not the user id.


Within the collaboration object, which essentially links a file or folder to a user, there is a section called accessible_by. This represents the user “collaborated”.


So in the previous example if we add this line before deleting the collaboration:


print(

        f"Collaboration User: {collab.accessible_by.id} {collab.accessible_by.type} {collab.accessible_by.name} {collab.accessible_by.login}"

    )


You get the user object that was collaborated:

Collaboration User: 18685785980 user barbasr@gmail.com barbasr@gmail.com


You can also list the existing collaborations by file or folder. In the previous example:


# get the folder collaborators

    collaborators = folder.get_collaborations()

    print(f"Folder {folder.name} ({folder.id}) collaborators:")

    for collaborator in collaborators:

        print(

            f"\tCollaborator: {collaborator.id} {collaborator.status} role: {collaborator.role} invite: {collaborator.invite_email})"

        )


With the COLLABORATION.ACCEPTED webhook, you get the collaboration.id, from there you get the user, for which you can create a task.


Note that my example was collaborating a folder, and tasks are only applicable to files.


Here is some documentation examples specific for the Python SDK:



Cheers


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings