Hi,
It’s been several days I’m trying to create and update deals pipeline via the API. After contacting the support several times, they asked me to post in this forum, so here I am.
Summary: The Deprecated Deals pipelines API works to create a pipeline, but not to update it. The new CRM Pipeline API do not work to create a pipeline, but works to update a pipeline (but after the update, everything return 500 errors). Integrating contacts and companies API in my app was easy, deal pipelines it’s just a nightmare because there is so many things broken.
Find below several steps
1 - Create a deal pipeline according to the documentation (https://developers.hubspot.com/docs/methods/pipelines/create_new_pipeline)
<- "POST /crm-pipelines/v1/pipelines/deals HTTP/1.1\r\nAuthorization: Bearer CLfoocr4LBICQQEYrsy-AiCY3ukCKOSQCzIZAP4E6-cKglIuOPwS8awnMzzAOyCKHwYaKjoPAAoCRwAADIADAAgAAAABQhkA_gTr55tGOVFXBz16a4wwsE1OF3Y1M7xa\r\nContent-Type: application/json\r\nConnection: close\r\nHost: api.hubapi.com\r\nContent-Length: 258\r\n\r\n"
<- "{\"pipelineId\":\"api_test_pipeline\",\"label\":\"API test pipeline\",\"displayOrder\":1,\"active\":true,\"stages\":[{\"stageId\":\"example_stage\",\"label\":\"Example stage\",\"displayOrder\":1},{\"stageId\":\"another_example_stage\",\"label\":\"Another example stage\",\"displayOrder\":2}]}"
-> "HTTP/1.1 400 Bad Request\r\n"
-> "Date: Fri, 07 Dec 2018 09:31:49 GMT\r\n"
-> "Content-Type: application/json;charset=utf-8\r\n"
-> "Content-Length: 80\r\n"
-> "Connection: close\r\n"
-> "Set-Cookie: __cfduid=d605d1dcf202d00e60fc7822285fb15751544175109; expires=Sat, 07-Dec-19 09:31:49 GMT; path=/; domain=.hubapi.com; HttpOnly\r\n"
-> "Vary: Accept-Encoding\r\n"
-> "Access-Control-Allow-Credentials: false\r\n"
-> "Strict-Transport-Security: max-age=31536000; includeSubDomains; preload\r\n"
-> "Expect-CT: max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"\r\n"
-> "Server: cloudflare\r\n"
-> "CF-RAY: 4855fb3f9e9a4451-BRU\r\n"
-> "\r\n"
reading 80 bytes...
-> "{\"status\":\"error\",\"message\":\"must specify probability when writing a dealstage\"}"
read 80 bytes
Conn close
=> {"status"=>"error", "message"=>"must specify probability when writing a dealstage"}
probability is not in the documentation, but ok let’s try it…
2 - Create a deal pipeline with probability in stages
<- "POST /crm-pipelines/v1/pipelines/deals HTTP/1.1\r\nAuthorization: Bearer CLfoocr4LBICQQEYrsy-AiCY3ukCKOSQCzIZAP4E6-cKglIuOPwS8awnMzzAOyCKHwYaKjoPAAoCRwAADIADAAgAAAABQhkA_gTr55tGOVFXBz16a4wwsE1OF3Y1M7xa\r\nContent-Type: application/json\r\nConnection: close\r\nHost: api.hubapi.com\r\nContent-Length: 292\r\n\r\n"
<- "{\"pipelineId\":\"api_test_pipeline\",\"label\":\"API test pipeline\",\"displayOrder\":1,\"active\":true,\"stages\":[{\"stageId\":\"example_stage\",\"label\":\"Example stage\",\"probability\":0.1,\"displayOrder\":1},{\"stageId\":\"another_example_stage\",\"label\":\"Another example stage\",\"probability\":1,\"displayOrder\":2}]}"
-> "HTTP/1.1 400 Bad Request\r\n"
-> "Date: Fri, 07 Dec 2018 09:34:16 GMT\r\n"
-> "Content-Type: application/json;charset=utf-8\r\n"
-> "Content-Length: 80\r\n"
-> "Connection: close\r\n"
-> "Set-Cookie: __cfduid=da7f1aafd726ef9a5e877a45b585a365f1544175256; expires=Sat, 07-Dec-19 09:34:16 GMT; path=/; domain=.hubapi.com; HttpOnly\r\n"
-> "Vary: Accept-Encoding\r\n"
-> "Access-Control-Allow-Credentials: false\r\n"
-> "Strict-Transport-Security: max-age=31536000; includeSubDomains; preload\r\n"
-> "Expect-CT: max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"\r\n"
-> "Server: cloudflare\r\n"
-> "CF-RAY: 4855fed99d72445d-BRU\r\n"
-> "\r\n"
reading 80 bytes...
-> "{\"status\":\"error\",\"message\":\"must specify probability when writing a dealstage\"}"
read 80 bytes
Conn close
=> {"status"=>"error", "message"=>"must specify probability when writing a dealstage"}
Same error !
3 - Creating a deal pipeline with the Deprecated API (It works…) (Accounts Dashboard | HubSpot)
<- "POST /deals/v1/pipelines HTTP/1.1\r\nAuthorization: Bearer CLfoocr4LBICQQEYrsy-AiCY3ukCKOSQCzIZAP4E6-cKglIuOPwS8awnMzzAOyCKHwYaKjoPAAoCRwAADIADAAgAAAABQhkA_gTr55tGOVFXBz16a4wwsE1OF3Y1M7xa\r\nContent-Type: application/json\r\nConnection: close\r\nHost: api.hubapi.com\r\nContent-Length: 245\r\n\r\n"
<- "{\"label\":\"API test pipeline\",\"displayOrder\":1,\"stages\":[{\"stageId\":\"example_stage\",\"label\":\"Example stage\",\"probability\":0.1,\"displayOrder\":1},{\"stageId\":\"another_example_stage\",\"label\":\"Another example stage\",\"probability\":1,\"displayOrder\":2}]}"
-> "HTTP/1.1 200 OK\r\n"
-> "Date: Fri, 07 Dec 2018 09:38:34 GMT\r\n"
-> "Content-Type: application/json;charset=utf-8\r\n"
-> "Transfer-Encoding: chunked\r\n"
-> "Connection: close\r\n"
-> "Set-Cookie: __cfduid=d8c662b8abd00d973b15f95fe74d4b98a1544175514; expires=Sat, 07-Dec-19 09:38:34 GMT; path=/; domain=.hubapi.com; HttpOnly\r\n"
-> "X-Trace: 2BFD4E79F9F489B9CD4C7BD041BAA21EB058D5DEBD000000000000000000\r\n"
-> "Access-Control-Allow-Credentials: false\r\n"
-> "Strict-Transport-Security: max-age=31536000; includeSubDomains; preload\r\n"
-> "Expect-CT: max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"\r\n"
-> "Server: cloudflare\r\n"
-> "CF-RAY: 485605261e17443f-BRU\r\n"
-> "\r\n"
-> "18e\r\n"
reading 398 bytes...
-> "{\"pipelineId\":\"1d296ef9-5755-48a7-99d7-829362b62a24\",\"stages\":[{\"stageId\":\"example_stage\",\"label\":\"Example stage\",\"probability\":0.1,\"active\":true,\"displayOrder\":1,\"closedWon\":false},{\"stageId\":\"another_example_stage\",\"label\":\"Another example stage\",\"probability\":1.0,\"active\":true,\"displayOrder\":2,\"closedWon\":true}],\"label\":\"API test pipeline\",\"active\":true,\"displayOrder\":1,\"staticDefault\":false}"
read 398 bytes
reading 2 bytes...
-> "\r\n"
read 2 bytes
-> "0\r\n"
-> "\r\n"
Conn close
=> {"pipelineId"=>"1d296ef9-5755-48a7-99d7-829362b62a24",
"stages"=>
[{"stageId"=>"example_stage", "label"=>"Example stage", "probability"=>0.1, "active"=>true, "displayOrder"=>1, "closedWon"=>false},
{"stageId"=>"another_example_stage", "label"=>"Another example stage", "probability"=>1.0, "active"=>true, "displayOrder"=>2, "closedWon"=>true}],
"label"=>"API test pipeline",
"active"=>true,
"displayOrder"=>1,
"staticDefault"=>false}
4 - Updating a deal pipeline (it works… but crash the UI and API)
<- "PUT /crm-pipelines/v1/pipelines/deals/1d296ef9-5755-48a7-99d7-829362b62a24 HTTP/1.1\r\nAuthorization: Bearer CLfoocr4LBICQQEYrsy-AiCY3ukCKOSQCzIZAP4E6-cKglIuOPwS8awnMzzAOyCKHwYaKjoPAAoCRwAADIADAAgAAAABQhkA_gTr55tGOVFXBz16a4wwsE1OF3Y1M7xa\r\nContent-Type: application/json\r\nConnection: close\r\nHost: api.hubapi.com\r\nContent-Length: 275\r\n\r\n"
<- "{\"label\":\"API test pipeline updated\",\"displayOrder\":1,\"active\":true,\"stages\":[{\"stageId\":\"example_stage_two\",\"label\":\"Example stage two\",\"probability\":0.1,\"displayOrder\":1},{\"stageId\":\"another_example_stage\",\"label\":\"Another example stage\",\"probability\":1,\"displayOrder\":2}]}"
-> "HTTP/1.1 200 OK\r\n"
-> "Date: Fri, 07 Dec 2018 09:46:17 GMT\r\n"
-> "Content-Type: application/json;charset=utf-8\r\n"
-> "Content-Length: 508\r\n"
-> "Connection: close\r\n"
-> "Set-Cookie: __cfduid=d8a4bb83e16d9c154a755e3b2131d4eac1544175976; expires=Sat, 07-Dec-19 09:46:16 GMT; path=/; domain=.hubapi.com; HttpOnly\r\n"
-> "Vary: Accept-Encoding\r\n"
-> "Access-Control-Allow-Credentials: false\r\n"
-> "Strict-Transport-Security: max-age=31536000; includeSubDomains; preload\r\n"
-> "Expect-CT: max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"\r\n"
-> "Server: cloudflare\r\n"
-> "CF-RAY: 485610703ba24439-BRU\r\n"
-> "\r\n"
reading 508 bytes...
-> "{\"pipelineId\":\"1d296ef9-5755-48a7-99d7-829362b62a24\",\"createdAt\":1544175514630,\"updatedAt\":1544175977085,\"objectType\":\"DEAL\",\"label\":\"API test pipeline updated\",\"displayOrder\":1,\"active\":true,\"stages\":[{\"stageId\":\"another_example_stage\",\"createdAt\":0,\"updatedAt\":1544175977085,\"label\":\"Another example stage\",\"displayOrder\":2,\"metadata\":{},\"active\":true},{\"stageId\":\"example_stage_two\",\"createdAt\":0,\"updatedAt\":null,\"label\":\"Example stage two\",\"displayOrder\":1,\"metadata\":{},\"active\":true}],\"default\":false}"
read 508 bytes
Conn close
=> {"pipelineId"=>"1d296ef9-5755-48a7-99d7-829362b62a24",
"createdAt"=>1544175514630,
"updatedAt"=>1544175977085,
"objectType"=>"DEAL",
"label"=>"API test pipeline updated",
"displayOrder"=>1,
"active"=>true,
"stages"=>
[{"stageId"=>"another_example_stage",
"createdAt"=>0,
"updatedAt"=>1544175977085,
"label"=>"Another example stage",
"displayOrder"=>2,
"metadata"=>{},
"active"=>true},
{"stageId"=>"example_stage_two", "createdAt"=>0, "updatedAt"=>nil, "label"=>"Example stage two", "displayOrder"=>1, "metadata"=>{}, "active"=>true}],
"default"=>false}
5 - UI is now broken (500 error)
[
Deals 2018-12-07 10-48-00.png1663x677 53.9 KB
6 - Get all deals pipelines API call is now broken (500 error)
<- "GET /crm-pipelines/v1/pipelines/deals HTTP/1.1\r\nAuthorization: Bearer CLfoocr4LBICQQEYrsy-AiCY3ukCKOSQCzIZAP4E6-cKglIuOPwS8awnMzzAOyCKHwYaKjoPAAoCRwAADIADAAgAAAABQhkA_gTr55tGOVFXBz16a4wwsE1OF3Y1M7xa\r\nContent-Type: application/json\r\nConnection: close\r\nHost: api.hubapi.com\r\n\r\n"
-> "HTTP/1.1 500 Internal Server Error\r\n"
-> "Date: Fri, 07 Dec 2018 09:51:35 GMT\r\n"
-> "Content-Type: application/json;charset=utf-8\r\n"
-> "Content-Length: 45\r\n"
-> "Connection: close\r\n"
-> "Set-Cookie: __cfduid=d49af3a691691de32295821fe4566ecfe1544176295; expires=Sat, 07-Dec-19 09:51:35 GMT; path=/; domain=.hubapi.com; HttpOnly\r\n"
-> "Vary: Accept-Encoding\r\n"
-> "Access-Control-Allow-Credentials: false\r\n"
-> "Strict-Transport-Security: max-age=31536000; includeSubDomains; preload\r\n"
-> "Expect-CT: max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"\r\n"
-> "Server: cloudflare\r\n"
-> "CF-RAY: 48561838984d446f-BRU\r\n"
-> "\r\n"
reading 45 bytes...
-> "{\"status\":\"error\",\"message\":\"internal error\"}"
read 45 bytes
Conn close
=> {"status"=>"error", "message"=>"internal error"}
Can you please fix all of this and get back in touch with me ?
Regards
