Skip to main content
Solved

Integrations from separate systems


Forum|alt.badge.img+1

Hi there

I’m trying to design an integration from both Magento and Netsuite as the business will have most orders coming through Magento but then a select few orders created directly in Netsuite.

There may be times where certain items do not exist in Magento which will need to be synced from Netsuite and subsequently referenced for Events (Placed Order and Ordered Product).

I’m trying to reference the examples in the Build Custom Platforms documentation but I’m not entirely sure if I’m able to directly reference profiles and items that are already existing in Klaviyo or whether each event is referencing stand-alone profiles/items purely just in the event for data purposes. 

{
	"data": {
		"type": "event",
		"attributes": {
			"profile": {
				"$email": "john.smith@test.com",
				"$first_name": "John",
				"$last_name": "Smith",
				"$phone_number": "5551234567",
				"$address1": "123 Abc st",
				"$address2": "Suite 1",
				"$city": "Boston",
				"$zip": "02110",
				"$region": "MA",
				"$country": "USA"
			},
			"metric": {
				"name": "Placed Order"
			},
			"properties": {
				"OrderId": "1234567890",
				"Categories": ["Fiction", "Classics", "Children"],
				"ItemNames": ["Winnie the Pooh", "A Tale of Two Cities"],
				"Brands": ["Kids Books", "Harcourt Classics"],
				"DiscountCode": "Free Shipping",
				"DiscountValue": 5,
				"Items": [{
						"ProductID": "1111",
						"SKU": "WINNIEPOOH",
						"ProductName": "Winnie the Pooh",
						"Quantity": 1,
						"ItemPrice": 9.99,
						"RowTotal": 9.99,
						"ProductURL": "http://www.example.com/path/to/product",
						"ImageURL": "http://www.example.com/path/to/product/image.png",
						"Categories": ["Fiction", "Children"],
						"Brand": "Kids Books"
					},
					{
						"ProductID": "1112",
						"SKU": "TALEOFTWO",
						"ProductName": "A Tale of Two Cities",
						"Quantity": 1,
						"ItemPrice": 19.99,
						"RowTotal": 19.99,
						"ProductURL": "http://www.example.com/path/to/product2",
						"ImageURL": "http://www.example.com/path/to/product/image2.png",
						"Categories": ["Fiction", "Classics"],
						"Brand": "Harcourt Classics"
					}
				],
				"BillingAddress": {
					"FirstName": "John",
					"LastName": "Smith",
					"Company": "",
					"Address1": "123 abc street",
					"Address2": "apt 1",
					"City": "Boston",
					"Region": "Massachusetts",
					"RegionCode": "MA",
					"Country": "United States",
					"CountryCode": "US",
					"Zip": "02110",
					"Phone": "5551234567"
				},
				"ShippingAddress": {
					"FirstName": "John",
					"LastName": "Smith",
					"Company": "",
					"Address1": "123 abc street",
					"Address2": "apt 1",
					"City": "Boston",
					"Region": "Massachusetts",
					"RegionCode": "MA",
					"Country": "United States",
					"CountryCode": "US",
					"Zip": "02110",
					"Phone": "5551234567"
				}
			},
	    "time": "2022-12-05T15:00:00Z",
        "value": 9.99,
        "unique_id": "1234567890"
		}
	}
}

In the above example, I don’t see where the profile’s Klaviyo ID or External ID can be referenced.  And while the items array does have a reference to ProductID, I’m not confident that that is an actual reference to a Klaviyo Catalog Item.

The Create Event API Documentation seems to be a bit different where it does have the profile references but no examples for Catalog Items.

Is anyone able to provide some clarity on the above and how I would go about referencing items/profiles? Perhaps by just slotting it into the example above.

 

Thanks in advance!

 

Best answer by Brian Turcotte

Hi @Patrick Lee!

To answer you first question, I’m assuming you’re talking about the profiles you retrieve by making a call to the Get Profiles endpoint (correct me if I’m wrong).

 

If that’s the case, it sounds like you’re only seeing the first page of profiles that is returned by this endpoint, which, if you check the documentation, is capped at 20 by default:

 

 

You can increase this to 100 per page, but if you want to get all profiles in your account, you will have to paginate through the response using the page[cursor] field. More on this here:

 

Regarding your second point about Catalogs, as of now, our APIs only support the retrieval of Catalogs that were added via API - so in other words, retrieving catalogs that were created in your e-commerce platform (Magento in your case) with the Catalogs API, is not yet supported. We are hoping to add support for this in the future.

 

