Brief description:
Endpoint
Requqest
CURL https://dev.opensource-socialnetwork.org/api/v2.0/message/send -F api_key_token=myapikeytoken -F from=1 -F to=2 -F message=Test -F attachment=@/home/user/dummy.pdf
Method:
Parameter:
| Parameter name | Required | Type | Explain |
|---|---|---|---|
| api_key_token | Yes | string | Your API key |
| from | Yes | integer | A UserID from where message will be sent |
| to | Yes | integer | A UserID who receives the message |
| attachment | Optional | File | attachment file ('jpg','png','jpeg','jfif','gif','webp','docx','pdf') |
| message | Yes | string | A msesage text |
Example Response
{
"merchant": "OSSN",
"url": "http:\/\/dev.opensource-socialnetwork.org\/",
"time_token": 1714841244,
"payload": {
"data": {},
"id": 4,
"message_from": {
"guid": 1,
"fullname": "Arsalan Shah",
"username": "arsalanshah",
"icon": {
"small": "http:\/\/dev.opensource-socialnetwork.org\/avatar\/arsalanshah\/small\/c0e15d54735a596d4e16bf1aaa999758.jpeg"
}
},
"message_to": {
"guid": 2,
"fullname": "Some Name",
"username": "testuser",
"icon": {
"small": "http:\/\/dev.opensource-socialnetwork.org\/avatar\/testuser\/small\/fddf4dcc973847d1aeda796356412126.jpeg"
}
},
"message": "Test",
"viewed": "0",
"time": 1714841244,
"file:attachment": "attachment\/0fe4d28b98fcdd503f5650560e06e025.pdf",
"is_deleted_from": "",
"is_deleted_to": "",
"attachment_guid": "175",
"attachment_name": "dummy.pdf",
"type_of_attachment": "file",
"attachment_url": "http:\/\/dev.opensource-socialnetwork.org\/messages\/attachment\/175\/dummy.pdf"
},
"code": "100",
"message": "Request successfully executed"
}
Return payload parameter description
| Parameter name | Explain |
|---|---|
| message | contains actual message text |
| attachment_name | Name of file attached |
| type_of_attachment | file or image |
| attachment_url | URL to the attachment |
Remarks
| Code | Explain |
|---|---|
| 201 | OssnMessages component not found |
| 106 | Message text can not be blank |
| 106 | Either to or from is blank |
| 103 | Either user not found |
| 200 | Message send failed |
Available since OssnServices v9.6