<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Aura – </title>
    <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/</link>
    <description>Recent content on Aura</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    
	  <atom:link href="/docs/components/aura-bot-platform/aura-bot-components/middlewares/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/incoming-event-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-bot-platform/aura-bot-components/middlewares/incoming-event-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;incoming-event-middleware&#34;&gt;Incoming Event middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;incoming-event-middleware&lt;/strong&gt;&lt;/em&gt;, executed in &lt;strong&gt;event&lt;/strong&gt; activity types.&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The &lt;em&gt;&lt;strong&gt;incoming-event-middleware&lt;/strong&gt;&lt;/em&gt; is in charge of managing &lt;strong&gt;events&lt;/strong&gt;, that is, activities for the end-to-end communication between &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; and channels.&lt;/p&gt;
&lt;p&gt;Channels can send events to &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; to inform about any relevant event happening on their side.&lt;br&gt;
In particular, &lt;em&gt;&lt;strong&gt;aura-bridge&lt;/strong&gt;&lt;/em&gt; sends an event to &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt;, when the transformation from bot activity to WhatsApp message fails, that is handled by this middleware.&lt;/p&gt;
&lt;p&gt;When &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; receives an &lt;strong&gt;event&lt;/strong&gt;, this middleware prevents the execution of the rest of the middlewares by completing the request flow.&lt;/p&gt;
&lt;p&gt;There are two types of &lt;strong&gt;events&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Log type: the channel asks &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; to log certain information&lt;/li&gt;
&lt;li&gt;emptyResponse type: Event sent by the bot when no response activity is sent. Currently, it is internally used for &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; towards &lt;em&gt;&lt;strong&gt;aura-bridge&lt;/strong&gt;&lt;/em&gt;.
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-typescript&#34; data-lang=&#34;typescript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;enum&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;TypeEvent&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;     * Log event
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;     */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;Log&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;log&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;     * Directline empty response event (Event sent by the bot when no response activity is sent)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;     */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;EmptyResponse&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;emptyResponse&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This middleware is executed once the HTTP request arrives at the server to the &lt;code&gt;POST /api/messages&lt;/code&gt; endpoint and the Direct Line authentication executed by the &lt;em&gt;&lt;strong&gt;Adapter&lt;/strong&gt;&lt;/em&gt; is successful.&lt;/p&gt;
&lt;p&gt;It is a &lt;code&gt;Turn&lt;/code&gt; middleware, so it is executed during turn initialization. It is only executed if the type of the activity is &lt;code&gt;event&lt;/code&gt;. In this case, the middleware records the KPIs and updates the context.&lt;/p&gt;
&lt;p&gt;The source code of this middleware is included in &lt;a href=&#34;https://github.com/Telefonica/aura-bot-platform/tree/master/src/middlewares&#34;&gt;Aura Bot Platform middlewares - Github repository&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;incoming-event-flow-diagram&#34;&gt;Incoming Event flow diagram&lt;/h2&gt;
&lt;p&gt;The &lt;em&gt;&lt;strong&gt;incoming-event-middleware&lt;/strong&gt;&lt;/em&gt; flowchart is included below:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;../../../../../images/aura-bot-event-flow.png&#34; alt=&#34;Flow diagram&#34;&gt;&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/init-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-bot-platform/aura-bot-components/middlewares/init-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;init-middleware&#34;&gt;Init middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;init-middleware&lt;/strong&gt;&lt;/em&gt;, the very first one to be executed once the HTTP request arrives at the server&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The &lt;em&gt;&lt;strong&gt;init-middleware&lt;/strong&gt;&lt;/em&gt; is the first to be executed once the HTTP request arrives at the server to the &lt;code&gt;POST /api/messages&lt;/code&gt; endpoint and the Direct Line authentication executed by the Adapter is successful.&lt;/p&gt;
&lt;p&gt;It is a &lt;code&gt;Turn&lt;/code&gt; middleware, so it is executed during turn initialization.&lt;/p&gt;
&lt;p&gt;It launches the execution of all the following middlewares, in the order declared during &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; initialization. It is only executed if the type of the activity is &lt;code&gt;message&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The source code of this middleware is included in &lt;a href=&#34;https://github.com/Telefonica/aura-bot-platform/tree/master/src/middlewares&#34;&gt;Aura Bot Platform middlewares - Github repository&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;init-middleware-flowchart&#34;&gt;init-middleware flowchart&lt;/h2&gt;
&lt;p&gt;The orderly steps for the management of this middleware are detailed below:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Set a proper correlator in the &lt;code&gt;TurnContext&lt;/code&gt;, that will be used during the whole processing of the activity throughout &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This means that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If a correlator is received in the &lt;a href=&#34;../../../../../docs/components/request-response-model/channeldata-v3/&#34;&gt;&lt;code&gt;channelData&lt;/code&gt;&lt;/a&gt; of the activity, this one is used.&lt;/li&gt;
&lt;li&gt;If the channel does not send a correlator, a new one is generated at this point, to be used the same way.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-ts&#34; data-lang=&#34;ts&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;ContextUtils&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;setCorrelator&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;ContextUtils&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;getCorrelatorFromChannelData&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;));&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;/**
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt; * Get correlator from channel data, if exist there, or creates a new one.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;    * @param context Context where the channel data will be taken from
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;    */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;getCorrelatorFromChannelData&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;!&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;activity&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;channelData&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;||&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;!&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;activity&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;channelData&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;correlator&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;activity&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;channelData&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;activity&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;channelData&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;||&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{},&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;correlator&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;uuid.v4&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;activity&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;channelData&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;correlator&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;
&lt;p&gt;Push the &lt;code&gt;auraId&lt;/code&gt;, received in the &lt;code&gt;from.id&lt;/code&gt; of the activity, to the &lt;code&gt;TurnContext&lt;/code&gt;, to make it available in all the activity execution steps. The &lt;code&gt;getAuraId&lt;/code&gt; method sets the &lt;code&gt;auraId&lt;/code&gt; based on the channel type, if the channel is integrated. Then, the &lt;code&gt;auraId&lt;/code&gt; is prefixed with the channel prefix.&lt;/p&gt;
&lt;p&gt;This is necessary because the &lt;code&gt;auraId&lt;/code&gt; is the key to the user cache and, if it is not formatted properly, it will fail to fetch the user from the cache and will re-request the user&amp;rsquo;s data from the services.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-ts&#34; data-lang=&#34;ts&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;ContextUtils&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;setAuraId&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;ChannelDataUtils&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;getAuraId&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;AuraChannelsConfiguration&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;instance&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;));&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Initialize the data accessors of the conversational context in the &lt;code&gt;TurnContext&lt;/code&gt;: &lt;code&gt;conversationState&lt;/code&gt;, &lt;code&gt;userState&lt;/code&gt; and &lt;code&gt;authenticationState&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-ts&#34; data-lang=&#34;ts&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;ContextUtils&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;setAuraPersistentDataAccesors&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;dataAccessors&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Initialize the &lt;code&gt;conversationState&lt;/code&gt;. This is necessary to avoid errors when a user accesses through several channels simultaneously.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-ts&#34; data-lang=&#34;ts&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;ContextUtils&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;setConversationState&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;conversationState&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set activity locale with the default value.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-ts&#34; data-lang=&#34;ts&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#000&#34;&gt;context&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;activity&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;locale&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;ConfigurationManager&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;instance&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;environmentConfiguration&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;AURA_DEFAULT_LOCALE&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;At this stage, two scenarios can happen:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If the activity processing is executed properly, the following middleware is executed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the happening of an unexpected error during the activity processing, the error makes all its way back to this initialization middleware error handling, in order to return the user a response activity including the most appropriate text related to the error.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;One of the possible errors landing in this middleware during the activity processing, happens when the size of the response is bigger than the ones allowed by Direct Line protocol, that &lt;a href=&#34;https://docs.microsoft.com/da-dk/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-api-reference?view=azure-bot-service-4.0#activities&#34;&gt;must not exceed 256K characters&lt;/a&gt;, the response is bypassed and a generic text explaining that there are too many results is returned to the user: (&lt;code&gt;errors:error.message.oversize&lt;/code&gt;).&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/fourth-platform-authentication-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-bot-platform/aura-bot-components/middlewares/fourth-platform-authentication-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;fourth-platform-authorization-middleware&#34;&gt;Fourth Platform Authorization middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;fourth-platform-authorization-middleware&lt;/strong&gt;&lt;/em&gt;, in charge of the validation of the user&amp;rsquo;s credentials&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;fourth-platform-authorization-middleware&lt;/strong&gt;&lt;/em&gt; validates the user&amp;rsquo;s credentials and the authorization of the &lt;code&gt;auraId&lt;/code&gt; sent by the channel, in order to provide all the information of the user needed before the execution of any Aura use case.&lt;/p&gt;
&lt;p&gt;It is always executed just after the &lt;a href=&#34;../../../../../docs/components/aura-bot-platform/aura-bot-components/middlewares/init-middleware/&#34;&gt;&lt;em&gt;&lt;strong&gt;init-middleware&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For further details about Aura authentication, please go to &lt;a href=&#34;../../../../../docs/components/aura-bot-platform/aura-bot-processes/authentication/&#34;&gt;Aura authentication&lt;/a&gt;, in order to understand the different types of Aura users regarding authentication.&lt;/p&gt;
&lt;h3 id=&#34;modules&#34;&gt;Modules&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;fourth-platform-authorization-middleware&lt;/strong&gt;&lt;/em&gt; lays on two modules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;FourthPlatformAuth&lt;/code&gt;: class that must implement &lt;code&gt;IAuraAuthenticator&lt;/code&gt; interface. This class provides all the methods and properties required to handle &lt;strong&gt;Kernel&lt;/strong&gt; authorization mechanisms.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;AuraUser&lt;/code&gt;: generic class depending on the authenticator provided, in this case &lt;code&gt;FourthPlatformAuth&lt;/code&gt;, and that implements &lt;code&gt;AuraUserBaseModel&amp;lt;IAuraAuthenticator&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;fourth-platform-authorization-middleware-flow&#34;&gt;fourth-platform-authorization-middleware flow&lt;/h3&gt;
&lt;p&gt;The first step is to try to get the user details from the &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; cache. In order to improve performance, we try to get it from the local cache of the server and only go to the remote cache if needed. This is done both if the user is authenticated or anonymous, but reading from different caches.&lt;/p&gt;
&lt;p&gt;The source code of this middleware is included in &lt;a href=&#34;https://github.com/Telefonica/aura-bot-platform/tree/master/src/middlewares&#34;&gt;Aura Bot Platform middlewares - Github repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If the user&amp;rsquo;s authentication information is cached, the next step is to validate it. If valid, then &lt;a href=&#34;../../../../../docs/components/kpi-entities/kpis-entity-handler/&#34;&gt;&lt;em&gt;&lt;strong&gt;kpi-handler&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt; is called to write the &lt;code&gt;USER&lt;/code&gt; entity row, and the next middleware is called. If user&amp;rsquo;s authentication information is neither cached nor valid, then the authentication process is launched:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Get user&amp;rsquo;s information by &lt;code&gt;auraId&lt;/code&gt; from &lt;em&gt;&lt;strong&gt;Aura AuthenticationService&lt;/strong&gt;&lt;/em&gt;, getting both the data of the user stored in Aura users database and her channel configuration.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If it is a valid authenticated user, then read user&amp;rsquo;s authorization data from Kernel.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The first step in Kernel authentication is to have a valid &lt;code&gt;accessToken&lt;/code&gt;, granted for the scopes and purposes needed by the use cases managed by the channel.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then, if the channel needs it, &lt;code&gt;UserProfile&lt;/code&gt; is read from Kernel API. Out of it, the &lt;code&gt;AuraUserType&lt;/code&gt; is calculated in order to know if the user is &lt;code&gt;monomsisdn&lt;/code&gt;, &lt;code&gt;multimsisdn&lt;/code&gt;, &lt;code&gt;nomsisdn&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The last step is to get the introspection token to obtain a complete view of the user&amp;rsquo;s identification, related to her &lt;code&gt;authorization_id&lt;/code&gt;. Then, all the scopes in the introspection will be merged together and added to the information of the user.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;After data from &lt;em&gt;&lt;strong&gt;Aura AuthenticationService&lt;/strong&gt;&lt;/em&gt; and &lt;strong&gt;Kernel&lt;/strong&gt; is read and processed, there is a valid &lt;code&gt;AuraUser&lt;/code&gt; object that is stored in the &lt;code&gt;userDataCache&lt;/code&gt; and in the corresponding &lt;code&gt;UserState&lt;/code&gt; of &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then, the next middleware is executed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Error cases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If a new &lt;code&gt;accessToken&lt;/code&gt; cannot be obtained because &lt;code&gt;authorization_id&lt;/code&gt; is not valid, then &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; stops message processing and returns an activity with an &lt;code&gt;UNAUTHENTICATED&lt;/code&gt; code in the &lt;code&gt;channelData&lt;/code&gt; to the channel, indicating that the channel must relaunch user authentication with &lt;strong&gt;Kernel&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Any other error generating &lt;code&gt;accessToken&lt;/code&gt; or getting &lt;code&gt;UserProfile&lt;/code&gt; or &lt;code&gt;IntrospectionToken&lt;/code&gt; will return an &lt;code&gt;INTERNAL&lt;/code&gt; code error in the channel, so it should retry the communication after a while.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the given &lt;code&gt;auraId&lt;/code&gt; does not exist in Aura&amp;rsquo;s database, it is validated if the user can be treated as anonymous.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;This is only possible if the request has the specific identifier of the channel in the &lt;code&gt;channelData.appContext.application.id&lt;/code&gt; field and if that channel allows anonymous users.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Error cases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In case of an error accessing &lt;em&gt;&lt;strong&gt;Aura AuthenticationService&lt;/strong&gt;&lt;/em&gt;, excepting &lt;code&gt;404&lt;/code&gt; (user not found in Aura database), &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; will stop message processing and will return an &lt;code&gt;INTERNAL&lt;/code&gt; code error in the channel, so it should retry the communication after a while.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the &lt;code&gt;auraId&lt;/code&gt; is not found in Aura users database and the channel does not allow anonymous users, then &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; stops message processing and returns an activity with an &lt;code&gt;UNAUTHENTICATED&lt;/code&gt; code in the &lt;code&gt;channelData&lt;/code&gt; to the channel, indicating that the channel must relaunch user authentication with Kernel.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the channel provided in the request is not a valid one, then &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; will stop message processing and return an &lt;code&gt;INTERNAL&lt;/code&gt; code error in the channel, informing that the request is not valid.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In all the cases, before leaving the &lt;em&gt;&lt;strong&gt;fourth-platform-authorization-middleware&lt;/strong&gt;&lt;/em&gt;, the &lt;a href=&#34;../../../../../docs/components/kpi-entities/kpis-entity-handler/&#34;&gt;&lt;em&gt;&lt;strong&gt;kpi-handler&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt; will be called to write a new row in the &lt;code&gt;USER&lt;/code&gt; entity file, with the result of the authentication.&lt;/p&gt;
&lt;p&gt;The flow diagram of the process is included below:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;../../../../../images/fourth-platform-authorization-middleware-flow.png&#34; alt=&#34;Flow diagram&#34;&gt;&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/incoming-kpi-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-bot-platform/aura-bot-components/middlewares/incoming-kpi-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;incoming-kpi-middleware&#34;&gt;Incoming KPI middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;incoming-KPI-middleware&lt;/strong&gt;&lt;/em&gt;, in charge of writing the KPI when a message is received&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The &lt;em&gt;&lt;strong&gt;incoming-KPI-middleware&lt;/strong&gt;&lt;/em&gt; extends BotFramework class &lt;code&gt;IncomingMessageMiddleware&lt;/code&gt;, meaning that certain code is executed on incoming message.&lt;/p&gt;
&lt;p&gt;This middleware is always executed just after the &lt;a href=&#34;../../../../../docs/components/aura-bot-platform/aura-bot-components/middlewares/fourth-platform-authorization-middleware/&#34;&gt;&lt;em&gt;&lt;strong&gt;fourth-platform-authorization-middleware&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This middleware is in charge of writing a row in the &lt;code&gt;MESSAGE&lt;/code&gt; entity file with the action received. This row is only written if the type of the received activity is &lt;code&gt;message&lt;/code&gt;; otherwise, it is ignored.&lt;/p&gt;
&lt;p&gt;In the happening of an error writing this information, the activity processing stops here, and an activity is sent to the user with an unexpected error text (&lt;code&gt;errors:error.unexpected&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;The source code of this middleware is included in &lt;a href=&#34;https://github.com/Telefonica/aura-bot-platform/tree/master/src/middlewares&#34;&gt;Aura Bot Platform middlewares - Github repository&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/bypass-mode-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-bot-platform/aura-bot-components/middlewares/bypass-mode-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;bypass-mode-middleware&#34;&gt;Bypass Mode middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;bypass-mode-middleware&lt;/strong&gt;&lt;/em&gt;, that when Aura Bot is in bypass mode, sends any input message directly to an external service&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The main functionality of bypass mode, is that once we are in this mode within a conversation, any input message to &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; will be directly sent to the external service, without any recognition made by the bot.&lt;/p&gt;
&lt;p&gt;Likewise, any message from the external service will be shown to the user without going through &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; recognition system.&lt;/p&gt;
&lt;p&gt;The source code of this middleware is included in &lt;a href=&#34;https://github.com/Telefonica/aura-bot-platform/tree/master/src/middlewares&#34;&gt;Aura Bot Platform middlewares - Github repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;&lt;strong&gt;bypass-mode-middleware&lt;/strong&gt;&lt;/em&gt; extends BotFramework class &lt;code&gt;IncommingMessageMiddleware&lt;/code&gt;, meaning that certain code is executed on incoming message.&lt;/p&gt;
&lt;pre class=&#34;mermaid&#34;&gt;flowchart TD
    A[Request] --&amp;gt; InitMiddleware (Middlewares)
    subgraph Middlewares
        direction LR
        InitMiddleware[...] --&amp;gt; BypassMode
        BypassMode --&amp;gt;|disable| NLPRecognizer
        BypassMode --&amp;gt;|enable| FinalizeRecognizer
        NLPRecognizer --&amp;gt; FinalizeRecognizer
        FinalizeRecognizer --&amp;gt; EndMiddlewares[...]
    end
    EndMiddlewares --&amp;gt; AuraBot[Aura Bot]
    style BypassMode fill:#800,stroke:#300,stroke-width:1px&lt;/pre&gt;
&lt;p&gt;The &lt;em&gt;&lt;strong&gt;bypass-mode-middleware&lt;/strong&gt;&lt;/em&gt; skips the execution of &lt;a href=&#34;../../../../../docs/components/aura-bot-platform/aura-bot-components/recognizers/nlp-recognizer/&#34;&gt;&lt;em&gt;&lt;strong&gt;nlp-recognizer-middleware&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt;, setting the value of &lt;code&gt;intentResult&lt;/code&gt; in the &lt;code&gt;TurnContext&lt;/code&gt; to the same that started the bypass mode.&lt;/p&gt;
&lt;p&gt;In case of &lt;code&gt;Init&lt;/code&gt; state, all the following middlewares are skipped. The dialog can find these messages in &lt;code&gt;channelData&lt;/code&gt; &lt;a href=&#34;../../../../../docs/components/request-response-model/channeldata-v3/aura-request-model&#34;&gt;conversationHistory&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;#x26a0;&amp;#xfe0f; This is an incoming message middleware, so it only handles incoming messages.&lt;/p&gt;
&lt;p&gt;&amp;#x1f4c3; Find here practical guidelines for the &lt;a href=&#34;../../../../../docs/experiences-builder/development-use-cases/bot-uc-development/build-dialog/bypass-mode/&#34;&gt;configuration of &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; in bypass mode&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;when-using-the-bypass-mode&#34;&gt;When using the bypass mode&lt;/h2&gt;
&lt;p&gt;The bypass mode can be used when all messages in a conversation want to be managed by the same dialog, without the bot recognizer system redirecting the request to another dialog.&lt;/p&gt;
&lt;p&gt;The bypass mode ensures that, once active, all requests will be sent to the dialog that started this mode and will continue to receive all requests until the bypass mode is deactivated.&lt;/p&gt;
&lt;p&gt;The bypass mode can be useful in multiple use cases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Chat with external systems&lt;/strong&gt;. For example, the &lt;a href=&#34;../../../../../docs/components/global-use-cases/testing-use-cases/handover-genesys-dialog/&#34;&gt;&lt;em&gt;&lt;strong&gt;handover&lt;/strong&gt;&lt;/em&gt; dialog&lt;/a&gt; directly forwards to Genesys (call center) all the messages the user sends once the communication between Aura and Genesys is established.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;when-the-bypass-mode-is-finished&#34;&gt;When the Bypass mode is finished&lt;/h2&gt;
&lt;p&gt;There are three different ways to exit the bypass mode:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;It can be decided by the handover dialog itself, using &lt;code&gt;closeBypass&lt;/code&gt; method in the &lt;code&gt;bypass&lt;/code&gt; object stored in the &lt;code&gt;TurnContext&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When certain time (configurable using de &lt;code&gt;expirationTime&lt;/code&gt; field in the &lt;code&gt;bypass&lt;/code&gt; object) passes without any exchange of messages.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When a user message sends one text defined as &lt;code&gt;closeString&lt;/code&gt;. Currently, the user can close bypass indicating keywords defined by the bypass_model (using the &lt;code&gt;closeString&lt;/code&gt; field). In the bypass model (saved in &lt;code&gt;conversationData&lt;/code&gt;), it is possible to indicate the words that close the bypass mode. By default: &lt;code&gt;core:bypass.close.words&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;how-does-it-work&#34;&gt;How does it work&lt;/h2&gt;
&lt;p&gt;The &lt;em&gt;&lt;strong&gt;bypass-mode-middleware&lt;/strong&gt;&lt;/em&gt; checks for each request if there is a bypass variable in the user&amp;rsquo;s &lt;code&gt;conversationData&lt;/code&gt;. If the bypass variable exists (type &lt;a href=&#34;https://github.com/Telefonica/aura-bot-common/blob/master/src/models/bypass-model.ts&#34;&gt;@telefonica/aura-bot-common/models/bypass-model&lt;/a&gt;) and its status is different from &lt;code&gt;Off&lt;/code&gt;, the middleware will perform the operations depending on the state.&lt;/p&gt;
&lt;p&gt;The different possible bypass states are defined in &lt;code&gt;BypassState&lt;/code&gt; enum:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-typescript&#34; data-lang=&#34;typescript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;enum&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;BypassState&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;Init&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;init&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;Bypass&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;bypass&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;Closed&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;closed&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;Paused&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;paused&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;Off&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;off&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;behavior-depending-on-the-state&#34;&gt;Behavior depending on the state&lt;/h3&gt;
&lt;p&gt;As previously indicated, the &lt;em&gt;&lt;strong&gt;bypass-mode-middleware&lt;/strong&gt;&lt;/em&gt; performs operations based on the state of the &lt;code&gt;bypass&lt;/code&gt; variable, which can be modified by the dialog according to the needs:&lt;/p&gt;
&lt;h4 id=&#34;init&#34;&gt;Init&lt;/h4&gt;
&lt;p&gt;Perform as in &lt;code&gt;Bypass&lt;/code&gt; state. It allows the dialog to execute boot actions.&lt;/p&gt;
&lt;h4 id=&#34;bypass&#34;&gt;Bypass&lt;/h4&gt;
&lt;p&gt;By default, the &lt;em&gt;&lt;strong&gt;bypass-mode-middleware&lt;/strong&gt;&lt;/em&gt; sets the &lt;code&gt;intentResult&lt;/code&gt; in &lt;code&gt;TurnContext&lt;/code&gt; with the intent to start the bypass mode (&lt;code&gt;bypass.intent&lt;/code&gt;), so that the dialog can manage the message.&lt;/p&gt;
&lt;p&gt;If the bypass has not expired, the last access information (using &lt;code&gt;updateLastAccess&lt;/code&gt; method) will be updated, restarting the expiration time again. In this state, the middleware does not close the bypass, this work is delegated to the dialog itself.&lt;/p&gt;
&lt;p&gt;In the &lt;code&gt;Bypass&lt;/code&gt; state, it is possible to execute an action using an &lt;code&gt;channelData.auraCommand&lt;/code&gt; with the following format in the &lt;code&gt;intent&lt;/code&gt; field (&lt;code&gt;activity.channelData.auraCommand.value.intent&lt;/code&gt;):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-pre&#34; data-lang=&#34;pre&#34;&gt;&amp;lt;intent&amp;gt;.&amp;lt;action&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The possible actions that can be executed are defined in &lt;code&gt;BypassAction&lt;/code&gt; enum:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-typescript&#34; data-lang=&#34;typescript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;declare&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;enum&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;BypassAction&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;Init&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;init&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;Start&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;start&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;Close&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;close&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;Pause&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;pause&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;None&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;none&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Currently, only the following actions have an effect on &lt;em&gt;&lt;strong&gt;bypass-mode-middleware&lt;/strong&gt;&lt;/em&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Close&lt;/strong&gt;. Set bypass in &lt;code&gt;Closed&lt;/code&gt; state and continues the normal execution.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As an example, we can send an &lt;code&gt;auraCommand&lt;/code&gt; with the &lt;code&gt;example-intent.close&lt;/code&gt; value on &lt;code&gt;intent&lt;/code&gt; field to close the bypass and send to the dialog that handles the &lt;code&gt;example-intent&lt;/code&gt; intent.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;auraCommand&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;value&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;intent&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;example-intent.close&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;entities&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;...&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;closed&#34;&gt;Closed&lt;/h4&gt;
&lt;p&gt;Close bypass removing it from &lt;code&gt;conversationData&lt;/code&gt;.&lt;/p&gt;
&lt;h4 id=&#34;paused&#34;&gt;Paused&lt;/h4&gt;
&lt;p&gt;Currently it has no effect, although in the future it will temporarily stop bypass mode and resume it again.&lt;/p&gt;
&lt;h4 id=&#34;off&#34;&gt;Off&lt;/h4&gt;
&lt;p&gt;It has no effect.&lt;/p&gt;
&lt;h2 id=&#34;bypass-model&#34;&gt;Bypass model&lt;/h2&gt;
&lt;p&gt;The bypass model contains the following information:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-typescript&#34; data-lang=&#34;typescript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;interface&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;BypassModel&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;state&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;BypassState&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;intent&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;Intent&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;duration&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;number&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;recipient&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ChannelAccount&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;userId&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;string&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;data&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;any&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;closeReason&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;BypassCloseReason&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;payloadName&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;string&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;closeString&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;string&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;|&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;string&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;[];&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;expirationTime&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;number&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;recognizersEnabled&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;boolean&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;recognizersBreakIntents&lt;/span&gt;: &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;Map&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;string&lt;/span&gt;&lt;span style=&#34;color:#a40000&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#c4a000&#34;&gt;string&lt;/span&gt;&lt;span style=&#34;color:#a40000&#34;&gt;[]&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Property&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;BypassState&lt;/td&gt;
&lt;td&gt;Current Bypass State&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;intent&lt;/td&gt;
&lt;td&gt;Intent that initiates the Bypass&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;duration&lt;/td&gt;
&lt;td&gt;Bypass life time in minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;recipient&lt;/td&gt;
&lt;td&gt;Recipient to return the message to&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;userId&lt;/td&gt;
&lt;td&gt;Identifier of the user who activated the Bypass&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;data&lt;/td&gt;
&lt;td&gt;Specify information for dialog&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;closeReason&lt;/td&gt;
&lt;td&gt;Reason for closure. If unknown, the dialog must find out what the cause was&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;payloadName&lt;/td&gt;
&lt;td&gt;Name of the property in the &lt;code&gt;channelData.payload&lt;/code&gt;. Used to send data to the bypass.ex: &amp;lsquo;handover&amp;rsquo;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;closeString&lt;/td&gt;
&lt;td&gt;Comma-separated string or array of string with the words that directly close the bypass&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;expirationTime&lt;/td&gt;
&lt;td&gt;Date of timeout for bypass&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;recognizersEnabled&lt;/td&gt;
&lt;td&gt;Flag to indicate whether or not recognizers must be executed and the final result stored, although the bypass is enabled.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;recognizersBreakIntents&lt;/td&gt;
&lt;td&gt;Recognized intents to replace dialog with&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;state-diagram&#34;&gt;State diagram&lt;/h2&gt;
&lt;p&gt;The following diagram shows the state transition of bypass mode:&lt;/p&gt;
&lt;pre class=&#34;mermaid&#34;&gt;stateDiagram-v2
    [*] --&amp;gt; Init : Dialog init bypass (Bypass.initialize)
    Init --&amp;gt; Bypass : Dialog update
    Bypass --&amp;gt; Closed : Dialog update or BypassAction.Close is received
    Init --&amp;gt; Closed : Dialog update or BypassAction.Close is received
    Closed --&amp;gt; [*] : Bypass model is removed
    %% note left of Init : Dialog perform startup tasks
    %% note left of Bypass : Dialog manages all incoming conversation requests&lt;/pre&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;h3 id=&#34;dialog-using-bypass&#34;&gt;Dialog using bypass&lt;/h3&gt;
&lt;h4 id=&#34;starting-bypass-mode&#34;&gt;Starting bypass mode&lt;/h4&gt;
&lt;p&gt;In an initial state, the user&amp;rsquo;s &lt;code&gt;conversationData&lt;/code&gt; does not have bypass information. The dialog must create the &lt;code&gt;bypass&lt;/code&gt; object to start the bypass mode.&lt;/p&gt;
&lt;pre class=&#34;mermaid&#34;&gt;sequenceDiagram
    actor User
    Note right of User: No bypass
    User-&amp;gt;&amp;gt;Bot: &amp;#34;First message&amp;#34;
    Bot-&amp;gt;&amp;gt;BypassModeMiddleware: request context
    Note right of BypassModeMiddleware: does nothing (no bypass model)
    BypassModeMiddleware-&amp;gt;&amp;gt;NLPRecognizerMiddleware: recognize from context
    NLPRecognizerMiddleware-&amp;gt;&amp;gt;NLPRecognizerMiddleware: recognized intent: &amp;#34;intent.example&amp;#34;
    NLPRecognizerMiddleware-&amp;gt;&amp;gt;ExampleDialog: request context
    ExampleDialog-&amp;gt;&amp;gt;ExampleDialog: OnInit
    Note right of ExampleDialog: Create bypass model (bypass state: Init)&lt;/pre&gt;
&lt;h4 id=&#34;receiving-messages-with-init-or-bypass-state&#34;&gt;Receiving messages with Init or Bypass state&lt;/h4&gt;
&lt;p&gt;The bypass mode can remain in &lt;code&gt;Init&lt;/code&gt; state until the dialog itself ends up performing startup tasks, or it can directly set the &lt;code&gt;Bypass&lt;/code&gt; state (if the dialog does not have to execute any task).&lt;/p&gt;
&lt;p&gt;In this state, &lt;a href=&#34;../../../../../docs/components/aura-bot-platform/aura-bot-components/recognizers/nlp-recognizer/&#34;&gt;&lt;em&gt;&lt;strong&gt;nlp-recognizer&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt; will not do anything, since the &lt;em&gt;&lt;strong&gt;bypass-mode-middleware&lt;/strong&gt;&lt;/em&gt; will have set &lt;code&gt;intentResult&lt;/code&gt; with the &lt;code&gt;intent.example&lt;/code&gt; value.&lt;/p&gt;
&lt;pre class=&#34;mermaid&#34;&gt;sequenceDiagram
    actor User
    loop
        Note right of User: Bypass on Init/Bypass state
        User-&amp;gt;&amp;gt;Bot: &amp;#34;New message X&amp;#34;
        Bot-&amp;gt;&amp;gt;BypassModeMiddleware: request context
        Note right of BypassModeMiddleware: intentResult = &amp;#34;intent.example&amp;#34;
        BypassModeMiddleware-&amp;gt;&amp;gt;NLPRecognizerMiddleware: does nothing
        Note right of NLPRecognizerMiddleware: does nothing
        NLPRecognizerMiddleware-&amp;gt;&amp;gt;ExampleDialog: request context
        Note right of ExampleDialog: Message received
    end
    ExampleDialog-&amp;gt;&amp;gt;ExampleDialog: OnBypass
    Note right of ExampleDialog: When the dialog finishes startup tasks, it can change the bypass state (state: Bypass)&lt;/pre&gt;
&lt;h4 id=&#34;close-bypass&#34;&gt;Close bypass&lt;/h4&gt;
&lt;p&gt;The bypass mode can be closed directly by the dialog, when it has completed its tasks, or by sending the &lt;code&gt;auraCommand&lt;/code&gt; with the value &lt;code&gt;intent.example.close&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&#34;mermaid&#34;&gt;sequenceDiagram
    actor User

    Note right of User: Bypass on Init/Bypass state
    User-&amp;gt;&amp;gt;Bot: &amp;#34;Message with auraCommand: intent.example.close&amp;#34;
    Bot-&amp;gt;&amp;gt;BypassModeMiddleware: request context
    Note right of BypassModeMiddleware: Close bypass and set intentResult to &amp;#34;intent.example&amp;#34;
    BypassModeMiddleware-&amp;gt;&amp;gt;NLPRecognizerMiddleware: does nothing
    Note right of NLPRecognizerMiddleware: does nothing
    NLPRecognizerMiddleware-&amp;gt;&amp;gt;ExampleDialog: request context
    Note right of ExampleDialog: Message received
    ExampleDialog-&amp;gt;&amp;gt;ExampleDialog: OnClose
    Note right of ExampleDialog: Execute close tasks&lt;/pre&gt;
&lt;h4 id=&#34;recognizers-enabled&#34;&gt;Recognizers enabled&lt;/h4&gt;
&lt;p&gt;The bypass mode, by default, is designed to avoid the execution of the recognizers of &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt;, but starting in release 9.10.0 (delivered in March 25) it can be configured, using the dialog flag &lt;code&gt;recognizersEnabled&lt;/code&gt;, to allow the execution of the recognizers, but the result is just stored in the context to be available for the dialog, and not to overwrite the bypassed dialog execution.&lt;/p&gt;
&lt;pre class=&#34;mermaid&#34;&gt;sequenceDiagram
    actor User

    Note right of User: Bypass on Bypass state
    User-&amp;gt;&amp;gt;Bot: &amp;#34;Message from the user: I want to watch channel four&amp;#34;
    Bot-&amp;gt;&amp;gt;BypassModeMiddleware: request context
    BypassModeMiddleware-&amp;gt;&amp;gt;NLPRecognizerMiddleware: call to nlp
    FinalizeRecognizers-&amp;gt;&amp;gt;BypassModeMiddleware: Store the IntentResult for intent.tv.display_channel
    Note right of ExampleDialog: Message received
    ExampleDialog-&amp;gt;&amp;gt;ExampleDialog: Execute next step of the bypass dialog
    ExampleDialog-&amp;gt;&amp;gt;ExampleDialog: Check if IntentResult is in recognizersBreakIntents
    ExampleDialog-&amp;gt;&amp;gt;ExampleDialog: Close bypass
    ExampleDialog-&amp;gt;&amp;gt;DisplayChannelDialog: Execute dialog
    DisplayChannelDialog-&amp;gt;&amp;gt;Bot: Return display channel response
    Bot-&amp;gt;&amp;gt;User: Return display channel response&lt;/pre&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/outgoing-channeldata-normalizer-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-bot-platform/aura-bot-components/middlewares/outgoing-channeldata-normalizer-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;outgoing-channeldata-normalizer-middleware&#34;&gt;Outgoing channelData Normalizer middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;outgoing-channeldata-normalizer-middleware&lt;/strong&gt;&lt;/em&gt;, in charge of making the channelData conversion to the normalized version&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;description&#34;&gt;Description&lt;/h2&gt;
&lt;p&gt;The &lt;em&gt;&lt;strong&gt;outgoing-channeldata-normalizer-middleware&lt;/strong&gt;&lt;/em&gt; transforms the outgoing &lt;code&gt;channelData&lt;/code&gt; property of the &lt;a href=&#34;../../../../../docs/components/request-response-model/&#34;&gt;Aura request-response model&lt;/a&gt; returned by the dialogs to the normalized version (if isn&amp;rsquo;t yet) to be read and modified if needed by outgoing dialogs (that work in normalized version).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;AURA_CHANNELDATA_VALIDATION&lt;/code&gt; should be &lt;code&gt;true&lt;/code&gt; and the dialog&amp;rsquo;s &lt;code&gt;channelData&lt;/code&gt; version from &lt;a href=&#34;../../../../../docs/components/aura-bot-platform/aura-bot-processes/channel-data/handle-channeldata-versions/#dialog-configuration&#34;&gt;&lt;code&gt;dialogSettings.channelDataVersion&lt;/code&gt;&lt;/a&gt; should be lower than &lt;code&gt;AURA_CHANNELDATA_CURRENT_VERSION&lt;/code&gt; to make the conversion. The conversion to original version again will be done in the &lt;a href=&#34;../../../../../docs/components/aura-bot-platform/aura-bot-components/#aura-botframework-adapter&#34;&gt;Aura BotFramework adapter&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The source code of this middleware is included in &lt;a href=&#34;https://github.com/Telefonica/aura-bot-platform/tree/master/src/middlewares&#34;&gt;Aura Bot Platform middlewares - Github repository&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/speak-processor-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-bot-platform/aura-bot-components/middlewares/speak-processor-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;speak-processor-middleware&#34;&gt;Speak Processor middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;speak-processor-middleware&lt;/strong&gt;&lt;/em&gt;, in charge of setting and supporting the &lt;code&gt;speak&lt;/code&gt; property to the activity in case the channel requires it&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;description&#34;&gt;Description&lt;/h2&gt;
&lt;p&gt;The &lt;em&gt;&lt;strong&gt;speak-processor-middleware&lt;/strong&gt;&lt;/em&gt; extends BotFramework class &lt;code&gt;OutgoingMessageMiddleware&lt;/code&gt;, meaning that certain code is executed on message outgoing.&lt;/p&gt;
&lt;p&gt;The source code of this middleware is included in &lt;a href=&#34;https://github.com/Telefonica/aura-bot-platform/tree/master/src/middlewares&#34;&gt;Aura Bot Platform middlewares - Github repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Depending on the configuration of the channel and the value of &lt;code&gt;modality&lt;/code&gt; and &lt;code&gt;fullAura.voice&lt;/code&gt; in the request &lt;a href=&#34;../../../../../docs/components/request-response-model/channeldata-v3/&#34;&gt;&lt;code&gt;channelData&lt;/code&gt;&lt;/a&gt;, it assures that a speakable sentence is provided in the &lt;code&gt;activity.speak field&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;channel.alwaysSpeak&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;activity.channelData.modality&lt;/code&gt; is &lt;code&gt;voice&lt;/code&gt; or &lt;code&gt;activity.channelData auraMode.fullAura.voice&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;, then:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If the activity does not have the &lt;code&gt;speak&lt;/code&gt; field, then &lt;code&gt;activity.text&lt;/code&gt; is processed applying the rules configured in &lt;code&gt;AURA_MIDDLEWARE_SPEAK_PROCESSOR&lt;/code&gt; to clean up the text of unwanted characters and make it speakable.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the activity already counts on a &lt;code&gt;speak&lt;/code&gt; field, nothing is done.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If no rules are configured, nothing is done.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Otherwise, &lt;code&gt;speak&lt;/code&gt; field is removed from the activity, because the channel will not wait for it.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/outgoing-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-bot-platform/aura-bot-components/middlewares/outgoing-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;outgoing-middleware&#34;&gt;Outgoing middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;outgoing-middleware&lt;/strong&gt;&lt;/em&gt;, that formats the outgoing message&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;description&#34;&gt;Description&lt;/h2&gt;
&lt;p&gt;The &lt;em&gt;&lt;strong&gt;outgoing-middleware&lt;/strong&gt;&lt;/em&gt; properly formats the outgoing message with all the common properties needed in an Aura&amp;rsquo;s response.&lt;/p&gt;
&lt;p&gt;The source code of this middleware is included in &lt;a href=&#34;https://github.com/Telefonica/aura-bot-platform/tree/master/src/middlewares&#34;&gt;Aura Bot Platform middlewares - Github repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It extends the BotFramework class &lt;code&gt;OutgoingMessageMiddleware&lt;/code&gt;, meaning that certain code is executed on message outgoing.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Firstly, it sets the correlator in &lt;code&gt;activity.channelData.correlator&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then, it sends the outgoing &lt;code&gt;MESSAGE&lt;/code&gt; entity row to the KPI handler.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then, it updates &lt;em&gt;&lt;strong&gt;Aura Context&lt;/strong&gt;&lt;/em&gt; with the last information of the message processing.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If there is any error both during these steps or in any other step, that would be stored in the &lt;code&gt;TurnContext&lt;/code&gt;, it would be properly added to the &lt;code&gt;activity.channelData&lt;/code&gt;. Any activity with an error would contain:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The error text as &lt;code&gt;activity.text&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;As &lt;code&gt;activity.speak&lt;/code&gt;, the already set &lt;code&gt;activity.speak&lt;/code&gt; or &lt;code&gt;activity.text&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;activity.inputHint=acceptingInput&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;activity.channelData.hasMoreMessages = false&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/batch-outgoing-message-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-bot-platform/aura-bot-components/middlewares/batch-outgoing-message-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;batch-outgoing-message-middleware&#34;&gt;Batch Outgoing Message middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;batch-outgoing-message-middleware&lt;/strong&gt;&lt;/em&gt;, in charge of handling all the activities within one response jointly&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;batch-outgoing-message-middleware&lt;/strong&gt;&lt;/em&gt; implements BotFramework class &lt;code&gt;Middleware&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It is executed after the &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt; &lt;a href=&#34;../../../../../docs/components/aura-bot-platform/aura-bot-components/recognizers/&#34;&gt;recognizers&lt;/a&gt;, whenever a new turn is started. Then, it waits for the execution of all the middlewares and the rest of the components of &lt;em&gt;&lt;strong&gt;aura-bot&lt;/strong&gt;&lt;/em&gt;, and thus it is the last element to be executed.&lt;/p&gt;
&lt;p&gt;The goal of this middleware is to handle all the activities within one response jointly, to avoid issues with &lt;code&gt;activity.inputHint&lt;/code&gt;. setting also &lt;code&gt;activity.channelData.hasMoreMessages&lt;/code&gt; field properly, if the channel request needs it (for example, if &lt;code&gt;channelData&lt;/code&gt; version is lower than &lt;code&gt;2&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;The source code of this middleware is included in &lt;a href=&#34;https://github.com/Telefonica/aura-bot-platform/tree/master/src/middlewares&#34;&gt;Aura Bot Platform middlewares - Github repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The flow of the middleware is explained as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;First of all, &lt;em&gt;&lt;strong&gt;batch-outgoing-message-middleware&lt;/strong&gt;&lt;/em&gt; looks for any error stored in the &lt;code&gt;TurnContext&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If there is no error, it would check if the bot is configured to use always batch processing of the activities being returned or if the channel needs it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If some error exists in the &lt;code&gt;TurnContext&lt;/code&gt;, nothing is done.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If there is no error and the bot or channel implies batch activities processing, it would get all the activities to be sent from &lt;code&gt;TurnContext&lt;/code&gt; activities queue and handle them to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Set &lt;code&gt;inputHint&lt;/code&gt; properly in each activity. There are 3 different values, defined by BotFramework:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;IgnoringInput&lt;/code&gt;: it should be sent when the answer of the bot counts on several activities in all of them but the last one, so it indicates the channel to ignore the messages of the user until the last activity arrives.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;AcceptingInput&lt;/code&gt;: it should be sent in the last activity of the answer of the bot, except if there&amp;rsquo;s a prompt. It indicates the channel that could start handling user messages again.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;ExpectingInput&lt;/code&gt;: it should be sent if the last activity of the answer of the bot if there&amp;rsquo;s a prompt in it, it indicates the channel that the bot has asked something to the user and it is waiting for her response.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;It also includes in the &lt;code&gt;channelData&lt;/code&gt; of each activity the proper value for &lt;code&gt;hasMoreMessages&lt;/code&gt; field, if the channel is configured to use it and the &lt;code&gt;channelData&lt;/code&gt; version of the request (from version 2 onwards).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Finally, it calls the &lt;code&gt;AuraBotAdapter&lt;/code&gt; method to send all the stored activities. In case the size of the response for any activity is larger than allowed by the Direct Line protocol, that must &lt;strong&gt;not exceed 256K characters&lt;/strong&gt;, the response is ignored and a generic text explaining that there are too many results is returned to the user (&lt;code&gt;errors:error.message.oversize&lt;/code&gt;).&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/extended-incoming-kpi-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-bot-platform/aura-bot-components/middlewares/extended-incoming-kpi-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;extended-incoming-kpi-middleware&#34;&gt;Extended Incoming Kpi middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;extended-incoming-kpi-middleware&lt;/strong&gt;&lt;/em&gt;, in charge of writing the KPI when a message is received. This is an extension of &lt;a href=&#34;../../../../../docs/components/aura-bot-platform/aura-bot-components/middlewares/incoming-kpi-middleware/&#34;&gt;&lt;em&gt;&lt;strong&gt;incoming-kpi-middleware&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;extended-incoming-kpi-middleware&lt;/strong&gt;&lt;/em&gt; extends BotFramework class &lt;code&gt;IncomingMessageMiddleware&lt;/code&gt;, meaning that certain code is executed on the incoming message.&lt;/p&gt;
&lt;p&gt;It is in charge of writing the row in the &lt;code&gt;MESSAGE&lt;/code&gt; and &lt;code&gt;EXTENDED_MESSAGE&lt;/code&gt; entity files with the action received. This row is only written if the type of the received activity is &lt;code&gt;message&lt;/code&gt;; otherwise it is ignored.&lt;/p&gt;
&lt;p&gt;In the happening of an error writing this information, the activity processing stops here and an activity is sent to the user with an unexpected error text (&lt;code&gt;errors:error.unexpected&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;This middleware is always executed just after the &lt;a href=&#34;../../../../../docs/components/aura-bot-platform/aura-bot-components/middlewares/incoming-kpi-middleware/&#34;&gt;&lt;em&gt;&lt;strong&gt;incoming-kpi-middleware&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The source code of this middleware is included in &lt;a href=&#34;https://github.com/Telefonica/aura-bot-platform/tree/master/src/middlewares&#34;&gt;Aura Bot Platform middlewares - Github repository&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/components/aura-bot-platform/aura-bot-components/middlewares/extended-outgoing-middleware/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/components/aura-bot-platform/aura-bot-components/middlewares/extended-outgoing-middleware/</guid>
      <description>
        
        
        &lt;h1 id=&#34;extended-outgoing-middleware&#34;&gt;Extended Outgoing middleware&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Description of &lt;em&gt;&lt;strong&gt;extended-outgoing-middleware&lt;/strong&gt;&lt;/em&gt;, that formats the outgoing message&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;description&#34;&gt;Description&lt;/h2&gt;
&lt;p&gt;The aim of &lt;em&gt;&lt;strong&gt;extended-outgoing-middleware&lt;/strong&gt;&lt;/em&gt; is to properly format the outgoing message with all the common properties needed in Aura&amp;rsquo;s response. This is an extension of the &lt;a href=&#34;../../../../../docs/components/aura-bot-platform/aura-bot-components/middlewares/outgoing-middleware/&#34;&gt;&lt;em&gt;&lt;strong&gt;outgoing-middleware&lt;/strong&gt;&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This middleware extends the BotFramework class &lt;code&gt;OutgoingMessageMiddleware&lt;/code&gt;, meaning that certain code is executed on message outgoing.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Firstly, it sets the correlator in &lt;code&gt;activity.channelData.correlator&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then, it sends the outgoing &lt;code&gt;EXTENDED_MESSAGE&lt;/code&gt; entity row to the KPI handler.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then, it updates &lt;em&gt;&lt;strong&gt;Aura Context&lt;/strong&gt;&lt;/em&gt; with the last information of the message processing.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If there is any error both during these steps or in any other step, that would be stored in the &lt;code&gt;TurnContext&lt;/code&gt;, it would be properly added to the &lt;code&gt;activity.channelData&lt;/code&gt;. Any activity with an error would contain:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The error text as &lt;code&gt;activity.text&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;As &lt;code&gt;activity.speak&lt;/code&gt;, the already set &lt;code&gt;activity.speak&lt;/code&gt; or &lt;code&gt;activity.text&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;activity.inputHint=acceptingInput&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;activity.channelData.hasMoreMessages = false&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The source code of this middleware is included in &lt;a href=&#34;https://github.com/Telefonica/aura-bot-platform/tree/master/src/middlewares&#34;&gt;Aura Bot Platform middlewares - Github repository&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
  </channel>
</rss>
