Skip to main content
Contributor I
March 20, 2024
Solved

Include image data in event properties?

  • March 20, 2024
  • 2 replies
  • 181 views

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

 

 

 

    This topic has been closed for replies.
    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

    2 replies

    Brian Turcotte
    Klaviyo Alum
    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

    jjensen_ksp
    Problem Solver I
    Problem Solver I
    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.)