How to fetch phoneNumber from contacts api and How to create an orderr

Empty

Hi @Vvamsi ,

How to fetch the phonenumber assuming you have a contact ID:

const hubspot = require('@hubspot/api-client');

const hubspotClient = new hubspot.Client({"apiKey":"YOUR_HUBSPOT_API_KEY"});

const contactId = "contactId";
const properties = [
 "phone"
];

try {
 const apiResponse = await hubspotClient.crm.contacts.basicApi.getById(contactId, properties);
 console.log(JSON.stringify(apiResponse.body, null, 2));
} catch (e) {
 e.message === 'HTTP request failed'
 ? console.error(JSON.stringify(e.response, null, 2))
 : console.error(e)
}

How to create an order (I assume you mean a deal?):

const hubspot = require('@hubspot/api-client');

const hubspotClient = new hubspot.Client({"apiKey":"YOUR_HUBSPOT_API_KEY"});

// Update the below (required) properties to match the data you want to store
const properties = {
 "amount": "1500.00",
 "closedate": "2019-12-07T16:50:06.678Z",
 "dealname": "Custom data integrations",
 "dealstage": "presentation scheduled",
 "hubspot_owner_id": "910901",
 "pipeline": "default"
};
const SimplePublicObjectInput = { properties };

try {
 const apiResponse = await hubspotClient.crm.deals.basicApi.create(SimplePublicObjectInput);
 console.log(JSON.stringify(apiResponse.body, null, 2));
} catch (e) {
 e.message === 'HTTP request failed'
 ? console.error(JSON.stringify(e.response, null, 2))
 : console.error(e)
}