I hope this helps to clarify, and thanks for using the Community!

- Brian

View original
Did this topic or the replies in the thread help you find an answer to your question?

6 replies

Brian Turcotte
Forum|alt.badge.img+37

Hi @Patrick Lee!

I’m going to check on this with Engineering for you and I’ll get back to you as soon as possible!
 

Best,

Brian


Forum|alt.badge.img+1
  • Author
  • Contributor I
  • 3 replies
  • July 25, 2023
Brian Turcotte wrote:

Hi @Patrick Lee!

I’m going to check on this with Engineering for you and I’ll get back to you as soon as possible!
 

Best,

Brian

Wonderful thanks!  Look forward to the response


Forum|alt.badge.img+1
  • Author
  • Contributor I
  • 3 replies
  • August 1, 2023

Hi @Brian Turcotte 

 

Has there been any feedback from Engineering about whether this can work?  I can try to test myself but it’d be nice to know upfront whether it is possible or not.

 

Thanks

 

Patrick


Brian Turcotte
Forum|alt.badge.img+37

Hi @Patrick Lee!

My apologies for the delay here!
 

To pass a server-side event like the one you provided, a profile identifier (email) is required. If a profile for the email provided in the event doesn’t exist, then a new profile will be created for the email. If a profile does exist for that email, the event will be attributed to that profile.

 

So yes, you are able to use the email address field to directly reference a profile in Klaviyo. But if that profile doesn’t exists, a new profile will be created using that email, and the event will be associated with that profile.

 

However, the item data can be a little more arbitrary. The items referenced in the properties field technically don’t need to be referencing an item in a Klaviyo catalog. However, it’s recommended that the products do exist in a catalog, because you can then reference their Product IDs in catalog lookups in email templates later. You can use the item information you include in the event to populate email templates as well.

 

To answer your second question, you can use email, Klaviyo ID, or external ID to identify a profile, which is why the Create Event API Documentation contains that field (which is not a required field). And just to be extra clear - yes, the Product ID is the field that identifies a catalog item.

 

In short, the example payloads that you see in our Build Custom Platforms documentation are what we recommend for these events. You’re welcome to add or remove information as you see fit, but most of our customers simply replace our sample data with the actual event data.

 

I hope this helps, and thanks for using the Community!

- Brian


Forum|alt.badge.img+1
  • Author
  • Contributor I
  • 3 replies
  • August 4, 2023

Hi @Brian Turcotte 

 

Thanks so much for your reply. 

We have been testing in the meantime and it seems we are unable to access data that comes from Magento.

We can see some profiles… specifically 20 out of 2229 which seem to all have been created on the same date in 2021 but then everything else is missing.  I’m not entirely sure if these were created straight into Klaviyo and then synced with Magento and maybe that’s why we can see these profiles?

We also have a list of catalog items that have been brought in from Magento but when we try and run the Get Catalog Items API via postman, we can’t see any of them (screenshot below)

 

All of our permissions are correct for our private API key as we have full access to items but anything that is from Magento doesn’t seem to be able to be returned.  We get the same result for Catalog Categories as well.  None are returned.

Then when we create a Catalog Item and Category via the API and proceed to run the “Get Catalog Items” or “Get Catalog Categories” API, we can see the item/category created… but we still can’t see the ones from Magento.

Would you happen to know why this is? Is this expected behaviour?

Thanks again!

Patrick

 


Brian Turcotte
Forum|alt.badge.img+37
  • Klaviyo Alum
  • 1393 replies
  • Answer
  • August 10, 2023

Hi @Patrick Lee!

To answer you first question, I’m assuming you’re talking about the profiles you retrieve by making a call to the Get Profiles endpoint (correct me if I’m wrong).

 

If that’s the case, it sounds like you’re only seeing the first page of profiles that is returned by this endpoint, which, if you check the documentation, is capped at 20 by default:

 

 

You can increase this to 100 per page, but if you want to get all profiles in your account, you will have to paginate through the response using the page[cursor] field. More on this here:

 

Regarding your second point about Catalogs, as of now, our APIs only support the retrieval of Catalogs that were added via API - so in other words, retrieving catalogs that were created in your e-commerce platform (Magento in your case) with the Catalogs API, is not yet supported. We are hoping to add support for this in the future.

 

I hope this helps to clarify, and thanks for using the Community!

- Brian