<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ChatFlow &amp;quot;responseExpected&amp;quot;: it does not work in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392402#M38758</link>
    <description>&lt;P&gt;Hi again AlexCornejo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If &lt;EM&gt;&lt;STRONG&gt;responseExpected&lt;/STRONG&gt;&lt;/EM&gt; is set to &lt;EM&gt;true&lt;/EM&gt;, the&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;exports.main&lt;/STRONG&gt;&lt;/EM&gt; block is called again after the chatflow visitor has responded. This gives you the chance to change the chatflow's behaviour based on the visitor's response to the questions you ask using&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;quickReplies&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to move to a specific module after the visitor has responded to your&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;quickReplies&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;question, try using&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;nextModuleNickname&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;--&amp;gt; to find the target chatflow module's "nickname", go out to your chatflow view, click the module and copy the value in the "Action name (internal only)*" field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;exports.main = (event, callback) =&amp;gt; {
  var responseJson = {
    "botMessage": "Select one option",
    "quickReplies": [ { value:'op1', label:'op1' }, { value:'op2', label:'op2' } ],
    "nextModuleNickname": "Target next module 'Action name' / nickname",
    "responseExpected": true
  };
  callback(responseJson);
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you would like to change the chatflow's behaviour based on how the visitor responds to your&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;quickReplies&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;question, you could try doing something like this ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;exports.main = (event, callback) =&amp;gt; {
  if (event.userMessage.quickReply == null) {
      // this block will run if there are no quick replies in the event object
      const responseJson = {
        botMessage: "Select one option",
        quickReplies: [ { value:'option_1', label:'Option 1' }, { value:'option_2', label:'Option 2' } ],
        responseExpected: true
      };
      callback(responseJson);
    } else if (event.userMessage.quickReply.quickReplies[0].value == "option_1") {
      // this block will run if the visitor has selected "Option 1" (value "option_1")
      const responseJson = {
        botMessage: "Thanks for selecting " + event.userMessage.quickReply.quickReplies[0].label,
        nextModuleNickname: "Target next module 'Action name' / nickname",
        responseExpected: false
      };
      callback(responseJson);
    } else if (event.userMessage.quickReply.quickReplies[0].value == "option_2") {
      // this block will run if the visitor has selected "Option 2" (value "option_2")
      const responseJson = {
        botMessage: "Thanks for selecting " + event.userMessage.quickReply.quickReplies[0].label,
        nextModuleNickname: "Target next module 'Action name' / nickname",
        responseExpected: false
      };
      callback(responseJson);
    }
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course, the exact logic you'll need to use will depend on the chatflow question immediately preceding your cope snippet module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Zach&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Dec 2020 18:16:34 GMT</pubDate>
    <dc:creator>zaklein</dc:creator>
    <dc:date>2020-12-09T18:16:34Z</dc:date>
    <item>
      <title>ChatFlow "responseExpected": it does not work</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392128#M38722</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm doing a chatflow with code snippet &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Using your own example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;exports.main = (event, callback) =&amp;gt; {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;var responseJson = {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"botMessage": "Select one option",&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"quickReplies": [ { value:'op1 ', label:'op1' }, { value:'op2', label:'op2'} ],&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;"responseExpected": false&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;};&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;callback(responseJson);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;};&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This one won't let me respond.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've looked for documentation and it doesn't exist. Do you have any idea how to make it work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 23:10:21 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392128#M38722</guid>
      <dc:creator>AlexCornejo</dc:creator>
      <dc:date>2020-12-08T23:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: ChatFlow "responseExpected": it does not work</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392346#M38750</link>
      <description>&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think changing the value of the&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;responseExpected &lt;/EM&gt;&lt;/STRONG&gt;key&amp;nbsp;to &lt;STRONG&gt;&lt;EM&gt;true&lt;/EM&gt;&lt;/STRONG&gt; will do the trick, i.e. --&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"responseExpected": true&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Zach&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 15:21:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392346#M38750</guid>
      <dc:creator>zaklein</dc:creator>
      <dc:date>2020-12-09T15:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: ChatFlow "responseExpected": it does not work</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392388#M38757</link>
      <description>&lt;P&gt;Hi Zaklein &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;False&lt;/STRONG&gt; doesn't let me respodner but it goes to the next node.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;True&lt;/STRONG&gt; lets me answer but asks me the same infinitely. if here it could go to the next node it would work perfect. Try "nextModuleNickname: 'nextNode' but it doesn't work.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;Do you have any idea how to make it work?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 16:51:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392388#M38757</guid>
      <dc:creator>AlexCornejo</dc:creator>
      <dc:date>2020-12-09T16:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: ChatFlow "responseExpected": it does not work</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392402#M38758</link>
      <description>&lt;P&gt;Hi again AlexCornejo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If &lt;EM&gt;&lt;STRONG&gt;responseExpected&lt;/STRONG&gt;&lt;/EM&gt; is set to &lt;EM&gt;true&lt;/EM&gt;, the&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;exports.main&lt;/STRONG&gt;&lt;/EM&gt; block is called again after the chatflow visitor has responded. This gives you the chance to change the chatflow's behaviour based on the visitor's response to the questions you ask using&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;quickReplies&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to move to a specific module after the visitor has responded to your&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;quickReplies&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;question, try using&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;nextModuleNickname&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;--&amp;gt; to find the target chatflow module's "nickname", go out to your chatflow view, click the module and copy the value in the "Action name (internal only)*" field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;exports.main = (event, callback) =&amp;gt; {
  var responseJson = {
    "botMessage": "Select one option",
    "quickReplies": [ { value:'op1', label:'op1' }, { value:'op2', label:'op2' } ],
    "nextModuleNickname": "Target next module 'Action name' / nickname",
    "responseExpected": true
  };
  callback(responseJson);
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you would like to change the chatflow's behaviour based on how the visitor responds to your&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;quickReplies&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;question, you could try doing something like this ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;exports.main = (event, callback) =&amp;gt; {
  if (event.userMessage.quickReply == null) {
      // this block will run if there are no quick replies in the event object
      const responseJson = {
        botMessage: "Select one option",
        quickReplies: [ { value:'option_1', label:'Option 1' }, { value:'option_2', label:'Option 2' } ],
        responseExpected: true
      };
      callback(responseJson);
    } else if (event.userMessage.quickReply.quickReplies[0].value == "option_1") {
      // this block will run if the visitor has selected "Option 1" (value "option_1")
      const responseJson = {
        botMessage: "Thanks for selecting " + event.userMessage.quickReply.quickReplies[0].label,
        nextModuleNickname: "Target next module 'Action name' / nickname",
        responseExpected: false
      };
      callback(responseJson);
    } else if (event.userMessage.quickReply.quickReplies[0].value == "option_2") {
      // this block will run if the visitor has selected "Option 2" (value "option_2")
      const responseJson = {
        botMessage: "Thanks for selecting " + event.userMessage.quickReply.quickReplies[0].label,
        nextModuleNickname: "Target next module 'Action name' / nickname",
        responseExpected: false
      };
      callback(responseJson);
    }
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course, the exact logic you'll need to use will depend on the chatflow question immediately preceding your cope snippet module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Zach&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 18:16:34 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392402#M38758</guid>
      <dc:creator>zaklein</dc:creator>
      <dc:date>2020-12-09T18:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: ChatFlow "responseExpected": it does not work</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392423#M38760</link>
      <description>&lt;P&gt;wow!&lt;/P&gt;&lt;P&gt;Thank you very much,&lt;/P&gt;&lt;P&gt;it worked very well, when the user finishes responding, it goes to the next node.&lt;/P&gt;&lt;P&gt;But anyway ignore the part of the "nextModuleNickname" that I am missing? Can you help me with an example of this? am I doing the node wrong?&lt;/P&gt;&lt;P&gt;Greetings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlexCornejo_0-1607538223993.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/35187iED37DFB183775070/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlexCornejo_0-1607538223993.png" alt="AlexCornejo_0-1607538223993.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlexCornejo_1-1607538279596.png" style="width: 400px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/35188iFDE12C134688A197/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlexCornejo_1-1607538279596.png" alt="AlexCornejo_1-1607538279596.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 18:25:13 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392423#M38760</guid>
      <dc:creator>AlexCornejo</dc:creator>
      <dc:date>2020-12-09T18:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: ChatFlow "responseExpected": it does not work</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392969#M38831</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi AlexCornejo,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Again, the reason you're stuck in a loop is because the &lt;STRONG&gt;exports.main&lt;/STRONG&gt; function is called again when &lt;STRONG&gt;responseExpected&lt;/STRONG&gt; is set to &lt;STRONG&gt;true&lt;/STRONG&gt;. The reason it behaves like this is to give you a chance to do something based on the visitor's response.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For the purpose of getting your example to work, the below should do the trick. It's not particularly useful because it doesn't change the chatflow's behaviour based on the visitor's selection --&amp;gt; it simply let's the visitor choose an option and then goes to the "next_module" without acting on the visitor's choice. But hopefully, it'll get you on the right track &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;exports.main = (event, callback) =&amp;gt; {
  if (event.userMessage.quickReply == null) {
    // this block will run if there are no quick replies in the event object
    const responseJson = {
      botMessage: "select an option",
      quickReplies: [ { value:'option_1', label:'Option 1' }, { value:'option_2', label:'Option 2' } ],
      nextModuleNickname: "next_module",
      responseExpected: true
    };
    callback(responseJson);
  } else {
    // this block will run if the event object contains quick reply messages
    // (i.e. when someone has selected any option in their most recent reply)
    const responseJson = {
      nextModuleNickname: "next_module"
    };
    callback(responseJson);
  }
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Zach&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 11:51:24 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/392969#M38831</guid>
      <dc:creator>zaklein</dc:creator>
      <dc:date>2020-12-11T11:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: ChatFlow "responseExpected": it does not work</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/393524#M38888</link>
      <description>&lt;P&gt;Thank you very much for your help with this if I can pass the following module&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 03:35:31 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/ChatFlow-quot-responseExpected-quot-it-does-not-work/m-p/393524#M38888</guid>
      <dc:creator>AlexCornejo</dc:creator>
      <dc:date>2020-12-15T03:35:31Z</dc:date>
    </item>
  </channel>
</rss>

