Files
Global-Jain/resources/docs/1.0/message.md
2025-11-05 10:37:10 +05:30

6.2 KiB

Send message information

Details for the sending message information

####Endpoint

{warning} Please note that the URI for this endpoint only should not include api/{$version} before

| Method | URI | Headers | | : | :- | : | | POST | /user/send-message | Authorization : Bearer {token} |

URL Params

None

Data Params

{
    "receiver_id" : 1,
    "message" : "Hello",
    "type": 0,
    "status": 0
}

{success} Success Response

####Code 200 ####Content

{
    "notification": {
        "userToken": "1|jdbQbjnknDdvfNkcasqdscdvAxvsv",
        "title": "Anurag", // or "New Message" (if the user is not registered)
        "body": "Hello",
        "avatar": "http://fssevefesgvsv.jpg",
        "extraData": {
            "id": 1,
            "avatar": "http://fssevefesgvsv.jpg",
            "user_id": 104,
            "name": "Anurag",
            "unread_count": 2,
            "message": "Hello",
            "created_at": "2020-08-12 04:38:40",
            "os": "Android",
            "type": "New Message"
        }
    },
    "message": "Message sent successfully!"
}

{danger} Unauthenticated Response

####Code 403 or 404 ####Content

{
    "message": "Something went wrong!"
}

Message thread list information

Details for the message thread list information

####Endpoint

{warning} Please note that the URI for this endpoint only should not include api/{$version} before

| Method | URI | Headers | | : | :- | : | | GET | /user/message-thread-list | Authorization : Bearer {token} |

URL Params

None

Data Params

{
    "name": "Man"
}

{success} Success Response

####Code 200 ####Content

{
    "data": [
        {
            "id": 1,
            "user_id": 1,
            "avatar": null,
            "avatar_url": null,
            "name": "Superadmin",
            "created_at": "2020/08/12 04:38:40",
            "message": "Hello",
            "unread_count": 0
        }
    ]
}

{danger} Unauthenticated Response

####Code 403 or 404 ####Content

{
    "message": "Something went wrong!"
}

Message list information

Details for the message list information

####Endpoint

{warning} Please note that the URI for this endpoint only should not include api/{$version} before

| Method | URI | Headers | | : | :- | : | | GET | /user/message-list/{receiver_id} | Authorization : Bearer {token} |

URL Params

1 //Receiver's Id

Data Params

None

{success} Success Response

####Code 200 ####Content

{
    "data": {
        "current_page": 1,
        "data": [
            {
                "user_id": 104,
                "message": "Hello",
                "created_at": "2020-08-12T04:38:40.000000Z"
            },
            {
                "user_id": 104,
                "message": "Hey",
                "created_at": "2020-08-10T11:27:52.000000Z"
            }
        ],
        "first_page_url": "http://127.0.0.1:8000/api/v1/user/message-list/1?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "http://127.0.0.1:8000/api/v1/user/message-list/1?page=1",
        "next_page_url": null,
        "path": "http://127.0.0.1:8000/api/v1/user/message-list/1",
        "per_page": 20,
        "prev_page_url": null,
        "to": 2,
        "total": 2
    }
}

{danger} Unauthenticated Response

####Code 403 or 404 ####Content

{
    "message": "Something went wrong!"
}

Search message information

Details for the search message information

####Endpoint

{warning} Please note that the URI for this endpoint only should not include api/{$version} before

| Method | URI | Headers | | : | :- | : | | POST | /user/search-message/{receiver_id} | Authorization : Bearer {token} |

URL Params

1 //Receiver's Id

Data Params

{
    "message":"he"
}

{success} Success Response

####Code 200 ####Content

{
    "message": [
        {
            "user_id": 104,
            "message": "Hey",
            "created_at": "2020-08-10T11:27:52.000000Z"
        },
        {
            "user_id": 104,
            "message": "Hello",
            "created_at": "2020-08-12T04:38:40.000000Z"
        }
    ]
}

{danger} Unauthenticated Response

####Code 403 or 404 ####Content

{
    "message": "Something went wrong!"
}

Clear message information

Details for the clear message information

####Endpoint

{warning} Please note that the URI for this endpoint only should not include api/{$version} before

| Method | URI | Headers | | : | :- | : | | DELETE | /user/clear-message/{receiver_id} | Authorization : Bearer {token} |

URL Params

1 //Receiver's Id

Data Params

None

{success} Success Response

####Code 200 ####Content

{
    "message": "Messages cleared successfully!"
}

{danger} Unauthenticated Response

####Code 403 or 404 ####Content

{
    "message": "Something went wrong!"
}

Delete message thread information

Details for the delete message thread information

####Endpoint

{warning} Please note that the URI for this endpoint only should not include api/{$version} before

| Method | URI | Headers | | : | :- | : | | DELETE | /user/delete-thread/{receiver_id} | Authorization : Bearer {token} |

URL Params

1 //Receiver's Id

Data Params

None

{success} Success Response

####Code 200 ####Content

{
    "message": "Message thread deleted successfully!"
}

{danger} Unauthenticated Response

####Code 403 or 404 ####Content

{
    "message": "Something went wrong!"
}