Skip to main content
Contributor I
November 23, 2024
Solved

Transactional emails via API

  • November 23, 2024
  • 2 replies
  • 216 views

We need to send transactional (!) emails via API.
The reason behind the transactional emails are information about coupon codes and rules about misuse of coupon codes.
The template itself is saved on Klaviyo.
We only need to put in e-mail, first-name and some metadata.
The profiles that will get these emails are our customers already and have an active profile.

How does it work?

This topic has been closed for replies.
Best answer by ArpitBanjara

Hey ​@fxi 

Do you know how to utilize Send Email API endpoint? This allows you to send pre-designed templates stored in Klaviyo to specific recipients with dynamic data (like email, first name, and metadata)

so basically endpoint url should be - https://a.klaviyo.com/api/v1/email-template/[TEMPLATE_ID]/send

Method: Post 

and the payload should be something like this

{
"to": "customer_email@example.com",
"context": {
"first_name": "John",
"coupon_code": "SAVE20",
"rule_description": "This coupon is valid for one-time use only and cannot be combined with other offers."
}
}

I hope this helps and thank you for sharing your question here in the community.

Cheers

Arpit

2 replies

ArpitBanjara
Principal User II
Principal User II
November 25, 2024

Hey ​@fxi 

Do you know how to utilize Send Email API endpoint? This allows you to send pre-designed templates stored in Klaviyo to specific recipients with dynamic data (like email, first name, and metadata)

so basically endpoint url should be - https://a.klaviyo.com/api/v1/email-template/[TEMPLATE_ID]/send

Method: Post 

and the payload should be something like this

{
"to": "customer_email@example.com",
"context": {
"first_name": "John",
"coupon_code": "SAVE20",
"rule_description": "This coupon is valid for one-time use only and cannot be combined with other offers."
}
}

I hope this helps and thank you for sharing your question here in the community.

Cheers

Arpit

Arpit Banjara - Lead Email Marketing Specialist at Flowium
Contributor I
November 27, 2024

Hey ​@fxi 

Do you know how to utilize Send Email API endpoint? This allows you to send pre-designed templates stored in Klaviyo to specific recipients with dynamic data (like email, first name, and metadata)

so basically endpoint url should be - https://a.klaviyo.com/api/v1/email-template/[TEMPLATE_ID]/send

Method: Post 

and the payload should be something like this

{
"to": "customer_email@example.com",
"context": {
"first_name": "John",
"coupon_code": "SAVE20",
"rule_description": "This coupon is valid for one-time use only and cannot be combined with other offers."
}
}

I hope this helps and thank you for sharing your question here in the community.

Cheers

Arpit

Hey,

isn’t the `send` endpoint heavily restricted?

Furthermore, it gives me: 

 

{

    "status": 403,

    "message": "You must specify an API key to make requests."

}

Even though I authenticated myself in the headers with `Authorization` and my Klaviyo-API-Key!