Task creation fails with validation error on hs_timestamp property in v14.0
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 56/100
Direzione di ricerca
Inizia con SimplePublicObjectInputForCreate e con il client API specifico per Tasks menzionato nel report, quindi riproduci l’esempio di creazione di un’attività di v14.0. Confronta il corpo della richiesta dell’SDK con il payload HTTP diretto funzionante, concentrandoti sul fatto che hs_timestamp rimanga in properties. Il lavoro è considerato completato quando l’SDK crea correttamente un’attività con hs_timestamp e le associazioni esistenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
When attempting to create a task using the tasks()->basicApi()->create() method in version 14.0 of the PHP SDK, the API consistently returns a 400 validation error indicating that the required property hs_timestamp was not set, even though it is correctly included in the properties array.
The same payload works perfectly when sent directly via HTTP client (e.g., Laravel's Http::post() or cURL), suggesting a serialization issue within the SDK when preparing the request for the Tasks endpoint.
Environment:
- SDK Version:
hubspot/api-clientv14.0 - Endpoint:
POST /crm/v3/objects/tasks
Steps to Reproduce:
- Install
hubspot/api-clientv14.0 - Attempt to create a task using the SDK:
use HubSpot\Factory;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInputForCreate;
$client = Factory::createWithAccessToken($accessToken);
$properties = [
'hs_task_subject' => 'Task Example',
'hs_task_body' => 'Body text.',
'hs_timestamp' => '1781773200000', // Unix timestamp in milliseconds as string
'hs_task_status' => 'NOT_STARTED',
'hs_task_priority' => 'MEDIUM',
];
$associations = [
[
'to' => ['id' => '9392020334929'],
'types' => [
[
'associationCategory' => 'HUBSPOT_DEFINED',
'associationTypeId' => 204,
],
],
],
];
$taskInput = new SimplePublicObjectInputForCreate([
'properties' => $properties,
'associations' => $associations,
]);
$response = $client->crm()->objects()->tasks()->basicApi()->create($taskInput);
Expected Behavior:
The task should be created successfully and return the task object with an ID.
Actual Behavior:
The API returns a 400 Bad Request error:
{
"status": "error",
"message": "Error creating TASK. Some required properties were not set.",
"correlationId": "019ed794-77c0-746d-8db3-33e8de915f6e",
"context": {
"properties": ["hs_timestamp"]
},
"category": "VALIDATION_ERROR"
}
Tested Formats for hs_timestamp:
We tested multiple formats for hs_timestamp as documented in the HubSpot API, all failed with the SDK but worked via direct HTTP:
- ✅ String of Unix milliseconds:
"1781773200000"(works via HTTP, fails via SDK) - ✅ Integer Unix milliseconds:
1781773200000(works via HTTP, fails via SDK) - ✅ ISO 8601 with milliseconds:
"2026-06-18T09:00:00.000Z"(works via HTTP, fails via SDK) - ✅ ISO 8601 basic:
"2026-06-18T09:00:00+00:00"(works via HTTP, fails via SDK)
Workaround:
Using Laravel's HTTP client (or any direct HTTP library) instead of the SDK works perfectly:
$payload = [
'properties' => [
'hs_task_subject' => 'Task Example',
'hs_task_body' => 'Body text.',
'hs_timestamp' => '1781773200000',
'hs_task_status' => 'NOT_STARTED',
'hs_task_priority' => 'MEDIUM',
],
'associations' => [
[
'to' => ['id' => '9392020334929'],
'types' => [
[
'associationCategory' => 'HUBSPOT_DEFINED',
'associationTypeId' => 204,
],
],
],
],
];
$response = Http::withHeaders([
'Authorization' => 'Bearer ' . $accessToken,
'Content-Type' => 'application/json',
])->post('https://api.hubapi.com/crm/v3/objects/tasks', $payload);
// Returns 200 OK with task created successfully
Successful Response:
{
"id": "123123223232",
"properties": {
"hs_task_subject": "Task Example",
"hs_timestamp": "2026-06-18T09:00:00Z",
...
},
"createdAt": "2026-06-18T15:53:41.557Z",
...
}
Analysis:
The issue appears to be in how the SDK serializes the properties object when constructing the request body for the Tasks endpoint. The property is present in the PHP array but is not being correctly transmitted to the HubSpot API.
Other engagement types (notes, calls, emails, meetings) work correctly with the SDK using similar property structures, suggesting this is specific to the Tasks object type.
Additional Context:
- Other CRM object creation methods (contacts, notes, calls, emails, meetings) work correctly with the SDK
- The same HubSpot access token and portal work fine when using direct HTTP requests
- This issue blocks task automation workflows that rely on the SDK
Suggested Fix:
Investigate the serialization logic in SimplePublicObjectInputForCreate or the Tasks-specific API client to ensure properties are correctly encoded in the request body for the /crm/v3/objects/tasks endpoint.
- Lingua principale
- PHP
- Stelle
- 242
- Fork
- 92
- Merge medio
- 1g 3h
- PR unite (30g)
- 4
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di HubSpot/hubspot-api-php
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
HubSpot/hubspot-api-php#619 · 2 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
HubSpot/hubspot-api-php#617 · 1 commento · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
HubSpot/hubspot-api-php#523 · 1 commento ·
-
Missing CRM Orders APIAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
HubSpot/hubspot-api-php#508 · 1 commento · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
HubSpot/hubspot-api-php#504 · 1 commento · 2 reazioni ·
Tutte le issue di HubSpot/hubspot-api-php
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
scanaislop/aislop#482 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
humanmade/publication-checklist#73 · 1 commento ·
-
Do not throw `WordPress.Security.EscapeOutput.OutputNotEscaped` on `apply_shortcodes()`Forse già presa @tbradsha l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100