hubspot-net / hubspot.net Goto Github PK
View Code? Open in Web Editor NEWC# .NET Wrapper around the common HubSpot APIs.
License: MIT License
C# .NET Wrapper around the common HubSpot APIs.
License: MIT License
Hello,
I'm currently starting out on integrating with HubSpot and decided to use this project, but straight away have found the nuget doesn't contain implementation for OAuth2. (Last updated Aug 2018). I can see the README shows an example using a OAuth connection. So its unclear if this project is still active. If it is, is it recommended to clone the repo directly and is it in a good state to use in a production environment?
Thanks
Hi,
any plans on making this package dotnet core friendly ?
warning NU1701: Package 'SquaredUp.HubSpot.NET 0.6.17' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.2'. This package may not be fully compatible with your project.
The HubSpotDealApi.Update()
method is no longer operating on the same PUT payload schema as is documented here. Instead the payload should be an array of NameValuePair
s.
How to add contact to deal?
when i create deal i cant add contacts Because "Associations" in "DealHubSpotModel" is read only, so i cant set contacts.
so... how i can add contact to new deal?
With Search by Custom Property for Contacts now generally available, is there an ETA for HubSpot.NET inclusion of that API feature?
https://developers.hubspot.com/changelog/crm-api-v3-developer-preview-is-now-available
I have restsharp version 106.6.9. When I try to run a HubSpot call I get the following error:
Could not load file or assembly 'RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Code example:
var api = new HubSpot.NET.Core.HubSpotApi("key-goes-here");
var contact = api.Contact.Create(new HubSpot.NET.Api.Contact.Dto.ContactHubSpotModel()
{
Email = "[email protected]",
FirstName = "John",
LastName = "Smith",
Phone = "00000 000000",
Company = "Squared Up Ltd."
});
Can this package be made to run with the latest RestSharp? I can't downgrade as I won't be able to run other NuGet packages I have installed.
Thanks.
As a test I set the deals limit to 10 and the PropertiesToInclude to match the example code { "dealname", "amount" }.
When I look at the object containing the value of MoreResultsAvailable is always false even when there are more records. The data I am looking at has 500+ deals in it.
To track down where the problem occurs I cloned the repository and stepped through a call to api.Deal.List. When it gets to the HubSpotBaseClient's SendRequest method with the following signature:
private T SendRequest(string path, Method method, string json, Func<string, T> deserializeFunc) where T : IHubSpotModel, new()
the value of responseData's "hasMore" property is true before deserializeFunc is called.
To verify this I used Postman and performed the same API call with the same parameters and values.
The value of "hasMore" and "offset" match at this point.
Just wondering if there's any future plans for the implementation of the CRM associations? Looking into linking a company as a child to another company.
Cheers
Is there any HubSpot Product Library support (Search, List) in HubsSpot.Net? Thanks.
When calling HubSpotDealApi.List with includeAssociations set to true the associations are always null.
Tracked it down to a misspelled query parameter in HubSpotDealApi's List method:
"includeAssocations"
It should be:
"includeAssociations"
Any plans for async / await in this package ?
https://developers.hubspot.com/docs/methods/calendar/create-task
I'm specifically looking to create a calendar task.
Hi is it possible to add timestamp to this class, it is used to set as due date.
It is currently "associatedCompanyId" and needs to be "associatedcompanyid".
I am using verson 0.6.17 (installed today from NuGet) in combination with .Net 4.6.1.
Some API's are not available. Eg. HubSpotTimelineApi and HubSpotEmailEventsApi
Are these not supported in the .Net 4.6.1 version?
Was this exception intended to be handled via try/catch (as I am currently doing), or am I doing something wrong? The method works as expected when the e-mail belongs to an existing Contact.
By the way, I am referring to the following method in the Contacts API:
T GetByEmail<T>(string email) where T : ContactHubSpotModel, new();
Thanks in advance for your assistance.
This is for the v1-preview branch...
When trying to create (or CreateorUpdate) I'm getting an error back from the REST response saying "Property \"properties\" does not exist","error":"PROPERTY_DOESNT_EXIST","name":"properties"}],"status":"error","message":"Property values were not valid"...
It looks like the properties data member is being included for the Contact when sending off the JSON.
@clarkd I have made some changes to how the List()-methods work. Mainly making the return type for example ContactListHubSpotModel Instead of ContactListHubSpotModel for the returning list. For this to work I have also made the list-classes take a type as a parameter for the contained entity-class.
This is to allow listings of your own entity-classes with custom properties and stuff, without needing to create a list-class. I might have overlooked the need for creating your own list-class though.
Do you want me to make a pull request?
Hello @clarkd,
Would you guys be open to accepting a PR that adds support for the Timeline Events API?
Can you add a timestamp to when the engagement was created?
In the example:
api.Engagement.Create(new EngagementHubSpotModel()
{
Engagement = new EngagementHubSpotEngagementModel()
{
Type = "EMAIL",
},
Metadata = new
{
**from{ email = "[email protected]" },
to { email = "[email protected]" },**
subject = "Can someone help me out.",
html = "This is the html body"
},
Associations = new EngagementHubSpotAssociationsModel()
{
ContactIds = new List<long>() { 1111 }
}
});
HubSpot documentation for Get All Deals describes the Limit optional parameter as defaulting to 100 but has a maximum value of 250.
When I retrieve all deals with a limit of 250 using HubSpot.NET an exception is thrown stating the following:
"Number of items to return must be a positive integer greater than 0, and less than 100 - you provided 250"
Hi
I Am trying to pull Associations.AssociatedCompany and Associations.AssociatedContacts data for all deals and these values are set to nothing, do you have some sample code to do this?
Paul
When getting recently updated deals the Hubspot API is looking for a parameter named 'count' from looking at the source it's attempting to set a parameter 'limit' - outcome is that no matter what 'limit' is passed in it's returning the default of 20 deals.
In the ContactHubSpotModel
the Properties dictionary is missing values when the model itself has a value
Example:
public string FirstName {
set {
_FirstName = value;
if (Properties.ContainsKey("firstname")) // no key available when Model's value set before sending DTO
Properties["firstname"].Value = value; // will be null when sent to HubSpot
}
get
{
if(string.IsNullOrWhiteSpace(_FirstName))
{ _FirstName = Properties.ContainsKey("firstname") ? Properties["firstname"].Value : string.Empty; }
return _FirstName;
}
}
Repro Steps:
Just simply try to use the Create()
example provided in the Examples assembly
Describe the bug
In all cases, the ContactHubSpotModel.Email property is null, although I am certain that each contact has a valid e-mail address. LastName and FirstName give normal response
Repro Steps
foreach (ContactHubSpotModel contact in result.Contacts)
{
Console.WriteLine($"{contact.FirstName} {contact.LastName} {contact.Email}");
}
Console.ReadLine();
Expected behavior
Return the e-mail address as registered in HubSpot
Screenshots
Anything else?*
I am new to HubSpot (integration)
email = "[email protected]"
var api = new HubSpotApi(hubspotApiKey);
var contact = api.Contact.GetByEmail(email);
here the contact variable throws exception right away, is there any way we use this api to just perform search to check if this email address exist already or not without throwing exception. Since hubspot doesn't allow duplication or overriding so in order for the application to thrown exception, I want to implement alogic to check if contact already exist or not. Thanks in advance
Hi. This is a fantastic wrapper, so thank you. I am, however, trying to create a deal and associate it with a contact and company, but your deal model doesn’t allow me to add contact and company long[] arrays and assign them to the Associations property. Any assistance you could provide would be appreciated.
Could you please release the latest version to NuGet, so it is netstandard2.0 compatible? Thank you.
Describe the bug
The best overload for 'Execute' does not have a parameter named 'convertToPropertiesSchema' HubSpot.NET (netstandard2.0) HubSpot.NET\HubSpot.NET\Api\EmailEvents\HubSpotEmailEventsApi.cs 34
'IHubSpotClient' does not contain a definition for 'ExecuteList' and no accessible extension method 'ExecuteList' accepting a first argument of type 'IHubSpotClient' could be found (are you missing a using directive or an assembly reference?) HubSpot.NET (netstandard2.0) HubSpot.NET\HubSpot.NET\Api\EmailEvents\HubSpotEmailEventsApi.cs 59
Repro Steps
clone the master branch and then build the solution
Expected behavior
the solution should build without errors
Anything else?*
I'm trying to use a version that supports OAuth, but the version in the NuGet repo doesn't.
How do you get all companies?
According to the documentation, there is the ability to view associated Deals on a deal. We need to support this option.
The ReflectionExtensions
class does not have any references outside of it self. Since v1 will be changing the serialization strategy/methodology entirely, these might not be needed at all.
Thoughts?
Hi, Love the wrapper great work.
How ever I can't seem to set a owner ID on api.Engagement.Create
I'm settings the ownerID in associates section
//Owner ID long value = 31750148
Associations = new EngagementHubSpotAssociationsModel()
{
OwnerIds = new List<long>() { ownerid },
ContactIds = new List<long>() { contact.Id.Value },
},
In Hubspot it says "A user logged a call with ...."
Is it just me? any advice would be much appreciated.
Hey small question,
Using the ContactHubSpotModel I am able to retrieve the variable "Phone"
var contacts = api.Contact.List<ContactHubSpotModel>(new ListRequestOptions { PropertiesToInclude = new List<string> { "firstname", "lastname", "email", "phone" } });
How hard would it be to access the "Mobile Phone Number" property?
Cheers,
HubSpot api has endpoint as specified here: https://developers.hubspot.com/docs/methods/contacts/batch_create_or_update
to create multiple contacts in one request
When retrieving Deals the ContinuationOffset property is a long while in the ListRequestOptions parameter Offset is a nullable int.
What was the original intent for the IsNameValue
property on IHubSpotModel
? I couldn't find anywhere that is was being used.
New to C# and .Net platform. Is it easy to target this library to dotnet core as well?
Is there a function here which will process the JSON from a POST webhook triggered by a Hubspot Workflow? I want to be able to extract all the info related to the webhook.
Describe the bug
After installing the Nuget package here, I am unable to create a new HubSpotApi project using the OAuth authentication mechanism. I am only able to create the object using an api key, which is not as secure as OAuth.
Repro Steps
Expected behavior
Two options available when creating a new HubSpotApi object.
On the HubSpot web site the Deal Name, Pipeline and Deal Stage are required fields when creating a deal. Unfortunately unless explicitly specified as a required field in settings a deal amount is not required.
While testing Deals in the example project I found a deal without an amount and an exception was thrown: "Input string was not in a correct format".
We don't currently have any unit tests - with API wrappers like this, they can be difficult to add as you'd have to mock the HubSpot API.
But... we could look at using the HubSpot demo instance (they provide a demo API key etc.) so we could make actual API calls etc.
Any thoughts?
Very useful library. Would be extremely great if it was compatible with .NET standard for use from .Net core and UWP apps
Instead of needing to called ToString()
on non string parameters, there should be strongly typed overloads to allow other parameter types to be used.
Is there a way to get only newly created contacts or updated contacts?
Looks like HubSpot will have Search by custom properties. Will HubSpot.NET eventually provide this?
I can create a new deal with a contact, that works great but when attempting to use the deal update and try to add a contact I am missing something.
code snippet:
var deal=api.Deal.GetById(dealId);
var contact = api.Contact.GetByEmail(contact.Email);
deal.Associations.AssociatedContacts=new []{contact.Id.Value};
api.Deal.Update(deal);
This succeeds but when I check hubspot there is no associated contact
I don't think this class is actually being helpful. Here is our code:
public static class RestSharpExtensions
{
public static bool IsSuccessful(this IRestResponse response)
{
return (int) response.StatusCode >= 200
&& (int) response.StatusCode <= 299
&& response.ResponseStatus == ResponseStatus.Completed;
}
}
and here is the IsSuccessful
method from RestSharp Response class directly
public bool IsSuccessful => (int) StatusCode >= 200 && (int) StatusCode <= 299 &&
ResponseStatus == ResponseStatus.Completed;
These do the exact same thing. So it would be best to drop this class entirely unless there is a need for it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.