# ICE - API Sample responses Dev API: https://dsypummp81.execute-api.us-east-1.amazonaws.com/dev/ Swagger and request documentation: https://app.swaggerhub.com/apis/ADMIN_334/ice-app_api/1.0.0 ### POST /create-sns-endpoint/{user_id}/ Create SNS (notifications) endpoint for corresponding device token. ### PUT /users/{user_id}/ #### Response ``` { "message": "User profile updated successfully", "updatedAttributes": { "created_at": "2024-03-14T04:02:17.014694Z", "is_registered": false, "full_name": "Viswajit Alternate", "email": "vv2339@columbia.edu", "gender": "male", "columbia_school": "SEAS", "icebreakers": [ { "question": { "prompt": "What's overhyped?", "chat": "What's something that's overhyped but you don't understand?", "profile": "Something that's overhyped but I don't understand is" }, "answer": "Taylor Swift" }, { "question": { "prompt": "Your unique skill", "chat": "What's a skill you've mastered that you are convinced no one else has", "profile": "A skill I've mastered that I am convinced no one else has is" }, "answer": "Licking my nose." }, { "question": { "prompt": "Blend 2 animals for perfect pet", "chat": "If you could blend two animals for the ultimate pet, what would it be?", "profile": "If I could blend two animals for the ultimate pet, it'd be" }, "answer": "Dog and Zebra" } ], "updated_at": "2024-03-27T03:57:05.379073Z", "is_photo_blurred": false, "user_id": "105084308459876091747", "looking_for":"more than friends", "connection": "google-oauth2", "interests": [ "sci-fi", "soccer", "reading" ], "dob": "05/04/1999", "vibes": [ "chill", "rizzler", "salty" ], "major": "Computer Science", "username": "viswajit_alt", "is_lgbtq": false, "is_deleted": false, "is_verified": false } } ``` ### GET /users/{user_id}?complete=true #### Response ``` { "created_at": "2024-02-13 05:49:52.236009Z", "is_registered": false, "full_name": "Viswajit Nair", "email": "viswajitnair@gmail.com", "gender": "male", "columbia_school": "SEAS", "icebreakers": [ { "question": { "prompt": "What's overhyped?", "chat": "What's something that's overhyped but you don't understand?", "profile": "Something that's overhyped but I don't understand is" }, "answer": "Taylor Swift" }, { "question": { "prompt": "Your unique skill", "chat": "What's a skill you've mastered that you are convinced no one else has", "profile": "A skill I've mastered that I am convinced no one else has is" }, "answer": "Licking my nose." }, { "question": { "prompt": "Blend 2 animals for perfect pet", "chat": "If you could blend two animals for the ultimate pet, what would it be?", "profile": "If I could blend two animals for the ultimate pet, it'd be" }, "answer": "Dog and Zebra" } ], "updated_at": "2024-02-13 19:18:55.067372Z", "is_photo_blurred": "false", "user_id": "116518837762263751050", "relationship_status": "single", "connection": "google-oauth2", "interests": "interests", "dob": "05/04/1999", "major": "Computer Science", "username": "joemama", "looking_for":"more than friends", "is_deleted": false, "is_verified": false } ``` ### GET /users/{user_id}/ #### Response As of now, this is the response for an 'incomplete'. There maybe some additions. ``` { "user_id":"116518837762263751050", "gender": "male", "full_name": "Viswajit Nair" # Note: this should be initialized if anonymous "VN" "interests": ["interests"], } ``` ### GET /presigned/{user_id}?file_type=file_type_var&access_type=access_type #### Response ##### access_type can be: - get - put Use put for getting urls to upload images/voice to. ##### file_type can be: - cropped - thumbnail - cropped_blurred - thumbnail_blurred - raw - voice First call request with qparam 'raw' before photo upload, and call a PUT request to the URL received with image/voice in the body. #### PUT for voice - PUT the presigned url with the voice file attached. This triggers storage and a subsequent backend process where the voice is cloned. After this, follow instructions in /generate/voice/{user_id} The url received from the request can also be used to load images (after uploading). ``` { "presigned_url": "https://ice-user-assets-dev.s3.amazonaws.com/116518837762263751050/raw-photo?AWSAccessKeyId=ASIA5TLEJNGLUB6KZLNE&Signature=8dqPhRlkIQwZIxPNwrjF6%2Bdo3BE%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEKX%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIQDXVpTFz73T%2BzO8EVdqoIcb6ipE4LSM38XDWdzgwDK%2BTQIgZp0DBmJ6ht%2FO6IgCwbJoyz7SL%2FdN7zwCMt96i3%2B1aIQqtQMIfRABGgw5MzQ5MDI1ODk4NDciDJTpGt6ovO4FGV3ItiqSA5xXBW6WAT0WQuISL13T0rhtk7N%2FARrImWmzQold1KwpvDZ5hXVTDsUqs%2FgNsNG9tG0oz3BkP10DlY7reU8aWB7II6ubLDVbs0MYy58HIqfHqlAU516hrUFwEX1Clm%2B%2F%2BI7KyhDnWVJ3MrBOx1iohTLtWLPkaX%2FfQ%2F0fHV3H6M8YRUMqL78sjFdicoR57Dq6mpi49XkzWlNZ79BL7hZlgFb2Qk692AOEFPjZC3VHWUGc%2BT3PTbW3RvMUIa5Zop%2F65f5wsPDR7JEByRj7p7Efdg%2BOQTJXVZGr3P5ZdsIHeRMVDWyiHVk9SzXPhYSsJ%2BchWP2bXjDP29wj5vbZJZJ1raPJCNkBWv3W2b2q%2FV9mwlTo%2BcUijMBjeKG24ItrVkynsn0%2FxwaqtKzAAQy7dmx1s8kV42kohTvH0Ld7j%2FATb7npcniX0U4rmRNUc1tRVwcyROlPiEUrGFgOmkvkXSyjmuVmdGNV7scLdAZ9cJAFgch5OtL1Q%2BrGsEKfeZIKrVP%2BAHVG91%2B0TT9fePn%2FlfHXO8bDsTD1mq%2BuBjqeAZh6mJCnqkU9DbFEgUD3d9UAYpU64uBioTljO3yBFrsJBy9e6d0eYZQlZEf8ZOKcpCL2eNzkdUuW2g1%2FPq97Geac5xloGsS38W%2Ba9Q5VAttN0VJV8dvpbp7ijbgxqys%2BB3jwgZUihuYIYRn8Zi2oPkqqoD9UsvxgOORk7ktCsCueGWoEs03kPhRGerir6vkg2QrBWiM%2Bftj7fen7wEkX&Expires=1707858821" } ``` ### POST /generate/voice/{user_id} This is the api to generate speech for a piece of text. Note: Only for onboarding NOT for chat. ``` { content:<string> } ``` Keep content as empty if retrieving the sample text to speech, else populate with text (going to be AI message). ``` { "message": "Voice generated successfully", "presigned_url": "https://ice-userassets-934902589847-dev.s3.amazonaws.com/116518837762263751050/voice-gen-sample.mp3?AWSAccessKeyId=ASIA5TLEJNGLQPXH477Y&Signature=1WvqdpmbdiJHt94Bjd6tQT8BKCo%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEHQaCXVzLWVhc3QtMSJIMEYCIQCUM4IOMFU0f71xz4vWV%2BtS%2FXkZ2MOzr0CtQVVD8BCkGgIhANgeD%2BFGQN0T05hNZFaSUBjK%2FidVssFHx6sbs%2BvbNGXVKrEDCG0QARoMOTM0OTAyNTg5ODQ3IgwaO3X%2FISK2ujtBZasqjgMKFgLtYYvagGUYbdlhysQb340PouXBOHaMwt80dEpOi08ZWXlfurSXXGRLuhxkbK5AUCjYKl89ngF3BsMx%2FV9wZ2ELOliiYAHz9mLMin9Yl4jq1dwj8fQSZ7UFNkgFRBvm9%2FKOatZSUbyB17wJKcrOuDpGMV6tT8KjS9md9i0fCuDNxNkRUCKcftqDCJ9ows0iSxBHSCTZ6Fy%2BRaFkAR47om36YaODKVQnfvzNoHLFoxckTnISu5SUPdumzcCGikfIhOY0PUzjbQA4nIhF2OqbjRe0i9Jaxlr7CvDuJ5MFZKygcRwFSmIsbrByunZ5m4kk5uHICT5qaQwOJ8DbvQhQL6BUtIwOyz88RChta7CwC8tUau1712Q6HXbg8xzBdaO23gj%2B%2F6xJ5hFgAgVdBxr34m%2BLVisCg2ONXCklrYE5EQyzNelYHM0QF9WRZwwakVXXCe0IQUBrMtuMnXIG7pUFOlpUKrAbxzSp3ECL9J1wqdamh6CGwpzgusrIIKzEl36V5RXJqmTE%2BlMmO9rl9zCZhZWvBjqcARs5cpurkmb6VpkjQc6AyIYZQMxNTX6e9%2FSvwuQrJmq%2Beygc7YmR1KGRKn6TbZFd1mFgwYvYIl%2BNkLVEyoKkMf4YavMzqZu2t9pbk1NGa35txrHCRfgeADyHifFp6LmLUv%2BbxO%2FD2Ovr8XPS7aLQz9Fi1tC%2FN%2BNLdmf4%2BN4Z%2BVNzB6wxKn1phPoBVik4IAB8BrAxWm5AYtfA5Eihmg%3D%3D&Expires=1709527214" } ``` ### GET /users/explore/{user_id}/ Retrieving explore page for users. user_id passed in case we need to add recommendation system or something. Sample response: ``` { "message": "Users retrieved successfully", "users": [ { "created_at": "2024-03-14T04:02:17.014694Z", "is_registered": true, "full_name": "Viswajit Alternate", "email": "vv2339@columbia.edu", "gender": "male", "columbia_school": "SEAS", "icebreakers": [ { "question": { "prompt": "What's overhyped?", "chat": "What's something that's overhyped but you don't understand?", "profile": "Something that's overhyped but I don't understand is" }, "answer": "Taylor Swift" }, { "question": { "prompt": "Your unique skill", "chat": "What's a skill you've mastered that you are convinced no one else has", "profile": "A skill I've mastered that I am convinced no one else has is" }, "answer": "Licking my nose." }, { "question": { "prompt": "Blend 2 animals for perfect pet", "chat": "If you could blend two animals for the ultimate pet, what would it be?", "profile": "If I could blend two animals for the ultimate pet, it'd be" }, "answer": "Dog and Zebra" } ], "updated_at": "<built-in method isoformat of datetime.datetime object at 0x7fd568c5d140>Z", "is_photo_blurred": false, "user_id": "105084308459876091747", "relationship_status": "single", "connection": "google-oauth2", "interests": [ "sci-fi", "soccer", "reading" ], "dob": "05/04/1999", "vibes": [ "chill", "rizzler", "salty" ], "major": "Computer Science", "username": "viswajit_alt", "is_lgbtq": false, "is_deleted": false, "is_verified": false, "image_keys": { "cropped": "https://ice-userassets-934902589847-dev.s3.amazonaws.com/105084308459876091747/cropped_photo.jpg", "thumbnail": "https://ice-userassets-934902589847-dev.s3.amazonaws.com/105084308459876091747/thumbnail_photo.jpg" } }, { "created_at": "2024-02-28 17:52:32.166182Z", "is_registered": true, "full_name": "Nikhil Nath R", "email": "test@example.com", "gender": "male", "columbia_school": "Columbia College", "updated_at": "2024-03-19T16:52:24.988220Z", "is_photo_blurred": true, "user_id": "65d8a4d4da180f3fba8c2ec7", "connection": "auth0", "interests": [ "Comic", "Jazz", "Anthology" ], "dob": "02/02/2002", "vibes": [ "Moody", "Wholesome", "Curious" ], "username": "user", "is_deleted": false, "is_verified": false, "image_keys": { "cropped": "https://ice-userassets-934902589847-dev.s3.amazonaws.com/65d8a4d4da180f3fba8c2ec7/blurred_cropped_photo.jpg", "thumbnail": "https://ice-userassets-934902589847-dev.s3.amazonaws.com/65d8a4d4da180f3fba8c2ec7/blurred_thumbnail_photo.jpg" } } ] } ``` ## Websocket API for chat TODO: Include refactoring changes and update responses. TODO: Changes after including LLM response. - Connection url : wss://my7jnqmy20.execute-api.us-east-1.amazonaws.com/dev/ - Connect with user id as query param: wss://my7jnqmy20.execute-api.us-east-1.amazonaws.com/dev?user_id={user_id} - Payload for succesfully sending a message at the beginning of a chat: ``` { action:"sendmessage", message:{ "content":<text typed by user / empty if it is voice note>, "modality":"text"/"voice" }, sender:<sender_user_id>, receiver:<receiver_user_id>, is_chat_start:true initial_assistant_message:<'chat' version of icebreaker chosen> } ``` - Payload for succesfully sending a message not at the beginning of a chat: ``` { action:"sendmessage", chat_id:<chat_id> // made in the backend, will be returned message:{ "content":<text typed by user / empty if it is voice note>, "modality":"text"/"voice" }, sender:<sender_user_id>, receiver:<receiver_user_id>, is_chat_start:false } ``` #### EXAMPLE Payload: ``` { "action":"sendmessage", "message":{ "content":"Hey boss can I habe piza pls", "modality":"text" }, "sender":"userb", "receiver":"usera", "is_chat_start":true, "initial_assistant_message":"Who do you think is overhyped?" } ``` Example response for sender: ``` { "response-type":"success-response", "message": { "message_id": "22eb7555-9175-4372-8ff6-ef51e55b4d87", "timestamp": "2024-03-10T01:51:51.118697Z", "chat_id": "ae831abf-2b0e-4398-b47f-6c3e943356f1", "sender": "userb", "content": "Hey boss can I habe piza pls", "role": "user", "receiver":"usera", "is_deleted": false, "voice_available": false }, "success": true } ``` Example response for receiver IF CONNECTED and IF ICE BROKEN: ``` { "response-type":"singular" "message": { "message_id": "22eb7555-9175-4372-8ff6-ef51e55b4d87", "timestamp": "2024-03-10T01:51:51.118697Z", "chat_id": "ae831abf-2b0e-4398-b47f-6c3e943356f1", "sender": "userb", "receiver":"usera", "content": "Hey boss can I habe piza pls", "role": "user" "is_deleted": false, "voice_available": false } } ``` Example response for both sender and receiver IF both CONNECTED and ICE NOT BROKEN, i.e LLM response.: ``` { "response-type": "singular", "message": { "message_id": "05d9a6bb-8b0f-46a0-9ce9-a0bf2ec7600f", "timestamp": "2024-04-04T04:30:07.313072Z", "chat_id": "0298376e-1aa9-457a-8d71-53b087ed8e79", "sender": "userb", "receiver":"usera", "content": "Interesting, you must be a talented athlete. So, what's your favorite team?", "role": "assistant", "is_deleted": false, "voice_available": true } } ``` Note the "role" can be user / assistant depending on whether it is a bot response or a user response. If role is "assistant" and "voice_available" is true, a follow up ping will be received on the websocket signifying that corresponding generated voice is ready: ``` { "response-type": "voice_ready", "message_id": "05d9a6bb-8b0f-46a0-9ce9-a0bf2ec7600f" } ``` retrieve the corresponding voice generation by accessing the bucket : - ice-messages-tts-934902589847-dev - Object Key is chat_id/message_id. Example object url: https://ice-messages-tts-934902589847-dev.s3.amazonaws.com/0298376e-1aa9-457a-8d71-53b087ed8e79/05d9a6bb-8b0f-46a0-9ce9-a0bf2ec7600f.mp3 ### GET /generate/icebreaker No payload/query param. Generates a random icebreaker question. Sample response ``` { "icebreaker": { "profile": "I'm convinced that", "prompt": "Convinced about this", "chat": "What are you convinced of?" } } ``` ### GET /generate/interests Retrieving the interests dictionary grouped by categories. ### GET /generate/voiceprompt Retrieving the text to be shown on the voice clone page during onboarding. ``` { "voice_prompt": "Amidst the digital chatter, whispers spoke of a legendary app. Ice, they said, where every connection felt like stumbling upon a hidden gem, each chat a captivating journey through enchanted realms." } ``` ### POST /social/icebreak/{chat_id}/ Set ice_broken to true or false. Payload `{ "ice_broken": <boolean>}` Success if 200 response. ### GET /data Get app data such as columbia school, interests, vibe_words ### GET /chats/{user_id}/ Retrieving all kinds of chats for a user. Sample response: TODO: update chats with sender_name and recipient_name, latest_message_id ``` { "all_chats": [ { "updated_at": "2024-03-14T15:37:41.265939Z", "recipient_user_id": "105084308459876091747", "created_at": "2024-03-14T15:37:41.265939Z", "initiator_user_id": "116518837762263751050", "ice_broken": false, "is_deleted": false, "chat_id": "b8cbb31d-c7e2-460a-9769-b247d5443189", "initiator_name":<initiator_name>, "recipient_name":<recipient_name> } ], "ice_broken_chats": [], "iced_sender_chats": [ { "updated_at": "2024-03-14T15:37:41.265939Z", "recipient_user_id": "105084308459876091747", "created_at": "2024-03-14T15:37:41.265939Z", "initiator_user_id": "116518837762263751050", "ice_broken": false, "is_deleted": false, "chat_id": "b8cbb31d-c7e2-460a-9769-b247d5443189", "initiator_name":<initiator_name>, "recipient_name":<recipient_name> } ], "iced_recipient_chats": [] } ``` ### GET /roll-ice/{user_id}/ API called when roll ice button is tapped. Currently returns a random user. Sample response: ``` { "message": "Ice Rolled! Compatible user retrieved successfully", "user": { "created_at": "2024-02-28 17:52:32.166182Z", "is_registered": true, "full_name": "Nikhil Nath R", "email": "test@example.com", "gender": "male", "columbia_school": "Columbia College", "updated_at": "2024-03-19T16:52:24.988220Z", "is_photo_blurred": true, "user_id": "65d8a4d4da180f3fba8c2ec7", "connection": "auth0", "interests": [ "Comic", "Jazz", "Anthology" ], "dob": "02/02/2002", "vibes": [ "Moody", "Wholesome", "Curious" ], "username": "user", "is_deleted": false, "is_verified": false, "image_keys": { "cropped": "https://ice-userassets-934902589847-dev.s3.amazonaws.com/65d8a4d4da180f3fba8c2ec7/blurred_cropped_photo.jpg", "thumbnail": "https://ice-userassets-934902589847-dev.s3.amazonaws.com/65d8a4d4da180f3fba8c2ec7/blurred_thumbnail_photo.jpg" } } } ``` ### GET /messages/{chat_id}/ Retrieve all messages of a chat. Ordered in ascending order by timestamp: ``` [ { "sender": "116518837762263751050", "content": "Hello alternate viswa how are you doing today", "role": "user", "voice_available": false, "timestamp": "2024-03-14T15:37:41.265939Z", "message_id": "d084f21c-f956-4a1c-962e-9e6166cff93d", "chat_id": "b8cbb31d-c7e2-460a-9769-b247d5443189", "is_deleted": false }, { "sender": "105084308459876091747", "content": "Hey bitch", "role": "user", "voice_available": false, "timestamp": "2024-03-14T15:46:46.731991Z", "message_id": "c12cfa57-f45d-4b83-8547-92c4d3c548af", "chat_id": "b8cbb31d-c7e2-460a-9769-b247d5443189", "is_deleted": false }, { "sender": "116518837762263751050", "content": "Shut up", "role": "user", "voice_available": false, "timestamp": "2024-03-14T15:47:27.655022Z", "message_id": "00accd05-d0b7-4133-885c-36ebae321e7f", "chat_id": "b8cbb31d-c7e2-460a-9769-b247d5443189", "is_deleted": false }, { "sender": "105084308459876091747", "content": "no i wont shut up", "role": "user", "voice_available": false, "timestamp": "2024-03-14T15:47:36.343939Z", "message_id": "6092ff80-9774-446a-9047-f1c09c8353a7", "chat_id": "b8cbb31d-c7e2-460a-9769-b247d5443189", "is_deleted": false } ] ```