Apr 19, 20231:01 PM - edited Apr 20, 20233:28 AM
Participant
Cannot see customer's reply in customer portal
Hello,
I try to import tickets from another system to Hubspot using your API. We need that all old tickets and discussion on each ticket to be displayed in Customer Portal.
I managed to create a ticket and add a reply from our staff to this ticket. The ticket and this reply is correct displayed in Customer Portal, all is fine.
Then I tried to add the messages sent by Customer. For messages sent by customers, I used https://api.hubapi.com/crm/v3/objects/emails but those messages(answers) are not displayed in Customer Portal.
curl 'https://api.hubapi.com/crm/v3/objects/emails' --header 'authorization: Bearer MY-SECRET' --data '{"properties":{"hs_timestamp":1681921277374,"hubspot_owner_id":"814909395","hs_email_direction":"INCOMING_EMAIL","hs_email_status":"SENT","hs_email_subject":"bla","hs_email_text":"customer x answer from api 2","hs_email_headers":"{\"from\":{\"email\":\"CUSTOMEREMAIL@gmail.com\"},\"to\":[{\"email\":\"XXX@MYCOMPANY.com\"}],\"cc\":[],\"bcc\":[]}"},"associations":[{"to":{"id":"1215231466"},"types":[{"associationCategory":"HUBSPOT_DEFINED","associationTypeId":18}]},{"to":{"id":"2501"},"types":[{"associationCategory":"HUBSPOT_DEFINED","associationTypeId":10}]}]}'
The result of this request is: - in backend, the reply is visible on ticket - the associations are correct - this email is not counted in conversation - in customer portal the answer is NOT displayed
This is the situation in customer portal:
My question is obvious, how do I add from API the customer's answer to a ticket?
Based on the information you provided, it seems that you are successfully creating an email object in HubSpot CRM using the API, and associating it with the correct ticket using the associations parameter. However, the customer's reply is not being displayed in the customer portal.
One reason for this could be that the email object you are creating is not being associated with the correct conversation thread in the customer portal. When a customer sends a reply to a ticket, HubSpot groups all related emails into a single conversation thread that can be viewed in the customer portal. To associate an email with an existing conversation thread, you need to set the hs_conversation_id property in the email object to the conversation ID of the existing thread.
You can find the conversation ID of a thread by inspecting the URL of the thread in the customer portal. The conversation ID is the number that comes after "conversation/" in the URL.
So, to add a customer's reply to an existing conversation thread using the API, you would need to do the following:
Retrieve the conversation ID of the thread you want to add the reply to.
Create a new email object using the API, and set the hs_conversation_id property to the conversation ID of the thread.
Associate the email with the ticket using the associations parameter.
Here's an example of how to modify your existing API call to include the hs_conversation_id property:
Note that you need to replace <CONVERSATION_ID> with the actual conversation ID of the thread, and <MESSAGE_ID> with a unique message ID for the email. The message ID should be a globally unique identifier that is specific to the email, and is used to prevent duplicate emails from being added to the conversation thread.
I hope this helps! Let me know if you have any further questions.
{
"status": "error",
"message": "Property values were not valid: [{\"isValid\":false,\"message\":\"Property \\\"hs_conversation_id\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"name\":\"hs_conversation_id\"}]",
"correlationId": "c0964f04-520c-4b69-a7e7-3268dd630978",
"category": "VALIDATION_ERROR"
}