parseHepsiburadaWebhookEvent
parseHepsiburadaWebhookEvent<
E>(event,rawBody):ParsedHepsiburadaWebhookEvent<E>
Defined in: sdks/hepsiburada/src/parse-webhook-event.ts:42
Parse a Hepsiburada webhook PUT body into a typed envelope.
Type Parameters
Section titled “Type Parameters”E extends HepsiburadaWebhookEvent
Parameters
Section titled “Parameters”E
The event name. Hepsiburada’s webhook model is
endpoint-per-event — you already know the name from your route
handler (e.g. app.put('/hb/createOrder', ...)). Must be one of
HEPSIBURADA_WEBHOOK_EVENTS.
rawBody
Section titled “rawBody”string | Record<string, unknown> | null | undefined
The raw request body — either a JSON string (Node’s
req.body when no body parser is mounted) or an already-parsed
object (after express.json() etc.).
Returns
Section titled “Returns”ParsedHepsiburadaWebhookEvent<E>
{ event, body, raw }. Both body and raw are the same
parsed object; raw is provided as the forward-compat accessor for
undocumented fields.
Throws
Section titled “Throws”when event isn’t a recognized event name,
when rawBody is a string but not valid JSON, or when rawBody
doesn’t parse to an object.
Example
Section titled “Example”import express from 'express';import { parseHepsiburadaWebhookEvent } from '@lonca/hepsiburada';
const app = express();app.use(express.json());
app.put('/hb/createOrder', (req, res) => { const { event, body } = parseHepsiburadaWebhookEvent('createOrder', req.body); // process the order... res.status(204).end();});Unofficial. Lonca is an independent, community-maintained project — not affiliated with, endorsed by, or supported by Trendyol, Hepsiburada, or any other marketplace. All marketplace names and trademarks belong to their respective owners.