- Find the live documentation Here
SMS Management Application is an API that manages sending and receiving of SMS messages. With this API, you can manage contacts, send SMS, update an SMS, receive SMS, view an SMS.
Ensure to have these on your machine.
-
Some knowledge of terminal or use Mongodb Compass for database UI
- Clone the repository.
git clone https://github.com/hadijahkyampeire/sms-management-api-mongo.git
- Install the dependencies by running:
yarn install
- Start you mongodb service
mongod, if it requires authentication use sudo mongod
- Get started
yarn start:dev
- you can now access the application using postman
http://localhost:5000
The application's tests can be executed by running the script below within the terminal at the application root directory:
yarn test or npm test
if you want to know the coverage use:
yarn test -- --coverage
- After creating a contact one has to get authenticated first before they access other endpoints.
description: Creates a contact method : POST headers: content-Type →application/json sample payload:
`{
"first_name": "Haddy",
"last_name":"Kyamps"
"phoneNumber": "0781980273",
"password": "password"
}`
description: Updates user contact information method : PUT headers: content-Type →application/json Authorization: put a token got from authorization sample payload:
`{
"phoneNumber": "0705221421",
"first_name":"Hadijah"
}`
description: Retrieves users contacts information method : GET headers: content-Type →application/json Authorization: put a token got from authorization returns:
`{
"contacts": [
{
"_id": "5c7434ad282c7f95ee924353",
"first_name": "kyampeire",
"last_name": "hadijah",
"password": "$2b$10$31Ibyx0d76W1A.OBaum8NuX7s7ayo51VJHt3yBhzP/zvR432DyKH6",
"phone_number": "0781980273",
"__v": 0
},
]
}`
description: Deletes a contact for the authenticated user along with messages associated to them method : DELETE headers: content-Type →application/json Authorization: put a token got from authorization
returns:
` {
message:"contact deleted successfully"
}`
description: Login and authenticate the user method : POST headers: content-Type →application/json payload:
`{
"phone_number": "0705221421",
"password": "password"
}`
returns:
` {
"message": "You were successfully authenticated",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjp7InBob25lX251bWJlciI6IjA3MDUyMjE0MjEiLCJjb250YWN0X2lkIjoiNWM3NTM1ZWM2OWJlYzUyZmQ1Y2MwN2VkIn0sImlhdCI6MTU1MTE4NTQzNSwiZXhwIjoxNTUxMjcxODM1fQ.p0l_mnTwTNcYME2jmXtpEyjRXNsyE4Ws3wt_PWilBRc"
}`
description: Sends a message method : POST headers: content-Type →application/json Authorization: put a token got from authorization sample payload:
`{
"receiver": "5c1337021fbf86ef244f8534",
"message": "Test massage 3"
}`
description: Retrieves all messages belonging to the authenticated user method : GET headers: content-Type →application/json Authorization: put a token got from authorization returns:
`
`{
"success": true,
"data": [
{
"status": "sent",
"_id": "5c162261bcaf48e17ca22c76",
"sender": "5c155afb60bf0f0518328497",
"receiver": "5c1337021fbf86ef244f8534",
"message": "Test massage 3",
"created": "2018-12-16T10:01:05.372Z",
"__v": 0
}
],
"message": "SMS collected succefully"
}`
description: Updates a message method : PUT headers: content-Type →application/json Authorization: put a token got from authorization payload:
`{
"message": "How are you"
}`
returns:
`{
"status": "sent",
"_id": "5c743665282c7f95ee924357",
"receiver": "0781980273",
"message": "How are you",
"sender": "0705221421",
"created": "2019-02-25T18:39:33.062Z",
"__v": 0
}`
description: Returns one message by ID method : GET headers: content-Type →application/json Authorization: put a token got from authorization returns:
`
{
"status": "sent",
"_id": "5c743665282c7f95ee924357",
"receiver": "0781980273",
"message": "Hey dia how are you",
"sender": "0705221421",
"created": "2019-02-25T18:39:33.062Z",
"__v": 0
}`
description: Deletes a message you created by ID method : DELETE headers: content-Type →application/json Authorization: put a token got from authorization