Hi @avomd,
Happy to help here, Generally, you could use the Hubspot API to not just create the ticket but also log the engagement (email activity). Immediately after ticket creation, call the Engagements API (CRM v3 Objects for emails, notes, or custom engagements). This logs an activity in the contact timeline with your original ticket description.
AI generated example below:
POST /crm/v3/objects/tickets
{
"properties": {
"subject": "Feedback from Web App",
"hs_pipeline": "0",
"hs_pipeline_stage": "1",
"content": "User feedback description here..."
},
"associations": [
{ "to": { "id": "CONTACT_ID" }, "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 16 }] },
{ "to": { "id": "COMPANY_ID" }, "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 1 }] }
]
}
POST /crm/v3/objects/emails
{
"properties": {
"hs_email_subject": "Feedback Received",
"hs_email_text": "User feedback description here..."
},
"associations": [
{ "to": { "id": "CONTACT_ID" }, "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 2 }] },
{ "to": { "id": "TICKET_ID" }, "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 19 }] }
]
}
Keep in mind that this would log an email to the record but it would not automatically send an email to the associated records. This email would simply be logged to the contact, company, ticket record.
If you want to send an email, you would use the CRM v3 emails endpoint with the send action, again, AI generated example below:
POST https://api.hubapi.com/crm/v3/objects/emails
{
"properties": {
"hs_email_subject": "Your Feedback Ticket",
"hs_email_text": "Hi {{contact.firstname}},\n\nThank you for your feedback. Here are the details:\n\n{{ticket.description}}\n\nWe will get back to you shortly.",
"hs_email_direction": "OUTGOING",
"hs_email_status": "SENT",
"hs_email_to_email": "customer@example.com",
"hs_email_from_email": "support@yourcompany.com"
},
"associations": [
{ "to": { "id": "CONTACT_ID" }, "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 2 }] },
{ "to": { "id": "TICKET_ID" }, "types": [{ "associationCategory": "HUBSPOT_DEFINED", "associationTypeId": 19 }] }
]
}
Make sure that the hs_email_from_email matches a connected mailbox in your HubSpot portal.
Best regards