Viewing and using webhook payloads from Shipstation

Hi.

I am having difficulty viewing the payload of a webhook.

I have a workflow succesfully set up that posts a Shopify order to Shipstation using a webhook to tigger it. The webhook triggers a GraphQL query which obtains the most recent order. That is then posted to Shipstation using a REST POST

I want to add a new workflow that lets Shopify know we have shipped the order. I can trigger a workflow again but its not as easy to identify the orders that need to be passed to Shopify to be marked as Shipped. I really need to use the payload of the webhook to match the orders correctly.

I need to construct a unique URL for the REST GET query using the storeID and batchId but I can't work out how to use the payloads or reference them.

This is the format of a Shipstation payload for a shipped order

{"resource_url":"https://ssapiX.shipstation.com/shipments?storeID=123456&batchId=12345678","resource_type":"SHIP_NOTIFY"}

I can view the test payload from startTrigger when pasted into the example JSON input field in the workflow log but not if I console.log it in an attached code block.

console.log(startTrigger) gives the following

[info]
{
[info]
error: "SyntaxError: Unexpected token ':'",
[info]
data: null,
[info]
metadata: null
[info]
}

but the workflow log does show the data

[Thu June 8th 2023 10:18:45.972 am] --- Successfully finished running query: startTrigger ---
[Thu June 8th 2023 10:18:45.972 am] --- Running query: code ---
[Thu June 8th 2023 10:18:45.972 am] Evaluating JS query: code
[Thu June 8th 2023 10:18:45.974 am] [log] {
data: {
resource_url: 'https://ssapiX.shipstation.com/shipments?storeID=123456&batchId=12345678',
resource_type: 'SHIP_NOTIFY'
},
metadata: null,
value: {
resource_url: 'https://ssapiX.shipstation.com/shipments?storeID=123456&batchId=12345678',
resource_type: 'SHIP_NOTIFY'
},
error: undefined
}
[Thu June 8th 2023 10:18:45.974 am] --- Successfully finished running query: code ---
[Thu June 8th 2023 10:18:45.974 am] --- Successfully finished running the workflow ---

Any ideas welcome?

Hey timk!

You should be able to access the payload of the webhook with startTrigger.data. Here, I've triggered a workflow via webhook with sample data similar to yours and forwarded it to another endpoint.

You can also use a JS block to parse that payload. Here's a simple example of logging that url

Let us know if you have any issues with that approach!

Thank you. That helped me work it all out :slight_smile:

1 Like