How to reply a email in freshchat by api

I’m trying to reply a livechat conversation by api. When the conversation comes from Web Widget, it works fine.

but when the conversation comes from email, I failed.
the uri is

POST xxxx/v2/conversations/8a01c707-7777-485d-b24d-6111e36c9f1a/messages

First I tried this:

{
    "message_parts": [
        {
            "text": {
                "content": "Please wait for our team and we'll get back to you as soon as possible."
            }
        }
    ],
    "actor_type": "agent",
    "user_id": "9246f246-e54a-4d48-af9f-cffd8f7d03a1",
    "message_type": "normal",
    "actor_id": "e5fcbb71-67d7-42eb-8f61-5bad1b0c222a"
}

it returns:

{
    "code": 400,
    "status": "INVALID_VALUE",
    "message": "Fragment not supported in conversation"
}

then i tried this:

{
    "message_parts": [
        {
            "email": {
                "content": "Please wait for our team and we'll get back to you as soon as possible.",
                "subject": "Re: te"
            }
        }
    ],
    "actor_type": "agent",
    "user_id": "9246f246-e54a-4d48-af9f-cffd8f7d03a1",
    "message_type": "normal",
    "actor_id": "e5fcbb71-67d7-42eb-8f61-5bad1b0c222a"
}

it returns

{
    "code": 400,
    "status": "INVALID_VALUE"
}

Whats’ the correct way to create a message to a email conversation?

@Freddy how to achieve this can you give a working payload

To reply to an email conversation in Freshchat using API, you have to use the private message type. Please make sure you’re using the latest API version. Here’s a working payload:

{
    "message_parts": [
        {
            "text": {
                "content": "Please wait for our team and we'll get back to you as soon as possible."
            }
        }
    ],
    "actor_type": "agent",
    "user_id": "9246f246-e54a-4d48-af9f-cffd8f7d03a1",
    "message_type": "private",
    "actor_id": "e5fcbb71-67d7-42eb-8f61-5bad1b0c222a"
}

In the payload above, I changed the message_type from normal to private. This should allow you to reply to an email conversation in Freshchat.

Remember to replace the placeholder values with your own conversations and user/actor ids.

Using private message_type, the message can be sent by api.
The agent can see the private message in freshchat


But the user can’t receive the message in their email system.
And the document said that the private message can’t be seen by user.
.
It seems that this doesn’t solve the problem.
Addtional, I use the get conversation message api, the message sent in freshchat webpage like below. It’s message type is also normal.
image

Apologies for the confusion. Since private messages can’t be seen by users, it’s not the appropriate solution. Instead, you’ll need to use “outbound_email” as the message part type.

Here’s an updated working payload:

{
    "message_parts": [
        {
            "outbound_email": {
                "content": "Please wait for our team and we'll get back to you as soon as possible.",
                "subject": "Re: Your Subject"
            }
        }
    ],
    "actor_type": "agent",
    "user_id": "9246f246-e54a-4d48-af9f-cffd8f7d03a1",
    "message_type": "normal",
    "actor_id": "e5fcbb71-67d7-42eb-8f61-5bad1b0c222a"
}

In this payload, I changed the message part type from “text” to “outbound_email” and provided an email subject. This should allow you to send a reply to the user’s email system.

Please make sure to replace the subject value with the relevant subject you want to use.

It doen’t work.
The request is:

{
    "message_parts": [
        {
            "outbound_email": {
                "content": "Please wait for our team and we'll get back to you as soon as possible.",
                "subject": "Re: te"
            }
        }
    ],
    "actor_type": "agent",
    "user_id": "9246f246-e54a-4d48-af9f-cffd8f7d03a1",
    "message_type": "private",
    "actor_id": "e5fcbb71-67d7-42eb-8f61-5bad1b0c222a"
}

Response is:

{
    "code": 400,
    "status": "INVALID_VALUE"
}

I apologize for the confusion earlier. It seems that the “outbound_email” type is not supported. Unfortunately, the available Freshchat API documentation does not provide a clear solution for this issue.

I recommend reaching out to the Freshchat support team directly to get a more accurate answer to this problem. They might have specific guidance on how to reply to an email conversation using the API. You can find Freshchat support at this link: Support : Freshchat