Message
Request URL
PUT /messages
Description
Create a new message from the current user to ampliFi support with the specified text.
Schema
Property table for messages
Property | Description | Required | Schema |
---|---|---|---|
text | The message text | Yes | { "type": "string" } |
Request Body
Snippet Examples
javascript
const axios = require('axios');
const data = {
"text": "This is a test message"
};
const config = {
method: 'PUT',
url: '${AMPLIFI_BASE_URL}/messages',
headers: {
'Content-Type': "application/json",
'token': "A long random string token received from /token request"
},
data
};
let result;
try {
result = await axios.request(config);
if (result.status === 200) {
console.log(JSON.stringify(result.data));
}
} catch (err) {
console.log({
errCode: err.code,
responseStatus: err.response && err.response.status,
data: err.response && JSON.stringify(err.response.data)
});
}
cURL
curl --location "AMPLIFI_BASE_URL/messages" --data "{ \"text\":\"This is a test message\"}" --header "Content-Type: application/json" --header "token: A long random string token received from /token request"
Successful Response Examples
200 MESSAGES SUCCESSFUL RESPONSE CREATING NEW MESSAGE
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
token | A long random string token received from /token request |
REQUEST BODY
RESPONSE BODY
{
"success": true,
"message": {
"toAFiUserId": "AmpliFi Support",
"fromAFiUserId": "qweaurl8kgtlv9pc",
"dtsCreated": "2023-12-14T19:05:36.839Z",
"title": null,
"text": "This is a test message",
"href": null,
"category": null,
"isRead": false,
"isDelivered": true,
"messagePriorityCode": null,
"AFiMessageId": "qwemsglq5km0cnhdalpmsxehorwzsaowdten",
"dedupCode": "nfbnrnelfn"
}
}