<?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 Create workflow using API in PHP in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Create-workflow-using-API-in-PHP/m-p/1030061#M76007</link>
    <description>&lt;P&gt;Hello, I'm using the &lt;A href="https://github.com/HubSpot/hubspot-api-php" target="_blank" rel="noopener"&gt;hubspot-api-php&lt;/A&gt; package to interact with HubSpot in the Laravel framework. However, I can't seem to find the Workflow API. Can anyone suggest how to perform operations with workflows similar to how I interact with HubSpot objects? I am able to interact with HubSpot objects, but I need guidance on working with workflows.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2024 08:02:55 GMT</pubDate>
    <dc:creator>KPadhiyar</dc:creator>
    <dc:date>2024-08-21T08:02:55Z</dc:date>
    <item>
      <title>Create workflow using API in PHP</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-workflow-using-API-in-PHP/m-p/1030061#M76007</link>
      <description>&lt;P&gt;Hello, I'm using the &lt;A href="https://github.com/HubSpot/hubspot-api-php" target="_blank" rel="noopener"&gt;hubspot-api-php&lt;/A&gt; package to interact with HubSpot in the Laravel framework. However, I can't seem to find the Workflow API. Can anyone suggest how to perform operations with workflows similar to how I interact with HubSpot objects? I am able to interact with HubSpot objects, but I need guidance on working with workflows.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 08:02:55 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-workflow-using-API-in-PHP/m-p/1030061#M76007</guid>
      <dc:creator>KPadhiyar</dc:creator>
      <dc:date>2024-08-21T08:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create workflow using API in PHP</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-workflow-using-API-in-PHP/m-p/1030307#M76024</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/813499"&gt;@KPadhiyar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is the link to the workflow API. They are in the BETA version right now but you can use them&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://developers.hubspot.com/docs/api/automation/workflows" target="_blank"&gt;https://developers.hubspot.com/docs/api/automation/workflows&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this will help you out. Please mark it as &lt;STRONG&gt;Solution Accepted and upvote&lt;/STRONG&gt; to help another Community member. &lt;BR /&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 15:14:46 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-workflow-using-API-in-PHP/m-p/1030307#M76024</guid>
      <dc:creator>GRajput</dc:creator>
      <dc:date>2024-08-21T15:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Create workflow using API in PHP</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Create-workflow-using-API-in-PHP/m-p/1030611#M76039</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/346639"&gt;@GRajput&lt;/a&gt;&amp;nbsp;Thanks for your answer. But I've already done some code with it. It shows me internal error.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="php"&gt;$requestBody = [
  "type" =&amp;gt; "CONTACT_FLOW",
  "name" =&amp;gt; "Test WorkFlow",
  "description" =&amp;gt; "Test WorkFlow",
  "canEnrollFromSalesforce" =&amp;gt; false,
  "isEnabled" =&amp;gt; true,
  "flowType" =&amp;gt; "WORKFLOW",
  "actionId" =&amp;gt; "1",
  "revisionId" =&amp;gt; "1",
  "actionTypeVersion" =&amp;gt; 0,
  "actionTypeId" =&amp;gt; "0-3",
  "crmObjectCreationStatus" =&amp;gt; "COMPLETE",
  "objectTypeId" =&amp;gt; "0-1",
  "enrollmentCriteria" =&amp;gt; [
    "shouldReEnroll" =&amp;gt; true,
    "type" =&amp;gt; "MANUAL"
  ],
  "actions" =&amp;gt; [
    [
      "type" =&amp;gt; "SINGLE_CONNECTION",
      "actionId" =&amp;gt; "1",
      "actionTypeVersion" =&amp;gt; 0,
      "actionTypeId" =&amp;gt; "0-3",
      "fields" =&amp;gt; [
        "task_type" =&amp;gt; "TODO",
        "subject" =&amp;gt; "Check in with lead",
        "body" =&amp;gt; "&amp;lt;p&amp;gt;Remember to sync up with new lead!&amp;lt;/p&amp;gt;",
        "use_explicit_associations" =&amp;gt; "true",
        "priority" =&amp;gt; "NONE"
      ]
    ]
  ]
];

$response = Http::withToken("access_token")
  -&amp;gt;accept("application/json")
  -&amp;gt;timeout(30)
  -&amp;gt;post("https://api.hubapi.com/automation/v4/flows", $requestBody);

$responseBody = $response-&amp;gt;json();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I've tried the above code. Could you please suggest what I might be missing?&lt;BR /&gt;&lt;BR /&gt;FYI: I've write code based on documetation.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Aug 2024 03:24:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Create-workflow-using-API-in-PHP/m-p/1030611#M76039</guid>
      <dc:creator>KPadhiyar</dc:creator>
      <dc:date>2024-08-22T03:24:25Z</dc:date>
    </item>
  </channel>
</rss>

