skarpdev / dotnetcore-hubspot-client Goto Github PK
View Code? Open in Web Editor NEWDotnet core HubSpot client
License: MIT License
Dotnet core HubSpot client
License: MIT License
Would be great to be able to filter a contact list down to the contacts required based on a given field, using the
/crm/v3/objects/contacts/search URI
example search request
{
"filterGroups":[
{
"filters":[
{
"propertyName": "firstname",
"operator": "EQ",
"value": "Alice"
}
]
}
]
}
Excited to find this project.
I need to create a Contact, Company, and Deal.
First I create a contact. Now when I am creating the Company, how do I link the contact to that company?
Is there an ETA for the Deal client?
Some classes have managed to creep together in single .cs
files. Clean it up, please.
Does the wrapper support "Get all contact lists" (https://legacydocs.hubspot.com/docs/methods/lists/get_lists) please? If so how should it be called please?
Hi,
This is more of a technical question...
I have a few more entities I need to support: Product
and Line Item
(well, I need at least the latter because I need to create line items from our application), so I'm attempting to add them to this library. Mind you I'm quite new to the HubSpot API so it takes some research for me to figure it out... I think I can cover most of the operations and map them to the structure of this component. I just wonder how to map the result from this method: https://legacydocs.hubspot.com/docs/methods/line-items/batch-get-line-items
{
"9845651": {
"objectType": "LINE_ITEM",
"portalId": 62515,
"objectId": 9845651,
"properties": {
"hs_product_id": {
"versions": [
{
"name": "hs_product_id",
"value": "1645342",
"sourceVid": []
}
],
"value": "1645342",
"timestamp": 0,
"source": null,
"sourceId": null
}
},
"version": 1,
"isDeleted": false
},
"9867373": {
"objectType": "LINE_ITEM",
"portalId": 62515,
"objectId": 9867373,
"properties": {
"hs_product_id": {
"versions": [
{
"name": "hs_product_id",
"value": "1645187",
"sourceVid": []
}
],
"value": "1645187",
"timestamp": 0,
"source": null,
"sourceId": null
}
},
"version": 1,
"isDeleted": false
}
}
This seems like a dictionary, and doesn't really look like the other response types you use in this library, am I correct?
Hi. Is it possible to link a contact to a company using this wrapper?
Is there a way to get a list of contacts by a given company ID? Or get a company along with a list of contact associations?
Try to only send part of the property set during update. So those property not set in entity won't be updated. Is there a way to do that? Thanks
Thank you for this library! Works like a charm ๐
I was wondering if you considered adding interfaces for all the *HubSpotClient
classes so that they can be easily injected/mocked in unit tests? Or do you have another vision for mocking these?
HubSpot company endpoints provide a very useful endpoint of searching, filtering and sorting. This wrapper misses to proxy this endpoint.
Hi - Love this API, is there a way to search for newly created or updated deals?
Hi,
We received a notification that the hubspot authentication API was changing - will this library be affected by that or was it already using the newer auth methods?
Greetings! Just a quick question: Does this project support the HubSpot properties API? I'm referring to this in particular: https://developers.hubspot.com/docs/api/crm/properties#endpoint?spec=POST-/crm/v3/properties/%7BobjectType%7D/groups
Add cancellation tokens in the async calls or give the posability to send them with the methods
I think this functionality is missing:
https://legacydocs.hubspot.com/docs/methods/lists/delete_list
I also noticed that HubSpot has a new API, but it seems to be work in progress. Are there plans to migrate to this API? There seem to be some community questions/initiatives around generating OpenApi specs so that a client could be generated but I have no idea about the timeline.
So I guess my question is... how much should be invested in binding old v1
or v2
endpoints...?
As mentioned in #47, I do need to bind Line Items
on a short term, so I'll attempt to add this based on the v1
API.
I noticed some bugs in the Associations
implementation. Working on a fix, will submit a PR ASAP.
HubSpotAssociationsClient
all have a parameter for the definition ID, but they are never used since the entities also have a field for this. I think this should be removed (will break the API though).I'm trying to get a list of Companies using ListAsync
but noticed it has the wrong return type:
public async Task<T> ListAsync<T>(CompanyListRequestOptions opts = null) where T : IHubSpotEntity, new()
Instead of like the Owners ListAsync
public async Task<IEnumerable<T>> ListAsync<T>(OwnerListRequestOptions opts = null) where T : IOwnerHubSpotEntity, new()
Also can you provide a sample of how to use the pagination?
Salutations,
I state that I have been using your library with satisfaction for a long time but now I need to search for the Companies with the email
GetByEmailAsync.
Unfortunately I get the following error:
System.ArgumentException: Unable to locate a property on the data class that implements IList where T is a IHubSpotEntity
Unfortunately it is an error that is blocking me and I don't know how to go on.
I would be very grateful if you could point me to a quick fix ... or have you planned to release a fix.
I thank you
Most of them are severely outdated
I think this functionality is missing:
https://legacydocs.hubspot.com/docs/methods/lists/create_list
Hello,
Is there currently an implementation to allow the setting of custom properties for contacts? If so how is it done?
Nicklas, the equivalent call to your ContactList for Companies from their API is also missing, noticed this yesterday - docs are here: https://developers.hubspot.com/docs/methods/companies/get-all-companies
Happy to help put this in if needed but thought I would let you know.
AppVeyor refuses to expose secrets when building forks (which kind of makes sense), however this gives false broken PRs, as the remaining test suites actually work.
When running the following code:
var customers = await
_hubSpotApi.ListAsync<ContactListHubSpotEntity<HubspotCustomer>>(new ContactListRequestOptions
{
ContactOffset = offset,
NumberOfContactsToReturn = _hubspotConfig.BatchSize,
PropertiesToInclude = _propertiesToInclude
});
I get the following exception:
System.FormatException
String '1594252800000' was not recognized as a valid DateTime
at System.DateTimeParse.Parse(ReadOnlySpan`1 s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.Convert.ToDateTime(String value, IFormatProvider provider)
at System.String.System.IConvertible.ToDateTime(IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Skarp.HubSpotClient.Core.Requests.RequestDataConverter.ConvertSingleEntity(ExpandoObject dynamicObject, Object dto)
at Skarp.HubSpotClient.Core.Requests.RequestDataConverter.FromHubSpotListResponse[T](ExpandoObject dynamicObject)
at Skarp.HubSpotClient.Core.Requests.RequestSerializer.DeserializeListEntity[T](String json)
at Skarp.HubSpotClient.Core.HubSpotBaseClient.<ListAsync>b__11_0[T](String responseData)
at Skarp.HubSpotClient.Core.HubSpotBaseClient.<SendRequestAsync>d__17`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Skarp.HubSpotClient.Core.HubSpotBaseClient.<ListAsync>d__11`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Skarp.HubSpotClient.Contact.HubSpotContactClient.<ListAsync>d__7`1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at MyProject.HubSpotService.<DownloadCustomers>d__9.MoveNext()
My HubspotCustomer class has a DateTime property.
The issue seems to be that the hubspot client is not parsing the returned date correctly.
It's been removed by hubspot so we can remove the backwards compat added in #96
Hi!
Congratulations on your amazing project.๐๐
When I tried to get all deals, I use this code line
var deals =
await _client.ListAsync<DealListHubSpotEntity<DealHubSpotEntity>>(new DealListRequestOptions
{
PropertiesToInclude = new List<string> { "dealname", "amount", "hubspot_owner_id" },
NumberOfDealsToReturn = 2
});
I checked the method and he is waiting for ContactListRequestOptions and not DealListRequestOptions.
public async Task<T> ListAsync<T>(ContactListRequestOptions opts = null) where T : IHubSpotEntity, new()
{
Logger.LogDebug("Contact ListAsync");
and throw this error
Error CS1503 Argument 1: cannot convert from 'Skarp.HubSpotClient.Deal.DealListRequestOptions' to 'Skarp.HubSpotClient.Contact.ContactListRequestOptions'
I use library 0.22.0 installed by nuggets package
It breaks the build giving us a "build failing" badge which is not accurate
I like all the async methods. But it would be nice if an (optional) cancellation token could be passed to them. Are there plans to support this?
ListAsync for contacts currently seems to return a null list. Is this method still under development? Is there a way to implement this from outside the library?
As I was updating dependencies in our project (including this HubSpot library), I noticed that there's an issue with a transitive dependency (via RapidCore
). The situation is that we are running this in a .NET 6.0 application on Linux (Docker container). So when we build for the Linux platform, dotnet restore
fails:
We have "resolved" this by explicitly referencing these assembly versions directly in the application, but I've yet to see whether it holds up at runtime. Unit tests look OK.
I guess it's not really an issue in this library, but rather in RapidCore
or even SSH.NET
, something to be aware of.
I think this functionality is missing:
https://legacydocs.hubspot.com/docs/methods/lists/delete_list
The test suite is currently failing due to changes in the public hubspot demo account
Hi,
I need to get a Contact list with their ID.
I solved the problem using this code:
var clientList = new HubSpotListOfContactsClient("XXX-XXXX-XXXXX");
var listResult = await clientList.GetListByIdAsync<ContactListHubSpotEntity<ContactHubSpotEntity>>(123, new ListOfContactsRequestOptions { NumberOfContactsToReturn = 50 });
In the result all the Contacts (ContactHubSpotEntity
) present in the list I searched for appear correctly but these Contacts are empty except for the ID field.
In order to get the remaining Contacts data I am forced to make a further call (GetByIdAsync
) for each ID obtained.
Is it possible to have all the Contacts data directly called GetListByIdAsync
?
Thank you in advance and I am waiting for your reply.
With best regards
Michele
I know description states that this is a .Net-Core project, however this Nuget package states that this is a Net Standard 2.0 project. But if I use it will a .Net Framework project get a loader issue with (SimpleInjector) stating that it can't load the assembly that contains Skarp.HubspotClient.
Should this package be usable with .Net Core?
Right now we're sending it as the hapikey=
query parameter which kind of sucks of you do request logging in c# or some proxies or other intermediaries are logging requested URLs.
According to docs it should be possible to send the authentication details along as a standard Authorization Bearer
header - I think we should do that.
It would be handy to mention the nuget package in the readme
Update all the urls to v3 of the api
To ensure that we get the code base exercised in non-Windows contexts
Here is a sample code snippet; bear in mind i have been adding try catches as an attempt to work around the issue.
ContactHubSpotEntity hubspotContact = null;
var hubspotClient = new HubSpotContactClient(ConfigurationManager.AppSettings["HubSpotApiKey"]);
try
{
hubspotContact = await hubspotClient.GetByEmailAsync<ContactHubSpotEntity>(viewModel.Email);
}
catch (Exception e)
{
return false;
}
finally
{
if (hubspotContact == null)
{
hubspotContact = new ContactHubSpotEntity()
{
Address = viewModel.AddressLine1 + " " + viewModel.AddressLine2,
Company = viewModel.CompanyName,
City = viewModel.City,
Email = viewModel.Email,
FirstName = viewModel.FirstName,
Lastname = viewModel.LastName,
Phone = viewModel.PhoneNumber,
State = viewModel.State,
ZipCode = viewModel.ZipCode,
};
var success = await hubspotClient.CreateAsync<ContactHubSpotEntity>(hubspotContact);
}
}
return true;
when the first await line is hit a 404 response is received from hubspot because the contact doesn't exist; but the response body is not empty and the object shape is not the same as the serializer is expecting.
{
status=error,
correlationId=42022ea2-0916-41d5-bfee-57edd3a23b60,
message=contact does not exist,
requestId=73bf33242099220cd1ab6e842e063d29
}
I believe the code in the SendRequestAsync method in the HubSpotBaseClient class needs some critiquing to handle the response when a 404 is returned with the error message.
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.