create a slackbot to fetch text events from an internal api and send it to a dedicated slack channel
slack bot api can be found from:
https://slack.dev/python-slack-sdk/web/index.html#messaging
our internal api has two endpoints:
- /api/events/latest (a GET api to get a list of latest events, not acked)
[
{"id": "uid-1", "message": "test message", "epoch": 15000000},
{"id": "uid-2", "message": "test message 2", "epoch": 15000000},
...
]
- /api/events/ack (a POST api to acknowledge an event has been processed. It will remove events with the provided ids from the latest response) payload:
[ "uid-1", "uid-2"]
requirements:
- able to push the latest events to a specified slack channel with proper error handling
- timely (send out the message asap)
- high availability
- shall not send duplicated messages to the channel
we would like this run in k8s
task:
- app implementation
- dockerize can use base image
python:3.9.7-slim-buster
- deployment strategy (k8s)