Skip to main content

compileResponse

Stentor API Reference


Stentor API Reference / stentor-response/src / compileResponse

Function: compileResponse()

compileResponse(response, request, context, additionalContext?, macros?): Response

Defined in: packages/stentor-response/src/compileResponse.ts:36

Compiles a templated response with provided request and context.

In order for the template to compile, it must contain ${} with json paths within the mustaches. For example, a string such as:

"Hello ${ $.request.slots.NAME.value }"

will be transformed to "Hello Bob" when passed an intent request with a slot "NAME" and value "Bob"

Parameters​

response​

Response

Response to be compiled

request​

Request

Request to pull information from for compilation

context​

Context

Context to pull information from for compilation

additionalContext?​

Record\<string, unknown>

Additional, optional, context to pull information from for compilation

macros?​

MacroMap

Returns​

Response