erol444 / hubspot-api Goto Github PK
View Code? Open in Web Editor NEWPython library to interact with HubSpot's Private API
Python library to interact with HubSpot's Private API
Comments are a bit more tricky, as they use ably.io for their real-time aspect. There are 3 steps (REST calls) required to post a comment in a conversation, and I am not quite sure how to get everything; specifically the initial KeyName (13CharKey). After that, everything is fairly straightforward.
POST https://hubspot-eu-rest.ably.io/keys/13CharKey/requestToken?rnd=17digitNum
So for rnd
I assume it's just a random number, but I am not sure how/when app gets the 13CharKey. Response is something like this:
{
"capability": "{\"prod.messages.CUSTOM-list-123123-123123-123123\":[\"history\",\"presence\",\"publish\",\"subscribe\"],\"prod.messages.CUSTOM-list-222-222-222\":[\"history\",\"presence\",\"publish\"",
"clientId": "AGENT-123123123",
"expires": 1707689581429,
"issued": 1707684886129,
"keyName": "13CharKey",
"token": "57charToken"
}
Now that we have 57charToken, we can open a connection.
GET https://hubspot-eu-rest.ably.io/comet/connect?access_token=57charToken&stream=false&heartbeats=true&v=2&agent=ably-js%252F1.2.43%2520browser&rnd=17238796190672098
Which returns something like this:
[
{
"action": 4,
"connectionDetails": {
"clientId": "AGENT-123123123",
"connectionKey": "myConnectionKey",
"connectionStateTtl": 120000,
"maxFrameSize": 262144,
"maxIdleInterval": 15000,
"maxInboundRate": 200,
"maxMessageSize": 184320,
"maxOutboundRate": 200,
"serverId": "frontend.7d71.4.eu-central-1-SomeId"
},
"connectionId": "connectionId"
}
]
I believe only myConnectionKey
is required.
POST https://hubspot-eu-rest.ably.io/comet/myConnectionKey/send?access_token=57charToken&rnd=9029143974461677
With a JSON body of:
[
{
"action": 15,
"channel": "thread:v2:prod:private:123123:123123:2fa7e187-1231-1231-asdf-asdasdasd",
"messages": [
{
"data": "{\"@type\":\"THREAD_COMMENT\",\"sender\":{\"@type\":\"AGENT_SENDER\",\"id\":222333},\"senders\":[{\"actorId\":\"A-60366737\",\"deliveryIdentifier\":null,\"senderField\":null,\"name\":null}],\"timestamp\":1707993838371,\"text\":\"@Areb Areb Hi123\",\"richText\":\"<strong data-at-mention data-user-id=\\\"60366737\\\" data-search-text=\\\"Areb\\\" data-search-value=\\\"[email protected]\\\">@Areb</strong> Hi123\",\"hasMore\":false,\"id\":\"123123123\",\"status\":{\"messageStatus\":\"SENT\",\"timestamp\":null,\"sendFailure\":null},\"attachments\":[{\"@type\":\"MENTIONS\",\"userIds\":[123123]}],\"messageDeletedStatus\":\"NOT_DELETED\",\"clientType\":\"MOBILE\",\"genericChannelId\":null}",
"id": "123123123",
"name": "1"
}
],
"msgSerial": 1
}
]
Channel is the channel of the conversation, and id can be random hex str.
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.