Wednesday, 3 July 2019

How to customize user dialog in botpress ver 11.9.5?

I am trying to add timestamp to every dialog in botpress chat. So far I am able to add this timestamp in bot's dialog, but I need some pointers in adding the same to user's dialog and choice skill.

Screenshot from chat showing timestamp in bot's dialog enter image description here Custom component

export class InfaText extends React.Component {
  message = this.props.text

  getTimestamp = () => {
    let date = new Date();
    let options = {
      month: "short",
      day: "numeric", hour: "2-digit", minute: "2-digit"
    };
    return date.toLocaleTimeString("en-us", options);
  }
  render() {
    return (<div className="infaTextMain">
      <p className="infaTextMessage">{this.message}</p>
      <small className="infaTextTimestamp">{this.getTimestamp()}</small>
    </div>)
  }
}

Note: Botpress v11.9.5

Also, is there a generic way to add a timestamp to all dialogs?



from How to customize user dialog in botpress ver 11.9.5?

No comments:

Post a Comment