Skip to main content

Callback Parser library

This library is used to parse and validate the JSON response from our webapp.

Installation

npm install @facenote/callback-data-parser

Usage

import qs from 'qs';
import getRawBody from 'raw-body';
import {
CallbackData,
parseCallbackData,
} from '@facenote/callback-data-parser';

const rawBody = await getRawBody(req, { encoding: true });
const parsedBody = qs.parse(rawBody.toString());
const resultData = parseCallbackData(parsedBody);
info

Check out Response Object for information about the object returned from parseCallbackData function.