Skip to main content
Upsert Opportunity
POST https://services.leadconnectorhq.com/opportunities/upsert

Autorización

Authorization
string
required
Bearer token generado desde el portal Leadway. Ver Autenticación.
Version
string
default:"2021-07-28"
required
Versión de la API.

Body

id
string
default:"yWQobCRIhRguQtD2llvk"
opportunityId
pipelineId
string
default:"bCkKGpDsyPP4peuKowkG"
required
pipeline Id
locationId
string
default:"CLu7BaljjqrEjBGKTNNe"
required
locationId
followers
string[]
default:"LiKJ2vnRg5ETM8Z19K7"
required
contactId
isRemoveAllFollowers
boolean
default:"True"
required
isRemoveAllFollowers
followersActionType
string
default:"add"
required
followers action type Posibles valores: ‘add’, ‘remove’
name
string
default:"opportunity name"
name
status
string
Posibles valores: ‘open’, ‘won’, ‘lost’, ‘abandoned’, ‘all’
pipelineStageId
string
default:"7915dedc-8f18-44d5-8bc3-77c04e994a10"
monetaryValue
object
default:"220"
assignedTo
string
default:"082goXVW3lIExEQPOnd3"
lostReasonId
string
default:"CLu7BaljjqrEjBGKTNNe"
lost reason Id

Respuestas

opportunity
object
required
Updated / New Opportunity
new
boolean
default:"True"
required
{
  "opportunity": {},
  "new": true
}
{}
{}
{}

Ejemplo

curl -X POST 'https://services.leadconnectorhq.com/opportunities/upsert' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "yWQobCRIhRguQtD2llvk",
  "pipelineId": "bCkKGpDsyPP4peuKowkG",
  "locationId": "CLu7BaljjqrEjBGKTNNe",
  "followers": "LiKJ2vnRg5ETM8Z19K7",
  "isRemoveAllFollowers": true,
  "followersActionType": "add",
  "name": "opportunity name",
  "status": "open",
  "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10",
  "monetaryValue": 220,
  "assignedTo": "082goXVW3lIExEQPOnd3",
  "lostReasonId": "CLu7BaljjqrEjBGKTNNe"
}'
const response = await fetch('https://services.leadconnectorhq.com/opportunities/upsert', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
    Version: '2021-07-28',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"id": "yWQobCRIhRguQtD2llvk", "pipelineId": "bCkKGpDsyPP4peuKowkG", "locationId": "CLu7BaljjqrEjBGKTNNe", "followers": "LiKJ2vnRg5ETM8Z19K7", "isRemoveAllFollowers": true, "followersActionType": "add", "name": "opportunity name", "status": "open", "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10", "monetaryValue": 220, "assignedTo": "082goXVW3lIExEQPOnd3", "lostReasonId": "CLu7BaljjqrEjBGKTNNe"}),
});
const data = await response.json();
import os, requests
response = requests.request(
    'POST',
    'https://services.leadconnectorhq.com/opportunities/upsert',
    headers={
        'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
        'Version': '2021-07-28',
        'Content-Type': 'application/json',
    },
    json={"id": "yWQobCRIhRguQtD2llvk", "pipelineId": "bCkKGpDsyPP4peuKowkG", "locationId": "CLu7BaljjqrEjBGKTNNe", "followers": "LiKJ2vnRg5ETM8Z19K7", "isRemoveAllFollowers": true, "followersActionType": "add", "name": "opportunity name", "status": "open", "pipelineStageId": "7915dedc-8f18-44d5-8bc3-77c04e994a10", "monetaryValue": 220, "assignedTo": "082goXVW3lIExEQPOnd3", "lostReasonId": "CLu7BaljjqrEjBGKTNNe"},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/opportunities/upsert');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
        'Version: 2021-07-28',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode({'id': 'yWQobCRIhRguQtD2llvk', 'pipelineId': 'bCkKGpDsyPP4peuKowkG', 'locationId': 'CLu7BaljjqrEjBGKTNNe', 'followers': 'LiKJ2vnRg5ETM8Z19K7', 'isRemoveAllFollowers': true, 'followersActionType': 'add', 'name': 'opportunity name', 'status': 'open', 'pipelineStageId': '7915dedc-8f18-44d5-8bc3-77c04e994a10', 'monetaryValue': 220, 'assignedTo': '082goXVW3lIExEQPOnd3', 'lostReasonId': 'CLu7BaljjqrEjBGKTNNe'}),
]);
$data = json_decode(curl_exec($ch), true);