I am new to Onshape, can someone guide me on how to setup webhooks?

We are integrating Onshape and Propel using Jitterbit(its a middleware like mulesoft). Our requirement is when a document is changed, we want the drawing json data to be sent to API endpoint which is exposed by Jitterbit, then Jitterbit updates this data in Propel. It looks that a webhook can send data to an endpoint but its not clear on how to setup webhooks in ohshape.

Answers

  • Caden_Armstrong
    Caden_Armstrong Member Posts: 472 PRO
    Have you read the documentation for webhooks?
    https://onshape-public.github.io/docs/app-dev/webhook/

    First step is to register a webhook:
    https://cad.onshape.com/glassworks/explorer/#/Webhook/createWebhook


    www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
    Experts in Onshape Automation - Custom Features and Integrated Applications
  • Yatiraj_Chakre
    Yatiraj_Chakre Member Posts: 6 PRO
    Thanks Caden, I am able to create a webhook, but landed on another issue. I am sending "events","companyid","documentid" & "elementid" in creating webhook request but in response its not returning "documentid" so I am thinking its not properly registered.(even though it comes back as 200 and webhookid) I am using "onshape.comment.create" event and I am not getting comment added notifications. Wondering what I am missing.
    Create webhook Request -
    {
        "companyId": "dummyvalue",
        "description": "dummyvalue",
        "documentId": "dummyvalue",
        "elementId": "dummyvalue",
        "events": [
            "onshape.comment.create"
        ],
        "url": "dummyvalue"
    }
    Create webhook Response -
    {
        "filter": null,
        "data": null,
        "description": "dummyvalue",
        "options": {
            "collapseEvents": true
        },
        "url": "dummyvalue",
        "companyId": "dummyvalue",
        "createdBy": {
    user details
        },
        "projectId": null,
        "folderId": null,
        "events": [
            "onshape.comment.create"
        ],
        "isTransient": false,
        "externalSessionId": null,
        "droppedEventCount": 0,
        "name": null,
        "id": "dummyvalue",
    }
    Onshape validation call (does not show documentid)-
    {
    "jsonType" : "lifecycle",
    "event" : "webhook.register",
    "messageId" : "dummyvalue",
    "timestamp" : "dummyvalue",
    "webhookId" : "dummyvalue"
    }

  • Caden_Armstrong
    Caden_Armstrong Member Posts: 472 PRO
    Might be worth trying with workspaceId or versionId added.

    www.smartbenchsoftware.com --- Renaissance --- Kestrel -- SmartLink
    Experts in Onshape Automation - Custom Features and Integrated Applications
  • Yatiraj_Chakre
    Yatiraj_Chakre Member Posts: 6 PRO
    Yes, tried but same result. I am also sending a 200 satus when onshape tests the URL I gave. There doesnt seem a good way of checking if webhook is successfully registered or not, the documentation says that if you can ping to a webhook then it is registered but I dont get any notifications.
  • Urs_Egger_REACT
    Urs_Egger_REACT Member Posts: 133 PRO
    Isn't there an onshape/propel integration available already?

  • Yatiraj_Chakre
    Yatiraj_Chakre Member Posts: 6 PRO
    Zapier is there but we want to use Jitterbit which is our middleware for all integrations