Skip to main content

REFERENCE

SDK Demos

How to use @asgard-js/core and @asgard-js/react, with demos you can try on the page.

Events

Handle EMIT actions dispatched by message template buttons. Use onTemplateBtnClick to receive every click with its eventName and payload.

  1. Code Example​

    <Chatbot
    onTemplateBtnClick={(payload, eventName, raw) => {
    console.log(eventName, payload, raw);
    // route to your own handler / analytics / navigation
    }}
    {...rest}
    />
  2. onTemplateBtnClick Parameters​

    ParameterTypeDescription
    payloadRecord<string, unknown>Payload data defined on the button
    eventNamestringEvent name defined on the button
    rawstringRaw message JSON string

    Only type: "emit" buttons trigger this callback. type: "uri" opens a link directly, and type: "message" sends a message.

Ready to get started?

Want to see how Asgard fits your team? Talk to us.

Contact us