Challenge Overview
Technology stack
-
AWS Lambda
-
AWS API Gateway
-
DynamoDB
Project background
We built several bots for communication from/to Topcoder Slack, Client Slack, and Client MS Teams. The current architecture is as below.
In this project, we want to build the bots with the same functionality on AWS Lambda so that we can gain the benefit of serverless. The final architecture should look like
Here is the code of the existing bots for your reference. You might pull the custom code from them as needed.
-
The code of the bot for communicating between Topcoder Slack and the client Slack: https://github.com/topcoder-platform/Topbot/tree/dev. Related past challenge spec: https://www.topcoder.com/challenges/30099617
-
The code of the bot for communicating between Topcoder Slack and the client MS Teams. https://github.com/topcoder-platform/MS-Teams-bot-processor/tree/master. Related past challenge spec: https://www.topcoder.com/challenges/30101366
For understanding detailed steps of interaction between bots, follow the description of these past challenges.
Currently, both of the bots were built by
-
NodeJS + Express
-
MongoDB (Used by Botkit)
In this project, we will re-implement them with
-
AWS Lambda + Serverless tool
-
DynamoDB
-
No Botkit anymore
General requirements
In the last challenge, we implemented the client Slack Lambda and enhanced Central TC Lambda, in this challenge, we are focusing on the client Teams Lambda implementation, and also extend the implementation of the Central TC Lambda.
The client Teams Lambda should
-
forward the requests from Client Teams to the TC Slack via Central TC Lambda, then Central TC Lambda will process these requests and sends them to TC Slack.
-
handle the requests/responses from TC Slack via Central TC Lambda, then process and send them to Client Teams.
The scenario should be
1. In Client Teams, clients issue a request command to send a small project description message. For example, Issue a command @topbot request I need to build an email reminder service. “I need to build an email reminder service” is the description of the command, it can be any text. Then the client Teams Lambda intercepts the request command and calls the API of Central TC Lambda to initiate the request. You need to implement the API in Central TC Lambda.
This would send the message to the TC Slack channel (in the Topcoder team) where the message will be shown along with a button “Post a response".
2. Clicking the “Post a response" button will open a dialog with a text area for the user to post a response (ex “Sure, let me add you to our Slack channel to discuss the project further”, the response message is arbitrary).
3. Clicking “Post” will send the response to the Client Teams channel as a regular message (both request and response should be visible in the originating channel). Central TC Lambda will intercept the response and call an API of the client Teams Lambda to forward the response to the Client Teams. You need to implement the API in the client Teams Lambda.
After the response is sent, we should be able to see
(1) an acknowledgment should be posted to the TC Slack.
(2) The response is posted back to the Client Teams with the “Accept” and “Decline” buttons
4. Clicking on the “Accept” button on the Client Teams will send a message to the TC Slack. The client Teams Lambda will intercept the message and call an API of the Central TC Lambda to forward the message to TC Slack. You need to implement the API in Central TC Lambda. Then in the TC Slack, there should be a message like “Great, the client accepted the project, please provide an awesome project name” with the “Provide Project Name” button.
In the Client Teams, there should be an acknowledgement message like “You accepted the project”.
5. Clicking on the “Decline” button on the Client Teams will send a message to the TC Slack. The client Teams Lambda will intercept the message and call an API of the Central TC Lambda to forward the message to TC Slack. You need to implement the API in Central TC Lambda. Then in TC Slack, there should be a message like “Sorry, the client rejected the project”.
6. Clicking on the “Provide Project Name” button on the TC Slack will pop up a dialog for entering the project name.
Add a name and click the Post button, then a project is created on Topcoder Connect. Then a project created message is posted to the Client Teams. Central TC Lambda will intercept the message and call an API of the client Teams Lambda to forward the message to the Client Teams. You need to implement the API in the client Teams Lambda. Then the Client Teams will receive the message like “Your project was approved. Now you can use @topbot email command to invite more people in your project via email IDs”.
In the TC Slack , there should be an acknowledge message like “The project was created successfully”.
7. In the Client Teams, issue email command to invite members to the Connect project via email IDs. For example, issue the command @topbot email billsedison@test.com will send an invite to billsedison@test.com.
After the successful invitation, send a message with a link to the Connect project in the Client Teams. In TC Slack, a message is posted to say that “User with <email ID> has been successfully invited to the project”. Replace <email ID> with the actual email ID in the email command.
Then we can see the project and invited members on the Connect.
8. The help command should also be implemented in both Central TC Lambda and the client Teams Lambda.
Please note all the following up messages, responses, commands should be replied in the request thread that was posted in step 1).
All the API endpoints should be described in a swagger doc.
The existing Central TC Lambda code is in https://github.com/topcoder-platform/Topbot/tree/central-lambda
The code of the original bot is https://github.com/topcoder-platform/Topbot/tree/dev. You can take the code for reference.
For the DynamoDB storage:
-
The created project should be stored in the table projects in DynamoDB. Each record should include
-
Created project description
-
Requester (client email or name)
-
TC Slack user’s email or name who is interacting during the project creation
-
Timestamp
-
For the Connect integration:
You need to work on the dev Connect. The address is https://connect.topcoder-dev.com, you can use your own Topcoder credentials to log in.
To create a project in Connect, you can call the API POST https://api.topcoder-dev.com/v4/projects/
To invite a member to the Connect project, you can call the API POST https://api.topcoder-dev.com/v4/projects/<project-id>/members/invite/
You can check the swagger doc to get details of the Connect API.
Please keep all the service endpoint and required vars in the .env file. The test accounts for dev Connect will be provided in the forum.
Important notes
Please handle the edge cases properly, like
1. Invite the user who is already invited
2. Try email command in non-request thread
3. Multiple clicks on Accept and Decline
Please ensure don’t break any existing functionality.
Please take care that the bot created for MS Teams should be one time configurable and should be distributable to be installed via the zip file. (Which MS Teams supports intrinsically)
Referenced code
We already implemented the same workflow in a separate project, please check: https://github.com/topcoder-platform/MS-Teams-bot-processor/tree/connect_integration_devFinal Submission Guidelines
-
The full source code of the client Teams Lambda
-
The updated source code of Central TC Lambda or git patch against the latest commit hash of https://github.com/topcoder-platform/Topbot/tree/central-lambda
-
The swagger doc of the API in yml format.
-
The swagger UI or Postman collection to verify the API.
-
Deployment guide, make sure its properly described step by step, it should include the screenshots.