Giter Club home page Giter Club logo

hubspot-api's Issues

[Feature Request] Conversation Comments

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.

Get request token

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"
}

Open connection

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 comment

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.