Topcoder message service is the backend for all topics&conversations on Topcoder Connect. Right now it is based on Discourse, but we are in the process of moving to our custom messaging backend (we'll save all the topic posts data to our Postgres database). To complete the migration off of Discourse we need to support email responses for old topics - the ones created before we move to the new system. The idea is to keep Discourse running for some time (to receive the incomming emails) and use webhooks to forward the new messages to the message service.
In this challenge we will be updating the tc-message-service - use feature/discourse-migration branch as base. Here are the requirements:
1. Add a new endpoint (/v5/topics/webhooks/discourse) which accepts JSON payload in POST. For payload data format, please refer to discourse webhook documentation at https://meta.discourse.org/t/setting-up-webhooks/49045.
2. Deploy Discourse locally (here is a DG), add a webhook and point it to the endpoint created in #1
3. In the new endpoint dump the raw payload to a table in DynamoDB - create a new db and table for this purpose. This temp storgage should just store raw payload and status of the processing (initialize with 'pending') . If the endpoint is successful in its intended operation, update the status of the entry for this call to be 'completed' or if there is any error in the operation, update the status with 'error'. Aws SDK is already a dependency in the message service and credentials are configured in config/default.js so we just need to add the configuration for the dynamodb url.
4. After dumping the raw payload, create the post according to the payload data.
5. Update the status in the temp table as suggested in #3.
6. Verify that when a post is created via replying an email, the discourse webhook is called in the same way as with creating topic/post with API and the new endpoint works fine with it.
Add detailed logging to all updated code with debug/info levels
Final Submission Guidelines
Submit the updated code for message service
Submit an updated Deployment guide
Submit a short demo video