Reference plugin that answers matching messages locally, without calling the API. The first rule whose matcher fires short-circuits the send via ctx.respondWith, so the network is never hit for that turn.
ctx.respondWith
<ChatWidget apiUrl={url} plugins={[pluginCannedResponses({ rules: [ { match: "hours", reply: "We're open 9-5, Mon-Fri." }, { match: /pricing|cost/i, reply: "See https://example.com/pricing." }, ], })]}/> Copy
<ChatWidget apiUrl={url} plugins={[pluginCannedResponses({ rules: [ { match: "hours", reply: "We're open 9-5, Mon-Fri." }, { match: /pricing|cost/i, reply: "See https://example.com/pricing." }, ], })]}/>
Reference plugin that answers matching messages locally, without calling the API. The first rule whose matcher fires short-circuits the send via
ctx.respondWith, so the network is never hit for that turn.