HubSpot / hubspot-php

HubSpot PHP API Client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to create ticket with associate email?

nitinupify opened this issue · comments

Hello
I want to create ticket using email and that ticket will display in particular user.
Also I want to add custom properties value in ticket. How can I do that?

i can not create ticket too.

passed array:
$property = array();
$property[0]['property'] = "hs_pipeline";
$property[0]['value'] = "0";
$property[1]['property'] = "hs_pipeline_stage";
$property[1]['value'] = "1";
$property[2]['property'] = "hubspot_owner_id";
$property[2]['value'] = $owner[$ext];
$property[3]['property'] = "subject";
$property[3]['value'] = $number;
$property[4]['property'] = "source_type";
$property[4]['value'] = "PHONE";
Response: {"status":"error","message":"Cannot create object with type: TICKET. The following required properties were missing: [hs (truncated...)

i have no idea, why error occured,

@BatunaAz, it says it in your response. You're missing required params.

if i use node API it works for passed params. Only PHP packages return this error.

commented

Hi @BatunaAz
for me it works correctly with your properties

$hubspot = Factory::createWithOAuth2Token('*');
$response = $hubspot->tickets()->create([
    [
        'name' => 'subject',
        'value' => 'Ticket api v2',
    ],
    [
        'name' => 'source_type',
        'value' => 'PHONE',
    ],
    [
        'name' => 'hubspot_owner_id',
        'value' => '*',
    ],
    [
        'name' => 'hs_pipeline',
        'value' => '0',
    ],
    [
        'name' => 'hs_pipeline_stage',
        'value' => '1',
    ],
]);
commented

Hi @nitinupify
you can create an custom property using CRM Object Properties API

$hubspot = Factory::createWithOAuth2Token('*');
$response = $hubspot->objectProperties('tickets')->create($property)

you can create an ticket using Tickets API

$hubspot = Factory::createWithOAuth2Token('*');
$response = $hubspot->tickets()->create($ticket)