Description
The Send Message API allows you to send messages to a Hi Marley case from any system. The send message API allows carriers the flexibility in sending a text message as a string through the the messageBody element.
| Service Name | Send Message |
| Service Type | REST |
| Method | POST |
| UAT (Sandbox) URL |
https://integration.uat.marley.ai/api/case/actions/send-message |
| Production URL | https://integration.himarley.io/api/case/actions/send-message |
| Technical Documentation | View technical documentation with sample request and response payloads hosted on Postman. |
Table of Contents
API Request
Flow
- Send API Request with Hi Marley caseId and generated messageBody from your system.
- Hi Marley receives requests and validate Request Payload elements (see request field breakdown)
- API Response received with either success or error message based on validation. Success indicates that message will be processed and sent shortly.
- If source is set to an operator email, Hi Marley will modify case assignment based on the below logic:
- If case is unassigned, the indicated operator will be assigned as the primary contact.
- If case is assigned, the indicated operator will be assigned as a secondary operator.
- Hi Marley sends message to customer on the case using the specified source or as Marley (ai).
Request Payload Example
{
"caseId": "Auto-123456",
"messageBody": "Is there anything else we can help with?",
"source": "ai"
}
Request Field Breakdown
| Property | Values | Description |
Type |
Required | Example | Validation |
| caseId | The case identifier for the Hi Marley Case. | string |
true |
"caseId": "c808ba82-e2cb-4a92-9344-b924d79d2308" |
|
|
| messageBody | Content of the message that is sent to the case in Hi Marley. | string |
true |
"messageBody": "Is there anything else we can help with?" |
|
|
| source | "ai" | The message will come from Marley. | string |
false |
"source": "ai" |
|
| "assigned" | The message will come from the Operator assigned to the Hi Marley case. | string |
false |
"source": "assigned" |
|
|
| operator account object | The message will come from a specific operator account. | object |
false |
"source":{"email":"jermeie.quinones@himarley.com"} |
|
API Response
Response Payload Example
{
"isAI": false,
"isEvent": false,
"isInbound": false,
"redactionData": [],
"redactionViewedEvents": [],
"isFile": false,
"isImage": false,
"isNote": false,
"isArchived": false,
"isActive": true,
"messageGroup": 0,
"_id": "2d57a656-a8a8-4e5d-9213-9bafc03e09f1",
"chatId": "02462dc8-afb8-4715-8d1e-3ce77189870f",
"authorId": "e16b18d4-d0c7-4e80-8db5-2fcf878d2f25",
"body": "You have the right to have your vehicle repaired at the body shop of your choice. If you'd like us to help you find a shop near you, click HERE.",
"redactedBody": "You have the right to have your vehicle repaired at the body shop of your choice. If you'd like us to help you find a shop near you, click HERE.",
"deliveryStatus": "internalProcessing",
"parentJobId": "",
"organization": "0d24732c-3646-45c5-a313-e3667fb8e6ca",
"creationSource": "PublicApi",
"createdAt": "2022-09-01T17:03:18.706Z",
"updatedAt": "2022-09-01T17:03:18.706Z",
"__v": 0,
"author": {
"languagePreference": "en"
}
}
Response Fields Breakdown
| Property | Description | Data type | Example |
| isAI | Indicates if message will be sent by Marley. | boolean | true |
| isEvent | boolean | false | |
| isInbound | boolean | false | |
| redactionData | |||
| redactionViewedEvents | |||
| isFile | boolean | false | |
| isImage | boolean | false | |
| isNote | boolean | false | |
| isArchived | boolean | false | |
|
isActive |
boolean | true | |
| messageGroup | int | 0 | |
| _id | Message ID | string |
31a731b4-2c17-412f-9352-2dd7d9e04017
|
| chatId | Case ID | string |
47ac964c-1e81-4ed3-b106-f91bd41626d0
|
| body | Content of message | string | "Hello" |
| redactedBody | Content of message if redacted. Redaction only occurs on customer texts. | string | "Hello" |
| deliveryStatus | Stage of delivery. Always set to internalProcessing in API Response | string | internalProcessing |
| parentJobId | string | ||
| organization | Organization ID | string |
1d2f4e68-d733-477f-acc4-c1c187f0c159
|
| creationSource | Always PublicAPI since it is a response | string | PublicAPI |
| createdAt | Date the message was created. | dateTime |
2022-08-26T17:40:41.581Z
|
| updatedAt | Matches createdAt at the time of API response | dateTime |
2022-08-26T17:40:41.581Z
|
| __v | int | 0 | |
| author.languagePreference | Language shorthand that will auto-translate the message to if it is not english (en) | string | en |
Below are examples of a sendMessage API from a sending system, & the corresponding message displayed in the Hi Marley Webapp.
Message with source = email
Message with source = assigned
Message with source = ai
Common Errors to Handle
- [404] Case Not Found - More Details
- [404] Primary Contact Not Found - More Details
Missing Message Body Parameter
Description
Element messageBody in API request is missing, contains empty quotations.
Possible Resolutions
- Retry API request with corrected messageBody element.
Example
{
"errors" : [
{
"code" : "SendMessageMissingParams",
"category" : "DataValidationError",
"retryable" : false,
"status" : 400,
"detail" : "Missing required parameters [\"messageBody\"]",
"path" : "/case/actions/send-message",
"method" : "POST",
"requestId" : "6c4396dd-81b4-4897-8a94-f3191bd80086"
}
]
}
Comments
0 comments
Please sign in to leave a comment.