Why doesn't Autodesk Forge 'workflowAttribute' appear in webhook updates for Model Derivative work?

186 Views Asked by At

According to Forge API Reference, there is a workflowAttribute available to 'set some custom workflow information'. Its part of the misc object in the Body Structure of the POST request used to submit a job.

I am using the following request:

    convertResponse = await axios({
      method: "post",
      url:
        "https://developer.api.autodesk.com/modelderivative/v2/designdata/job",
      headers: {
        "Content-Type": "application/json",
        Authorization: access_token
      },
      data: JSON.stringify({
        input: { urn: url_safe_encoded_urn },
        output: {
          destination: { region: "us" },
          formats: [
            {
              type: "svf",
              views: ["2d", "3d"],
              advanced: { generateMasterViews: true }
            }
          ]
        },
        misc: {
          workflow: "designgen-forge",
          workflowAttribute: { projectId }
        }
      })
    });

But when the webHook calls my callback function, I see nothing like hookAttribute available in the data:

{
  "version": "1.0",
  "resourceUrn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6c3VmZm9say1nZW5kZXNpZ25sb3ZlLWRldi10ZW1wLzkxZjhhNGZmLTM5NTYtNGM5Yi05NzkyLThiMWMxNDQyZGJkNyUyRnJldml0LTkxZjhhNGZmLTM5NTYtNGM5Yi05NzkyLThiMWMxNDQyZGJkNy5ydnQ",
  "hook": {
    "hookId": "6d770063-d5dc-4c66-8ed8-e84207ade07d",
    "tenant": "designgen-forge",
    "callbackUrl": "https://bigchief.ngrok.io/dev/workitemcomplete",
    "createdBy": "9DqOEPqAd4ZZYQ2MAxuT2VQwMfAJrBGp",
    "event": "extraction.updated",
    "createdDate": "2020-10-20T20:14:31.874+0000",
    "system": "derivative",
    "creatorType": "Application",
    "status": "active",
    "scope": {
      "workflow": "designgen-forge"
    },
    "urn": "urn:adsk.webhooks:events.hook:6d770063-d5dc-4c66-8ed8-e84207ade07d",
    "__self__": "/systems/derivative/events/extraction.updated/hooks/6d770063-d5dc-4c66-8ed8-e84207ade07d"
  },
  "payload": {
    "TimeStamp": 1603289180515,
    "Env": "production",
    "URN": "<my urn>",
    "EventType": "UPDATED",
    "Payload": {
      "status": "inprogress",
      "bubble": {
        "guid": "<my guid>",
        "owner": "<my guid>",
        "hasThumbnail": "true",
        "startedAt": "Wed Oct 21 14:05:39 UTC 2020",
        "type": "design",
        "urn": "<my urn>",
        "success": "75%",
        "progress": "50% complete",
        "region": "US",
        "status": "inprogress",
        "children": []
      },
      "scope": "fd2d74bb-1d5a-407c-a344-20dffa327504",
      "registerKey": []
    }
  }
}

I would imagine that is the intent of the workflowAttribute object to populate something in the callback data, otherwise, whats the point. Am I not specifying it correctly? Or is this not implemented? If not, webhooks become nearly unusable, I suppose the alternative is to make and destroy a webhook for each request, which is so ugly its not really a solution.

1

There are 1 best solutions below

0
On

Thank you for bringing this to our attention. We could reproduce the issue as well - i.e. that the content of the workflowAttribute provided in the body of POST job request will not show up in the webhook callback.

It's being looked into, and I hope it will work soon, but I cannot yet provide a deadline for that.

In the meantime, the workaround could be either:
a) keep track of the extra data (in your case projectId) associated with the urn of the given file on the server or in a database (you might already be using one)
b) create separate webhooks, as you suggested, with different id for the "scope" -> "workflow" parameter and provide the data as the "hookAttribute" - that will show up in the callback

Update on 2020-12-14: it's working now - see https://forge.autodesk.com/blog/custom-data-translation-webhook