While there are multiple uses for sending a webhook or HTTP Post with an array, the most common use (as it relates to Infusionsoft) is for creating an order via Parsey that has multiple line items inside of Infusionsoft.
If sending an HTTP Post with out an array from Infusionsoft to Parsey, Parsey will create an order in Infusionsoft that only contains a single product to represent the entire order.
From inside an Infusionsoft Campaign Sequence, navigate to the HTTP Post screen.
First paste your Parsey Webhook URL into the POST URL field. Always include the “contactId = ~Contact.Id~” as your first Name / Value pair.
How to Format Your HTTP Post
On the left hand side is the Name column. This is where the magic happens. In the Name column we are going to include the array, the item key and the item attribute.
Choose a word to represent your array. In our case, we’ll choose product.
The item key should begin with 0 and increment by 1 each time a new key is added.
In most instances, a single item key will have multiple attributes associated with it. In our case, these attributes are things like the name of the product, the price and the quantity.
If you have already made the determination on items, prices and quantities, you can hard code the Values on the right like this:
If contacts make the determination on items, prices and quantities so that those vary from one contact to another, use merge fields in the Values on the right like this:
End Result in Parsey
Both static and dynamic Values will look like this inside of Parsey:
Now Parsey can loop through the Products array and add each individual line item with all of its associated attributes to a single order.
When working with Dynamic posts where you’re using merge fields for the Values, make sure you always have enough Name / Value pairs to cover the highest number of potential line items. So if you could send up to 10 different line items, following the example above, you’d have 31 Name / Value pairs in your Infusionsoft HTTP Post. But what if some of the contact merge fields are empty?
Handling Empty Fields
If a contact can purchase 1 of 10 products, all 10 products or a combination of any number of the 10 products, you’ll want to make sure they are all included in your HTTP Post. Parsey will simply ignore any name value pairs that come through empty.
If the HTTP Post received from Infusionsoft contained information for product 2, 4 and 9, Parsey would be able to create an order with three individual items while including their names, prices and quantities, etc.