import Shoply from "@shoplygg/node";
const shoply = new Shoply({ apiKey: process.env.SHOPLY_API_KEY });
const result = await shoply.emailTemplates.revert("KIND");<?php
require 'vendor/autoload.php';
$shoply = new Shoply\Client(['apiKey' => getenv('SHOPLY_API_KEY')]);
$result = $shoply->emailTemplates->revert('KIND');
import shoply
client = shoply.Client() # reads SHOPLY_API_KEY
result = client.emailTemplates.revert("KIND")
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/revert \
--header 'Authorization: Bearer <token>'package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/revert"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/revert")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/revert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": {
"kind": "receipt",
"group": "Orders",
"name": "Order Receipt",
"when": "When an order is paid, and when you send it again",
"marketing": false,
"required": [
"parts.delivery",
"parts.summary"
],
"variables": [
{
"name": "store.name",
"about": "Your store's name"
},
{
"name": "store.url",
"about": "Your store's address"
}
],
"parts": [
{
"name": "parts.delivery",
"about": "What was bought: keys, downloads and instructions"
},
{
"name": "parts.getting_started",
"about": "Your instructions for every order, from Settings"
}
],
"original": "<table class=\"card\" role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td class=\"card-body\" bgcolor=\"#ffffff\">\n <div class=\"logo\">{{ parts.logo }}</div>\n <div class=\"title\">Your order is delivered</div>\n <div class=\"lead muted\">{{ order.paid_at }}</div>\n {{ parts.delivery }}\n {{ parts.getting_started }}\n {{ parts.buttons }}\n …",
"originalSubject": "Your Northwind Keys order is delivered (a2855h0p1y4-71329ed4d95-1000427)",
"originalSubjectSource": "Your {{ store.name }} order is delivered ({{ order.id }})",
"html": null,
"css": null,
"subject": null,
"updatedAt": null,
"shared": null,
"baseCss": "/*\n * Shoply's look for the parts of an email a template is made of: what each original's\n * classes mean. Under the store's shared CSS and each email's own, which change any of it.\n * EmailTemplates::baseCss() puts the shop's link colour where #6a3ce2 is. The values are\n * EmailLayout's, so that an original looks as its builder's message does.\n */\n.card-body { background-color: #ffffff; border: 1…"
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Revert an email template
Puts the email back as Shoply wrote it: its HTML, CSS and subject. Answers it as Get an email template does.
Needs the emails.write permission (Change Email Templates).
import Shoply from "@shoplygg/node";
const shoply = new Shoply({ apiKey: process.env.SHOPLY_API_KEY });
const result = await shoply.emailTemplates.revert("KIND");<?php
require 'vendor/autoload.php';
$shoply = new Shoply\Client(['apiKey' => getenv('SHOPLY_API_KEY')]);
$result = $shoply->emailTemplates->revert('KIND');
import shoply
client = shoply.Client() # reads SHOPLY_API_KEY
result = client.emailTemplates.revert("KIND")
curl --request POST \
--url https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/revert \
--header 'Authorization: Bearer <token>'package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/revert"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/revert")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.shoply.gg/v1/stores/{storeId}/email-templates/{kind}/revert")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": null,
"code": null,
"data": {
"kind": "receipt",
"group": "Orders",
"name": "Order Receipt",
"when": "When an order is paid, and when you send it again",
"marketing": false,
"required": [
"parts.delivery",
"parts.summary"
],
"variables": [
{
"name": "store.name",
"about": "Your store's name"
},
{
"name": "store.url",
"about": "Your store's address"
}
],
"parts": [
{
"name": "parts.delivery",
"about": "What was bought: keys, downloads and instructions"
},
{
"name": "parts.getting_started",
"about": "Your instructions for every order, from Settings"
}
],
"original": "<table class=\"card\" role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tr>\n <td class=\"card-body\" bgcolor=\"#ffffff\">\n <div class=\"logo\">{{ parts.logo }}</div>\n <div class=\"title\">Your order is delivered</div>\n <div class=\"lead muted\">{{ order.paid_at }}</div>\n {{ parts.delivery }}\n {{ parts.getting_started }}\n {{ parts.buttons }}\n …",
"originalSubject": "Your Northwind Keys order is delivered (a2855h0p1y4-71329ed4d95-1000427)",
"originalSubjectSource": "Your {{ store.name }} order is delivered ({{ order.id }})",
"html": null,
"css": null,
"subject": null,
"updatedAt": null,
"shared": null,
"baseCss": "/*\n * Shoply's look for the parts of an email a template is made of: what each original's\n * classes mean. Under the store's shared CSS and each email's own, which change any of it.\n * EmailTemplates::baseCss() puts the shop's link colour where #6a3ce2 is. The values are\n * EmailLayout's, so that an original looks as its builder's message does.\n */\n.card-body { background-color: #ffffff; border: 1…"
}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}{
"success": false,
"message": "<string>",
"code": "<string>",
"data": null,
"errors": {}
}Authorizations
A secret API key, made under Developers in the dashboard: Authorization: Bearer shoply_sk_...
Headers
A word of your own for this one change, up to 180 letters, digits, dots, dashes, underscores and colons. Sent again with the same key, the request is not carried out twice: the first answer comes back, with Idempotent-Replay: true.
Path Parameters
The store's ID. A key reaches the store it was made in: GET /key answers which.
Which email: receipt, invoice, reward, panel-code, balance-code, site-code, ticket-reply, sub-renewal, sub-charged, sub-due, sub-declined, sub-paused, sub-ended, recovery-first, recovery-declined, recovery-second, winback-first, winback-second.

