APIs & Integrations

stephen-msc
Member

Export Tickets With Associated Email Activity

SOLVE

Which developer APIs will get me the Ticket and its associated emails with content exported? 
Even this can be achieved with a combination of API calls that is alright. I just need to know the logical steps for calling the APIs and getting an export of emails associated with tickets. 

0 Upvotes
1 Accepted solution
zach_threadint
Solution
Top Contributor

Export Tickets With Associated Email Activity

SOLVE

Hi @stephen-msc 👋

 

I see, thanks for clarifying what you're trying to achieve.

 

When using HubSpot's GET {Object Type} API endpoints, you need to specify within a query string parameter which "properties" (i.e. data fields) you would like to be returned.

 

In order to do this, you'll first need to find the internal property names for each of your target properties. You can find these internal property names within HubSpot's UI > Settings > Data Management > Properties (for most properties) and via the Properties API (for all properties). For example:

 

GET /crm/v3/objects/EMAILS?properties=hs_email_html,hs_email_text&limit=100

 

Example response

{
    "results": [
        {
            "id": "23358886364",
            "properties": {
                "hs_createdate": "2024-01-11T05:10:54.131Z",
                "hs_email_html": "<div style=\"\" dir=\"auto\" data-top-level=\"true\"><p style=\"margin:0;\">test email</p></div>",
                "hs_email_text": "test email",
                "hs_lastmodifieddate": "2024-01-19T02:18:32.202Z",
                "hs_object_id": "23358886364"
            },
            "createdAt": "2024-01-11T05:10:54.131Z",
            "updatedAt": "2024-01-19T02:18:32.202Z",
            "archived": false
        }
    ]
}

 

You can see in the response the properties I requested in the "properties" query string parameter (hs_email_html and hs_email_text).

 

I hope that proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


View solution in original post

4 Replies 4
zach_threadint
Top Contributor

Export Tickets With Associated Email Activity

SOLVE

Hi @stephen-msc 👋

 

Looks like there may be some 3rd party solutions that could help you achieve this (as per posts linked by @BérangèreL).

 

If you need/want to retrieve this data yourself via API, it'd be helpful if you'd clarify your use case a little. Specifically, are you interested in retrieving data for a specific Ticket (or batch of Tickets), or do you need to retrieve all Tickets (or maybe a certain subset of Tickets based on a search criteria)? This will help the community put together an example solution for you.

 

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


stephen-msc
Member

Export Tickets With Associated Email Activity

SOLVE

Hi Zach, 

Thanks for reaching out to help with my problem. 
Here is what I am looking to achieve ...
I want to export tickets beloging to a couple of pipelines (eg. Production, Editorial Assistant) and with the ticket I want to get the associated email data (sender, receiver, email content, email date). If this cannot be achieved in one API call, I can write a script to iterate over a bunch of tickets and get the associate email data. 
I have tried the folloiwng APIs - 
For Tickets ...
# GET /crm/v3/objects/tickets
# GET /crm/v3/objects/tickets/{ticketId}

For Emails ...
# GET /crm/v3/objects/emails
# GET /crm/v3/objects/emails/{emailId} 


I was hoping the last API endpoint with {emailId} would return the email content. But, that is not the case. Unless, there is some parameter that needs to be set to get the API to return email content as well. 
So, using these APIs I am getting some properties but not the actual email content. 

Basically what I need is an exported list of - 
Ticket ID, Ticket Date, Associated Email(s) [Date, Sender, Receiver, Subject, Body] 

Also, tried the 'Export' option within Hubspot Ticket list to get the associated emails with content. But, this also does not come in the exported data. 

Hope this helps you get a better understanding of what I am looking for. 

Appreciate your help and time. 

Thanks. 


 

0 Upvotes
zach_threadint
Solution
Top Contributor

Export Tickets With Associated Email Activity

SOLVE

Hi @stephen-msc 👋

 

I see, thanks for clarifying what you're trying to achieve.

 

When using HubSpot's GET {Object Type} API endpoints, you need to specify within a query string parameter which "properties" (i.e. data fields) you would like to be returned.

 

In order to do this, you'll first need to find the internal property names for each of your target properties. You can find these internal property names within HubSpot's UI > Settings > Data Management > Properties (for most properties) and via the Properties API (for all properties). For example:

 

GET /crm/v3/objects/EMAILS?properties=hs_email_html,hs_email_text&limit=100

 

Example response

{
    "results": [
        {
            "id": "23358886364",
            "properties": {
                "hs_createdate": "2024-01-11T05:10:54.131Z",
                "hs_email_html": "<div style=\"\" dir=\"auto\" data-top-level=\"true\"><p style=\"margin:0;\">test email</p></div>",
                "hs_email_text": "test email",
                "hs_lastmodifieddate": "2024-01-19T02:18:32.202Z",
                "hs_object_id": "23358886364"
            },
            "createdAt": "2024-01-11T05:10:54.131Z",
            "updatedAt": "2024-01-19T02:18:32.202Z",
            "archived": false
        }
    ]
}

 

You can see in the response the properties I requested in the "properties" query string parameter (hs_email_html and hs_email_text).

 

I hope that proves helpful. Please let me know if you have any follow-up questions.

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


BérangèreL
Community Manager
Community Manager

Export Tickets With Associated Email Activity

SOLVE

Hi @stephen-msc,

Thank you for asking the Community!

I checked for you and I found these resources that might help you:

- Exports: Use the exports API to export records and property data from your HubSpot account
- The post from @johnelmer on this similar post "Exporting Timeline Activities"
- The post from @dennisedson on this post "Getting all associated activities to a Ticket"

I also wanted to invite a couple of subject matter experts to this conversation: Hi @zach_threadint, @mangelet and @Teun do you have suggestions to help @stephen-msc, please?

Also, if anybody else has anything to add and/or share, please feel free to join in the conversation 🙂

Thanks a lot and have a great day!

Best,
Bérangère


Saviez-vous que la Communauté est disponible en Français ?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings!