File size: 3.12Kb
<div class="content__inner">
<h2>Send message / image</h2>
<p>
Please use this <strong>(<?php echo cl_link("mobile_api/send_message"); ?>) API for accessing the endpoint of sending a message</strong>
</p>
<br>
<h4 class="table-title">Post parameters</h4>
<table class="table table-bordered">
<thead>
<tr>
<th width="15%">Field</th>
<th width="25%">Value</th>
<th width="45%">Remarks</th>
</tr>
</thead>
<tbody>
<tr>
<td>session_id</td>
<td>Access token ID</td>
<td>
E.g. de25cc16eb00960f076...
</td>
</tr>
<tr>
<td>user_id</td>
<td>User ID of the interlocutor</td>
<td>
E.g. 4567
</td>
</tr>
<tr>
<td>type</td>
<td>Message type Text or Image</td>
<td>
E.g. One of these options (text/media)
</td>
</tr>
<tr>
<td>image</td>
<td>Message image file</td>
<td>
E.g. some-picture.jpeg
</td>
</tr>
<tr>
<td>message</td>
<td>Message text (Max length 3000)</td>
<td>
E.g. `Hi! How are you?`
</td>
</tr>
</tbody>
</table>
<h4 class="table-title">Success response</h4>
<div class="code-holder">
<div class="code-holder-inner">
<pre><code class="json">{
"code": 200,
"message": "Message sent",
"data": {
"id": 49,
"sent_by": 7,
"sent_to": 78,
"owner": true,
"message": "Image",
"media_file": "http://colibri.loc/upload/images/2020/11/lbEG1WesAJdnqVWuUVSd_21_00ae49e181b4a21f86d2338eed424e7b_image_original.jpg",
"media_type": "image",
"seen": "0",
"deleted_fs1": "N",
"deleted_fs2": "N",
"time": "21 Nov, 2020 03:11",
"side": "right",
"media_name": "COLIBRI-IMG-1605960603"
}
}
</code></pre>
</div>
</div>
<h4 class="table-title">Error responses</h4>
<div class="code-holder">
<div class="code-holder-inner">
<pre><code class="json">{
"code": 401,
"data": [],
"message": "Unauthorized Access"
}
{
"code": 400,
"message": "Interlocutor ID is missing or invalid",
"data": []
}
{
"code": 400,
"message": "You do not have permission direct messages to this chat",
"data": []
}
{
"code": 400,
"message": "Your account has been blocked by this account",
"data": []
}
{
"code": 500,
"message": "An error occurred while processing your request. Please try again later.",
"data": []
}
{
"code": 400,
"message": "The media type of the message is invalid or missing",
"data": []
}
</code></pre>
</div>
</div>
</div>