This app is responsible for managing all the login and messages for zipwhip for the Broadsoft Montreal hackathon for 2017. Zipwhip api docs can be found in the /docs folder. There is a free account you can get for zipwhip if you email them here: https://www.zipwhip.com/freetrial/
This app also stores all the data in a mongoLab database. This includes all messages sent from users to users as well as the phone numbers and names of contacts. We also currently store the hubLoginToken and the session for each zipWhip user.
hubJavaStarter handles all interactions with the hub api SMS-UI handles rendering of the ui
Coming soon!
Description: A url to test if the app is running and working
response:
'Hello!'
Description: This logs the user into zipwhip and stores their session in the DB. This only needs to be called once per user but it can be called as many times as you wish.
Post Body:
{
username: '5554443333',
hubLoginToken: 'token',
password: 'theUserPassword'
}
response: 200
Description: This sends a message from one user to another.
Post Body:
{
from: '5554443333',
to: '6665558888',
message: 'Hey buddy!'
}
response: 200
Description: you need to call this to receive any messages. Pass in the url that you want to be called each time a message is received. When that url is called, you will need to read the response property to see the actual message.
Post Body:
{
url: 'https://www.mydomain.com/handleWebhook', //You can call it any route you want
username: '5554446666', //the phone number of the person you are calling
}
response: 200
Description: Returns the number of unread messages for the user. The token is the identifier of the user and it has to be the same hubLoginToken you passed in the /login route.
response: 200, {count: 11}
Description: Returns all the messages between the two users
response: 200
[
{
"_id": "59133715e7af9c72ad496c40",
"from": "8445971754",
"to": "5062062704",
"message": "Hello",
"isRead": false,
"createdAt": "2017-05-10T15:51:49.457Z"
},
{
"_id": "59134324e7ca8780c5ae89e8",
"from": "8445971754",
"to": "5062062704",
"message": "This is a newer message",
"isRead": false,
"createdAt": "2017-05-10T16:43:16.863Z"
}
]
Description: Create a contact for a user
Post Body:
{
firstName: 'Jonathan',
lastName: 'ODonnell',
avatar: 'http://img.myimage.com/catAvatar', (optional)
phoneNumber: '8889990000', // the contact's phone number
username: '5554446666', // the phone number of the user
}
response: 200
Description: Get all the user contacts
response: 200
[
{
"_id": "59148fec778a8f77b848790c",
"firstName": "Jon",
"lastName": "ODonnell",
"avatar": "",
"phoneNumber": "7778889999",
"username": "8885556666"
},
{
"_id": "591490229c3b75780aaffbf0",
"firstName": "Jon",
"lastName": "ODonnell",
"avatar": "",
"phoneNumber": "7778889999",
"username": "8885556666"
},
{
"_id": "591490317cd06f783e441d75",
"firstName": "Jon",
"lastName": "ODonnell",
"avatar": "",
"phoneNumber": "7778889999",
"username": "8885556666"
}
]
- username (can be phone number)
- session (the zip whip session)
- hubLoginToken
- createdAt
- firstName
- lastName
- avatar
- phoneNumber
- user
- createdAt
- from (the number the message was sent from)
- to (the number the message was sent to)
- message (the text of the message)
- isRead (has the user viewed the message)
- createdAt
- tests
- Make it secure
- make all db calls return promises