Add message from custom web form via API into new deal

I currently have this code, based on this example :

$api_token = 'xxxxxxxx';
$company_domain = 'xxxxxx';
$pipedrive_url = 'https://'.$company_domain.'.pipedrive.com/v1/deals?api_token=' . $api_token;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $pipedrive_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
$deal = array(
 'title' => 'title',
 'stage_id' => '1'
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $deal);		
echo 'Sending request...' . PHP_EOL;
$output = curl_exec($ch);
curl_close($ch);
$result = json_decode($output, true);
if (!empty($result['data']['id'])) {
 echo 'Deal was added successfully!' . PHP_EOL;
}

This correctly creates a new deal with a title. I want to pass the message value to the deal details. In the API docs I do not see what fields I need to pass to create a details field.

Can you guys give me any guidance?

08%20pm

Hi @aleks,

Any Custom Field for an item would go under Details so it’s just a matter of creating that Field (outside of the default Fields). So to create Deal Field you would use POST /dealFields