<?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: Handling a Custom Code if it fails in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Handling-a-Custom-Code-if-it-fails/m-p/800045#M64430</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/570610"&gt;@crossm98&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074"&gt;@Jaycee_Lewis&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;easiest option I can see off the top of my head would be to include a step either in the same or in a separate code step to send a JSON payload in order to post a slack message if the original code has failed. Slack has an API so you could post a message to a channel there readily enough. You can find some support for this online:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/50187220/is-there-any-way-to-post-a-webhook-using-javascript" target="_blank"&gt;https://stackoverflow.com/questions/50187220/is-there-any-way-to-post-a-webhook-using-javascript&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;There might be a more elegant solution, if you manage to feed the state into an if/else branching in the workflow and then send a message and finish / continue the rest of your workflow.&amp;nbsp;&lt;A href="https://knowledge.hubspot.com/workflows/use-if-then-branches-in-workflows" target="_blank"&gt;https://knowledge.hubspot.com/workflows/use-if-then-branches-in-workflows&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Matthias&lt;/P&gt;</description>
    <pubDate>Mon, 29 May 2023 07:45:12 GMT</pubDate>
    <dc:creator>MatthiasKunz</dc:creator>
    <dc:date>2023-05-29T07:45:12Z</dc:date>
    <item>
      <title>Handling a Custom Code if it fails</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Handling-a-Custom-Code-if-it-fails/m-p/795637#M64110</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I have built a custom code in a workflow. My goal is, if the custom code fails (a.k.a.&amp;nbsp;hs_execution_state != Succeeded), I want the workflow to send a Slack notification, and then finish. If not, I want the workflow to continue its course.&lt;BR /&gt;&lt;BR /&gt;Is that possible?&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 14:38:29 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Handling-a-Custom-Code-if-it-fails/m-p/795637#M64110</guid>
      <dc:creator>crossm98</dc:creator>
      <dc:date>2023-05-18T14:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Handling a Custom Code if it fails</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Handling-a-Custom-Code-if-it-fails/m-p/796446#M64186</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/570610"&gt;@crossm98&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thanks for your question. To check my understanding, is your goal to have a form of an If/then statement after your custom code executes? Based on the outcome? &lt;EM&gt;If&lt;/EM&gt; the code fails, then send the Slack notification. Is that correct?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I looked at the documentation here,&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/api/workflows/custom-code-actions" target="_blank" rel="noopener"&gt;Custom code workflow actions,&lt;/A&gt;&amp;nbsp;but didn't find a great match for what you are describing.&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hey,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/166093"&gt;@miljkovicmisa&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/539078"&gt;@MatthiasKunz&lt;/a&gt;, do you have any custom-coded thoughts or suggestions &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt; for&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/570610"&gt;@crossm98&lt;/a&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much! — Jaycee&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 20:32:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Handling-a-Custom-Code-if-it-fails/m-p/796446#M64186</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2023-05-19T20:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Handling a Custom Code if it fails</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Handling-a-Custom-Code-if-it-fails/m-p/797096#M64216</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074"&gt;@Jaycee_Lewis&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;That's precisely what I'm looking for. Make the custom code run. If it fails, send a slack notification and finish. If it runs correctly, continue the workflow.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 14:10:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Handling-a-Custom-Code-if-it-fails/m-p/797096#M64216</guid>
      <dc:creator>crossm98</dc:creator>
      <dc:date>2023-05-22T14:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: Handling a Custom Code if it fails</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Handling-a-Custom-Code-if-it-fails/m-p/800045#M64430</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/570610"&gt;@crossm98&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074"&gt;@Jaycee_Lewis&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;easiest option I can see off the top of my head would be to include a step either in the same or in a separate code step to send a JSON payload in order to post a slack message if the original code has failed. Slack has an API so you could post a message to a channel there readily enough. You can find some support for this online:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/50187220/is-there-any-way-to-post-a-webhook-using-javascript" target="_blank"&gt;https://stackoverflow.com/questions/50187220/is-there-any-way-to-post-a-webhook-using-javascript&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;There might be a more elegant solution, if you manage to feed the state into an if/else branching in the workflow and then send a message and finish / continue the rest of your workflow.&amp;nbsp;&lt;A href="https://knowledge.hubspot.com/workflows/use-if-then-branches-in-workflows" target="_blank"&gt;https://knowledge.hubspot.com/workflows/use-if-then-branches-in-workflows&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Matthias&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 07:45:12 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Handling-a-Custom-Code-if-it-fails/m-p/800045#M64430</guid>
      <dc:creator>MatthiasKunz</dc:creator>
      <dc:date>2023-05-29T07:45:12Z</dc:date>
    </item>
  </channel>
</rss>

