<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unable to create engagement associated to contact in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Unable-to-create-engagement-associated-to-contact/m-p/702448#M57572</link>
    <description>&lt;P&gt;Thank you for the response!&amp;nbsp;We should really start using the v3 endpoints for notes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;But I think I have a problem with contacts, because I'm able to create them and for some strange reason, some of them are dissapearing.&lt;/STRIKE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRIKE&gt;The contact from the example was created on HubSpot throught the API, and then I wasn't able to fetch it by its Id, and of course, I wasn't able to post a note associated to it. Do you know what can be the cause of these dissapearances?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRIKE&gt;Recently I was able to find out that the customer of the integration was archiving some contacts, this was causing the issue.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I don't know how obvious it is but for anyone with the same problem, make sure that the contact is not marked as &lt;STRONG&gt;archived&lt;/STRONG&gt; when associating it to an engagement through the API.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2022 19:59:14 GMT</pubDate>
    <dc:creator>IKenect</dc:creator>
    <dc:date>2022-10-05T19:59:14Z</dc:date>
    <item>
      <title>Unable to create engagement associated to contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Unable-to-create-engagement-associated-to-contact/m-p/701832#M57533</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I have a case where I'm creating a contact through the &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;crm/v3/objects/contacts&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;endpoint. This endpoint is returning the objectId, which I'm using as a contactId to POST an engagement using this endpoint &lt;EM&gt;&lt;STRONG&gt;/engagements/v1/engagements&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "engagement": {
        "active": true,
        "type": "NOTE",
        "timestamp": 1664375177444
    },
    "associations": {
        "contactIds": [contactId]
    },
    "metadata": {
        "body": "a message"
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm receiving this error from the engagement API, and it doesn't make sense to me because the contact is being created without any issue but then I can't associate it to an engagement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "status": "error",
    "message": "one or more associations are not valid",
    "correlationId": "b31bcefe-3869-4d0a-bcfd-39601a3fd272",
    "validationResults": [
        {
            "row": {
                "portalId": 6449376,
                "definition": {
                    "category": "HUBSPOT_DEFINED",
                    "id": 201,
                    "inverseId": 202,
                    "fromObjectTypeId": "0-1",
                    "toObjectTypeId": "0-46",
                    "cardinality": "ONE_TO_MANY",
                    "inverseCardinality": "ONE_TO_MANY",
                    "name": "CONTACT_TO_NOTE",
                    "inverseName": "NOTE_TO_CONTACT",
                    "label": null,
                    "inverseLabel": null,
                    "hasAllAssociatedObjects": false,
                    "isPrimary": false,
                    "isInversePrimary": false,
                    "inverseHasAllAssociatedObjects": false,
                    "maxToObjectIds": 10000,
                    "maxFromObjectIds": 1000,
                    "hasCascadingDeletes": false,
                    "toObjectType": "NOTE",
                    "fromObjectType": "CONTACT"
                },
                "fromObjectId": 35948551,
                "fromObjectTypeId": "0-1",
                "objectTypeAndId": {
                    "objectTypeId": "0-1",
                    "objectId": 35948551
                }
            },
            "result": "INVALID_FROM_OBJECT"
        }
    ],
    "errorMessages": [
        "0-1=35948551 is not a valid object"
    ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any kind of insight about this error will be really aprecciated.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 13:11:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Unable-to-create-engagement-associated-to-contact/m-p/701832#M57533</guid>
      <dc:creator>IKenect</dc:creator>
      <dc:date>2022-10-04T13:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to create engagement associated to contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Unable-to-create-engagement-associated-to-contact/m-p/702371#M57569</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/457321"&gt;@IKenect&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this looks very interesting. Is there a specific reason why you're using the v1 of the engagement endpoint? Are you depending on that version for some reason?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, I recommend using the up to date v3. With this one, you have two different endpoints for creating an engagement&lt;/P&gt;
&lt;PRE&gt;/crm/v3/objects/notes&lt;/PRE&gt;
&lt;P&gt;and then associating it with a contact with the &lt;EM&gt;noteId&lt;/EM&gt; you get in the first response.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/crm/v3/objects/notes/{noteId}/associations/{toObjectType}/{toObjectId}/{associationType}&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://developers.hubspot.com/docs/api/crm/notes" target="_blank"&gt;&amp;nbsp;See the docs for more details here.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, in total, you end up with three calls:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;First create the contact -&amp;gt; Response gives you the&amp;nbsp;&lt;EM&gt;contactId&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;Create the Note Engagement -&amp;gt; Response gives you the &lt;EM&gt;n&lt;/EM&gt;&lt;EM&gt;oteId&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;Tie things up with an association call&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Please let me know if this helps you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you found this post helpful, consider helping others in the community to find answers faster by marking this as a solution. I'd really appreciate it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Chriso&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 15:54:01 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Unable-to-create-engagement-associated-to-contact/m-p/702371#M57569</guid>
      <dc:creator>ChrisoKlepke</dc:creator>
      <dc:date>2022-10-05T15:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to create engagement associated to contact</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Unable-to-create-engagement-associated-to-contact/m-p/702448#M57572</link>
      <description>&lt;P&gt;Thank you for the response!&amp;nbsp;We should really start using the v3 endpoints for notes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;But I think I have a problem with contacts, because I'm able to create them and for some strange reason, some of them are dissapearing.&lt;/STRIKE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRIKE&gt;The contact from the example was created on HubSpot throught the API, and then I wasn't able to fetch it by its Id, and of course, I wasn't able to post a note associated to it. Do you know what can be the cause of these dissapearances?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRIKE&gt;Recently I was able to find out that the customer of the integration was archiving some contacts, this was causing the issue.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I don't know how obvious it is but for anyone with the same problem, make sure that the contact is not marked as &lt;STRONG&gt;archived&lt;/STRONG&gt; when associating it to an engagement through the API.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 19:59:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Unable-to-create-engagement-associated-to-contact/m-p/702448#M57572</guid>
      <dc:creator>IKenect</dc:creator>
      <dc:date>2022-10-05T19:59:14Z</dc:date>
    </item>
  </channel>
</rss>

