Welcome to the new Box Support website. Check out all the details here on what’s changed.

Webhook v2 - Triggers with conditions

Answered
New post

Comments

3 comments

  • Jason

    Hi , great question!

     

    Box's API does not support additional conditions for event triggers unfortunately. However, I would like to understand the use case a little bit more. How would you use that additional functionality, and would you be able to give a bit of context around what you're trying to do at a higher level?

     

    Thanks,

    Jason

    0
    Comment actions Permalink
  • spirosorf

    Hi Jason and thank you for the reply.

    The idea is that a user uploads / organizes many raw files on a box com folder  and when his uploading is done, we want to process these files. Currently the user notifies the successful transfer of his set of raw files by uploading a specific file with metadata related to these files (let's call it "myfiles.xml").

    Currently we are polling the server for the existence of this file "myfiles.xml" in order to begin the processing.

    This results in to thousands of unnecessary calls between our server and box com.

     

    Therefore the idea was to use webhooks to minimize the calls.

     

    But if your webhooks API doesn't support conditional trigger then we will still have many unnecessary calls from your server to our URL - for each of the raw file upload. We want to awake the webhook only for the upload of files with the filename "myfiles.xml"

     

    Do you have any suggestion / workaround for that?

     

    many thank in advance

    Spiros

     

    0
    Comment actions Permalink
  • Jason

    Hi ,

     

    Thanks for your reply. That's an interesting problem to unwrap! 

     

    At a high level, the best way to approach this problem in general may be with a separate notification service. That's not always feasible (I understand!) so one idea that I have which uses Box but is slightly outside of your workflow is the tasks object:

    https://developer.box.com/reference#task-object-1

     

    Rather than have the user upload the file upon completion, you could have the user upload the file first, have your program assign a task to it, and then listen for when that specific task is completed. In this example, rather than upload the "myfiles.xml" doc as a signal of completion, the user could complete the task. That doesn't have to be manual either - depending on how much of this flow is handled by your app, you could probably abstract much of this away from the user so that they may not even be aware of the fact that they're using the task object in the background of your app.

     

    On the other hand, if you want to stick with your exact flow, the best workaround I can think of is to create a separate folder and put a webhook on that folder and only use it for the "myfiles.xml" document.

     

    For example, let there be an upload attempt folder with two subfolders:
    Jason's Upload Attempt ID XYZ
    XYZ-Done

    XYZ-Content

     

    Content would be uploaded into the "content" folder, and the user would upload the "myfiles.xml" only to the "XYZ-Done" folder. You could also apply Box metadata to the XYZ-Done folder so you could rely on something more specific than just the folder name, to associate the folder with an upload attempt.

     

    Apologies that there isn't a direct solution via the API to what you're looking for. Hopefully this gives you an idea to work with!

     

    Thanks,

    Jason

    0
    Comment actions Permalink

Please sign in to leave a comment.