Send a chat message
curl --request POST \
--url http://localhost/mogl/mogl-backend/api/sendMessage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"receiver_user_id": 1,
"message": "Hello, how are you?",
"attachment": null,
"has_fixed_attachment": false,
"reply_id": 1,
"athlete_id": 123,
"job_id": 1,
"milestone_id": 1,
"milestone_athlete_rel_id": 1,
"addChatWithApproval": false,
"from_mass_messaging": false
}
'import requests
url = "http://localhost/mogl/mogl-backend/api/sendMessage"
payload = {
"receiver_user_id": 1,
"message": "Hello, how are you?",
"attachment": None,
"has_fixed_attachment": False,
"reply_id": 1,
"athlete_id": 123,
"job_id": 1,
"milestone_id": 1,
"milestone_athlete_rel_id": 1,
"addChatWithApproval": False,
"from_mass_messaging": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
receiver_user_id: 1,
message: 'Hello, how are you?',
attachment: null,
has_fixed_attachment: false,
reply_id: 1,
athlete_id: 123,
job_id: 1,
milestone_id: 1,
milestone_athlete_rel_id: 1,
addChatWithApproval: false,
from_mass_messaging: false
})
};
fetch('http://localhost/mogl/mogl-backend/api/sendMessage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://localhost/mogl/mogl-backend/api/sendMessage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'receiver_user_id' => 1,
'message' => 'Hello, how are you?',
'attachment' => null,
'has_fixed_attachment' => false,
'reply_id' => 1,
'athlete_id' => 123,
'job_id' => 1,
'milestone_id' => 1,
'milestone_athlete_rel_id' => 1,
'addChatWithApproval' => false,
'from_mass_messaging' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost/mogl/mogl-backend/api/sendMessage"
payload := strings.NewReader("{\n \"receiver_user_id\": 1,\n \"message\": \"Hello, how are you?\",\n \"attachment\": null,\n \"has_fixed_attachment\": false,\n \"reply_id\": 1,\n \"athlete_id\": 123,\n \"job_id\": 1,\n \"milestone_id\": 1,\n \"milestone_athlete_rel_id\": 1,\n \"addChatWithApproval\": false,\n \"from_mass_messaging\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost/mogl/mogl-backend/api/sendMessage")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"receiver_user_id\": 1,\n \"message\": \"Hello, how are you?\",\n \"attachment\": null,\n \"has_fixed_attachment\": false,\n \"reply_id\": 1,\n \"athlete_id\": 123,\n \"job_id\": 1,\n \"milestone_id\": 1,\n \"milestone_athlete_rel_id\": 1,\n \"addChatWithApproval\": false,\n \"from_mass_messaging\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost/mogl/mogl-backend/api/sendMessage")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"receiver_user_id\": 1,\n \"message\": \"Hello, how are you?\",\n \"attachment\": null,\n \"has_fixed_attachment\": false,\n \"reply_id\": 1,\n \"athlete_id\": 123,\n \"job_id\": 1,\n \"milestone_id\": 1,\n \"milestone_athlete_rel_id\": 1,\n \"addChatWithApproval\": false,\n \"from_mass_messaging\": false\n}"
response = http.request(request)
puts response.read_bodySend a chat message
POST
/
sendMessage
Send a chat message
curl --request POST \
--url http://localhost/mogl/mogl-backend/api/sendMessage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"receiver_user_id": 1,
"message": "Hello, how are you?",
"attachment": null,
"has_fixed_attachment": false,
"reply_id": 1,
"athlete_id": 123,
"job_id": 1,
"milestone_id": 1,
"milestone_athlete_rel_id": 1,
"addChatWithApproval": false,
"from_mass_messaging": false
}
'import requests
url = "http://localhost/mogl/mogl-backend/api/sendMessage"
payload = {
"receiver_user_id": 1,
"message": "Hello, how are you?",
"attachment": None,
"has_fixed_attachment": False,
"reply_id": 1,
"athlete_id": 123,
"job_id": 1,
"milestone_id": 1,
"milestone_athlete_rel_id": 1,
"addChatWithApproval": False,
"from_mass_messaging": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
receiver_user_id: 1,
message: 'Hello, how are you?',
attachment: null,
has_fixed_attachment: false,
reply_id: 1,
athlete_id: 123,
job_id: 1,
milestone_id: 1,
milestone_athlete_rel_id: 1,
addChatWithApproval: false,
from_mass_messaging: false
})
};
fetch('http://localhost/mogl/mogl-backend/api/sendMessage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://localhost/mogl/mogl-backend/api/sendMessage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'receiver_user_id' => 1,
'message' => 'Hello, how are you?',
'attachment' => null,
'has_fixed_attachment' => false,
'reply_id' => 1,
'athlete_id' => 123,
'job_id' => 1,
'milestone_id' => 1,
'milestone_athlete_rel_id' => 1,
'addChatWithApproval' => false,
'from_mass_messaging' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost/mogl/mogl-backend/api/sendMessage"
payload := strings.NewReader("{\n \"receiver_user_id\": 1,\n \"message\": \"Hello, how are you?\",\n \"attachment\": null,\n \"has_fixed_attachment\": false,\n \"reply_id\": 1,\n \"athlete_id\": 123,\n \"job_id\": 1,\n \"milestone_id\": 1,\n \"milestone_athlete_rel_id\": 1,\n \"addChatWithApproval\": false,\n \"from_mass_messaging\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost/mogl/mogl-backend/api/sendMessage")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"receiver_user_id\": 1,\n \"message\": \"Hello, how are you?\",\n \"attachment\": null,\n \"has_fixed_attachment\": false,\n \"reply_id\": 1,\n \"athlete_id\": 123,\n \"job_id\": 1,\n \"milestone_id\": 1,\n \"milestone_athlete_rel_id\": 1,\n \"addChatWithApproval\": false,\n \"from_mass_messaging\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost/mogl/mogl-backend/api/sendMessage")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"receiver_user_id\": 1,\n \"message\": \"Hello, how are you?\",\n \"attachment\": null,\n \"has_fixed_attachment\": false,\n \"reply_id\": 1,\n \"athlete_id\": 123,\n \"job_id\": 1,\n \"milestone_id\": 1,\n \"milestone_athlete_rel_id\": 1,\n \"addChatWithApproval\": false,\n \"from_mass_messaging\": false\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
JWT Bearer token authentication. Use the /api/login endpoint to obtain a token.
Body
application/json
Receiver user ID (NOT receiver_id)
Example:
1
Example:
"Hello, how are you?"
Optional file as base64-encoded string or data URI (e.g. data:image/png;base64,...). Send null if no attachment.
Example:
null
If true, uses attachment as-is (no upload)
Example:
false
Chat reply reference ID
Example:
1
Agent acting on behalf of athlete
Example:
123
Job ID for deliverable approval flow
Example:
1
Milestone ID for approval flow
Example:
1
Milestone-athlete relation ID
Example:
1
Trigger approval insert
Available options:
Yes, No Example:
false
Skip file upload and Pusher event
Example:
false
Response
200
Message sent