<?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: Conversation workflow criteria based on email body in Data Hub</title>
    <link>https://community.hubspot.com/t5/Data-Hub/Conversation-workflow-criteria-based-on-email-body/m-p/1178160#M3151</link>
    <description>&lt;P&gt;yes we would like to be able to do this please so will upvote&lt;/P&gt;</description>
    <pubDate>Fri, 18 Jul 2025 11:50:43 GMT</pubDate>
    <dc:creator>IDollimore</dc:creator>
    <dc:date>2025-07-18T11:50:43Z</dc:date>
    <item>
      <title>Conversation workflow criteria based on email body</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Conversation-workflow-criteria-based-on-email-body/m-p/1156861#M3072</link>
      <description>&lt;P&gt;Hi, I am new to Hubspot, so not sure if Im even setting this up correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to make a workflow triggered when an email comes into the shared inbox. Based on the email body text, I want to route it to different places.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't figure out how to find the keyword in the message body. What Conversations field? I tried Communications field "communication body" and that doesn't work either. I know for sure the test email was "correct" and it fails to recognize my email.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help!&lt;/P&gt;</description>
      <pubDate>Sun, 25 May 2025 23:48:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Conversation-workflow-criteria-based-on-email-body/m-p/1156861#M3072</guid>
      <dc:creator>KateHoffer</dc:creator>
      <dc:date>2025-05-25T23:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Conversation workflow criteria based on email body</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Conversation-workflow-criteria-based-on-email-body/m-p/1156885#M3073</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/939490"&gt;@KateHoffer&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is unfortunately not possible at this stage. As far as I know, there is no conversation property that can be referenced to filter for the content of an incoming email.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other users have requested this before: &lt;A href="https://community.hubspot.com/t5/HubSpot-Ideas/Conversations-Workflow-Data/idi-p/423080" target="_blank"&gt;https://community.hubspot.com/t5/HubSpot-Ideas/Conversations-Workflow-Data/idi-p/423080&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These requests submitted to the HubSpot Ideas section of the community are reviewed by the HubSpot product team, based on their popularity and the assumed demand. I'd recommend commenting and upvoting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also help other HubSpot users find this request more easily (and drive traction) by accepting my reply as a solution. I'd appreciate it, too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a great day!&lt;/P&gt;</description>
      <pubDate>Mon, 26 May 2025 03:52:50 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Conversation-workflow-criteria-based-on-email-body/m-p/1156885#M3073</guid>
      <dc:creator>karstenkoehler</dc:creator>
      <dc:date>2025-05-26T03:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Conversation workflow criteria based on email body</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Conversation-workflow-criteria-based-on-email-body/m-p/1170908#M3128</link>
      <description>&lt;P&gt;This is technically doable with a custom code action if you have access to it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's an example where after setting your initial trigger to be Conversation-based and filter to the shared Inbox you want then add a Custom Code action after that and pass in the hs_thread_id (Thread Id) property into it.&lt;BR /&gt;&lt;BR /&gt;Unfortunately, because the message body is usually truncated you then have to do another API call in the action to then get the message body and check if your word or phrase you are looking for is in there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const hubspot = require('@hubspot/api-client');

exports.main = async (event, callback) =&amp;gt; {

  const thread_id = event.inputFields['hs_thread_id'];
 
  const hubspotClient = new hubspot.Client({
    accessToken: process.env.YourSecretAPIKey // set this in secrets for the action
  });

  const response = await hubspotClient.apiRequest({
    path: '/conversations/v3/conversations/threads/' + thread_id + '/messages',
  });
  let output_found = false;
  let message_id;
  const json = await response.json();
  json.results.forEach(function(message) {
    if (message.type === 'MESSAGE' &amp;amp;&amp;amp; message.direction === 'INCOMING') {
      message_id = message.id;
    }
  });
  const message_response = await hubspotClient.apiRequest({
        path: '/conversations/v3/conversations/threads/' + thread_id + '/messages/' + message_id + '/original-content',
      });
      const message_json = await message_response.json();
      let message_text = message_json.text; 
      if (message_text.includes("word or phrase you searching for")) {
         // Do something here or save to output to use in later actions
         // Though HubSpot doesn't allow using the output in a branch action which is disappointing so you have to edit the record with it or do more custom code or such
         output_found = true;
      }  
  callback({
    outputFields: {
      output_found: output_found
    }
  });
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jun 2025 22:42:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Conversation-workflow-criteria-based-on-email-body/m-p/1170908#M3128</guid>
      <dc:creator>Doc2DocLending</dc:creator>
      <dc:date>2025-06-29T22:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Conversation workflow criteria based on email body</title>
      <link>https://community.hubspot.com/t5/Data-Hub/Conversation-workflow-criteria-based-on-email-body/m-p/1178160#M3151</link>
      <description>&lt;P&gt;yes we would like to be able to do this please so will upvote&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jul 2025 11:50:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/Data-Hub/Conversation-workflow-criteria-based-on-email-body/m-p/1178160#M3151</guid>
      <dc:creator>IDollimore</dc:creator>
      <dc:date>2025-07-18T11:50:43Z</dc:date>
    </item>
  </channel>
</rss>

