This API allows customers with a custom e-commerce integration plugin to send product update notifications by signing the request payload with HMAC authentication.
Endpoint
POST https://api.hello-lisa.com/v2/plugin-notifications/{id}/updates
Headers
Header
Description
X-Hmac-Signature
HMAC-SHA256 signature of the request body
Authorization
API key for authentication
ApiKey <API_KEY>
Content-Type
application/json
Parameters
The id parameter value can be obtained form the plugins page in the LiSA Console.
Parameter
Description
id
The distinct identifier of the e-commerce plugin integration.
Payload Requirements
JSON format
Maximum size: 192 KB
Must be signed using HMAC-SHA256 with the secret provided upon registration.
How to Sign the Request
Use the HMAC-SHA256 algorithm to sign the JSON payload with the provided secret key. The resulting hex-encoded digest should be sent in the X-Hmac-Signature header.
use hmac::{Hmac, Mac};
use reqwest::blocking::Client;
use serde_json::json;
use sha2::Sha256;
fn main() {
let api_key = "your-api-key";
let secret = "your-secret-key";
let url = "https://api.hello-lisa.com/v2/plugin-notifications/{id}/updates";
let payload = json!({
"productId": "123",
"price": 19.99
}).to_string();
let mut mac = Hmac::<Sha256>::new_from_slice(secret.as_bytes()).expect("HMAC can take key of any size");
mac.update(payload.as_bytes());
let signature = hex::encode(mac.finalize().into_bytes());
let client = Client::new();
let res = client.post(url)
.header("Authorization", format!("ApiKey {}", api_key))
.header("Content-Type", "application/json")
.header("X-Hmac-Signature", signature)
.body(payload)
.send()
.expect("Failed to send request");
println!("Response: {:?}", res.text().unwrap());
}
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
import scala.util.Try
import scalaj.http._
object HmacSignatureExample extends App {
val apiKey = "your-api-key".getBytes("UTF-8")
val secret = "your-secret-key".getBytes("UTF-8")
val url = "https://api.hello-lisa.com/v2/plugin-notifications/{id}/updates"
val payload = """{"productId":"123","price":19.99}"""
def signHmacSHA256(data: String, key: Array[Byte]): String = {
val mac = Mac.getInstance("HmacSHA256")
mac.init(new SecretKeySpec(key, "HmacSHA256"))
mac.doFinal(data.getBytes("UTF-8")).map("%02x".format(_)).mkString
}
val signature = signHmacSHA256(payload, secret)
val response = Http(url)
.postData(payload)
.header("Authorization", s"ApiKey $apiKey")
.header("Content-Type", "application/json")
.header("X-Hmac-Signature", signature)
.asString
println(response.body)
}
using System;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
string apiKey = "your-api-key";
string secret = "your-secret-key";
string url = "https://api.hello-lisa.com/v2/plugin-notifications/{id}/updates";
string payload = "{\"productId\":\"123\",\"price\":19.99}";
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
string signature = BitConverter.ToString(hmac.ComputeHash(Encoding.UTF8.GetBytes(payload))).Replace("-", "").ToLower();
using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, url)
{
Content = new StringContent(payload, Encoding.UTF8, "application/json")
};
request.Headers.Add("Authorization", $"ApiKey {apiKey}");
request.Headers.Add("X-Hmac-Signature", signature);
HttpResponseMessage response = await client.SendAsync(request);
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}