APIs & Integrations

KPadhiyar
Participant

Create workflow using API in PHP

SOLVE

Hello, I'm using the hubspot-api-php 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.

1 Accepted solution
GRajput
Solution
Recognized Expert | Platinum Partner
Recognized Expert | Platinum Partner

Create workflow using API in PHP

SOLVE

Hi @KPadhiyar 

 

Here is the link to the workflow API. They are in the BETA version right now but you can use them

https://developers.hubspot.com/docs/api/automation/workflows

 

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!

 

 




Gaurav Rajput
Director, MarTech( Growth Natives)

Book a meeting


View solution in original post

0 Upvotes
2 Replies 2
GRajput
Solution
Recognized Expert | Platinum Partner
Recognized Expert | Platinum Partner

Create workflow using API in PHP

SOLVE

Hi @KPadhiyar 

 

Here is the link to the workflow API. They are in the BETA version right now but you can use them

https://developers.hubspot.com/docs/api/automation/workflows

 

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!

 

 




Gaurav Rajput
Director, MarTech( Growth Natives)

Book a meeting


0 Upvotes
KPadhiyar
Participant

Create workflow using API in PHP

SOLVE

@GRajput Thanks for your answer. But I've already done some code with it. It shows me internal error. 

 

 

 

$requestBody = [
  "type" => "CONTACT_FLOW",
  "name" => "Test WorkFlow",
  "description" => "Test WorkFlow",
  "canEnrollFromSalesforce" => false,
  "isEnabled" => true,
  "flowType" => "WORKFLOW",
  "actionId" => "1",
  "revisionId" => "1",
  "actionTypeVersion" => 0,
  "actionTypeId" => "0-3",
  "crmObjectCreationStatus" => "COMPLETE",
  "objectTypeId" => "0-1",
  "enrollmentCriteria" => [
    "shouldReEnroll" => true,
    "type" => "MANUAL"
  ],
  "actions" => [
    [
      "type" => "SINGLE_CONNECTION",
      "actionId" => "1",
      "actionTypeVersion" => 0,
      "actionTypeId" => "0-3",
      "fields" => [
        "task_type" => "TODO",
        "subject" => "Check in with lead",
        "body" => "<p>Remember to sync up with new lead!</p>",
        "use_explicit_associations" => "true",
        "priority" => "NONE"
      ]
    ]
  ]
];

$response = Http::withToken("access_token")
  ->accept("application/json")
  ->timeout(30)
  ->post("https://api.hubapi.com/automation/v4/flows", $requestBody);

$responseBody = $response->json();

 

 

 

I've tried the above code. Could you please suggest what I might be missing?

FYI: I've write code based on documetation.

0 Upvotes