Skip to main content
Solved

Include image data in event properties?

  • March 20, 2024
  • 2 replies
  • 67 views

Forum|alt.badge.img

Hello,

I am wondering if it is possible to include the raw data for an image (pdf or jpg) in an events’ properties when posting a Create Event to /api/events.

We have a customer confirmation email which needs to include a QR code for the post office to scan. I’d rather not have to create website links for the QR code images.

Any ideas?

Many thanks,

Mat

 

 

 

Best answer by Brian Turcotte

Hi @matcwhite!

At this time, it’s not possible to include images in the Create Event API call, but I will update the thread if anything changes.

 

Best,

Brian

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

2 replies

Brian Turcotte
Forum|alt.badge.img+37
  • Klaviyo Alum
  • 1393 replies
  • Answer
  • March 20, 2024

Hi @matcwhite!

At this time, it’s not possible to include images in the Create Event API call, but I will update the thread if anything changes.

 

Best,

Brian


Forum|alt.badge.img+5
  • Problem Solver I
  • 15 replies
  • November 26, 2024

Hi ​@matcwhite - I was hitting the same wall. You can do it, but you might not want to.

 

I was able to send the qr code base64 data 

{
    "attributes":{
        "properties":{
            "img":"data:image/png;base64,iVBOxxxxx"
...

as an event attribute. This allowed me to dynamically set an image to event.img and embed the content of the image directly in the email.

However, this ends up with potential compatibility issues. [1] 

 

In production I’m actually using the /api/images endpoint [2] with the import_from_url attribute.

The import_from_url allows you to set a base64 encoded string instead of a url. I’m capturing the new Klaviyo URL and Image ID in the response. The Klaviyo URL is a drop-in replacement for the above img event attribute.

(And I’m saving the Klaviyo Image IDs for future clean up.)