APIs & Integrations

stollz2
Participant

historical mail import via api

Hi there,

a client moved to Hubspot CRM. Contacts and Companies are migrated already. Now we would like to copy all historical mails (between Hubspot user and existing contacts) to Hubspot with Engagement api.

We used: 
{
        "engagement": {
            "active": true,
            "ownerId": 54321,
            "type": "EMAIL",
            "timestamp": 1545696000000
        },
        "associations": {
            "contactIds": [<id-of-contact>],
            "companyIds": [],
            "dealIds": [],
            "ownerIds": [12345],
            "ticketIds":[]
        },
        "attachments": [],
        "metadata": {
            "from": {
                "email": "<mail-of-existing-contact>"
            },
            "to": [
                {
                    "email": "<mail-of-existing-user>"
                }
            ],
            "cc": [],
            "bcc": [],
            "subject": "Subject111213",
            "html": "htmlbody111213",
            "text": "textbody111213"
        }
    }

mail entry was created, but from: to: addresses

Any help would be great.

Andreas

0 Upvotes
2 Replies 2
dennisedson
HubSpot Product Team
HubSpot Product Team

historical mail import via api

hi @stollz2 

Thanks for providing the json that you are using.  Want to make sure that I am reading this correctly. 

You are able to create the mail entry, but the from and to email addresses are not being populated.  Am I reading that correctly?  

Also, within your JSON, are you wrapping the email addresses in the < > or is that for demonstration purposes?  

 

Tagging in some smart people  🙂 @tjoyce , @himanshurauthan  would you mind taking a look at this code?

 

Thanks!

 

stollz2
Participant

historical mail import via api

Hi Dennis,

thanks for your reply, 

we are now able to import historic mails, including attachments.

We just needed to figure exactly what API parameters to us (forwading_mail for sending mails)

Andreas