Real-Dev-Squad / todo-action-items

A running list of todo items for Real Dev Squad site
MIT License
4 stars 8 forks source link

Cloudfare worker to post messages to discord channel #209

Open somyadh opened 5 months ago

somyadh commented 5 months ago

Issue Description

We need to setup a Cloudfare worker which will post messages in a given Discord channel. This worker can be used to build features later on, like pull updates from RDS website and post messages for it in dedicated channels.

Expected Behavior

There will be two ways this worker can be invoked:

Worker can post multiple messages to 1 channel. Maximum number of messages can be 10 as Discord rate-limit is 10 messages per 10 second. Invoking function will hold responsibility of batch processing and handling rate limitations.

Open questions:

Does this need to be created as a generic service which other features can call? Or just the task progress updates will be using this.

Yes this will be generic service

What is the acceptable range of latency for the messages to be posted?

TBD

100% messages delivery guarantee is required?

Yes

If this is going to be generic service, do we want to make CF workers per channel?

Not really but open to discussion in design phase

Current Behavior

Screenshots

Reproducibility

Severity/Priority

Additional Information

Checklist

iamitprakash commented 5 months ago

@somyadh yes 100% messages delivery guarantee is required.

prakashchoudhary07 commented 5 months ago

Does this need to be created as a generic service which other features can call? Or just the task progress updates will be using this.

We should make it generic enough, that other services can call it Ex: Message on progress update, on task assignment, approval/rejection of extension, or when applying for OOO

If this is going to be generic service, do we want to make CF workers per channel?

Why do we need to make a CF for each channel?

There will be two ways this worker can be invoked: Directly calling the CF worker - this is if you are calling from a service where this worker is hosted Calling an endpoint that calls the CF worker for you - this is if you are calling another service, this endpoint will make sure you are authorized to do so

Here I am a little bit confused, can you please explain a bit more on how directly calling CF workers from the service where a worker is hosted, will not be protected?

somyadh commented 5 months ago

@prakashchoudhary07

If this is going to be generic service, do we want to make CF workers per channel?

Why do we need to make a CF for each channel?

The only case where we would want to do this is: if we want our service invoking the worker to be dumb and not know of which channel it needs to send its message. Kind of decoupling both the things.
Although now I think we can achieve this by having some kind of mapping of message type and its corresponding channel in KV. The invoking service just sends the message type and CF worker will figure out which channel to post.

There will be two ways this worker can be invoked: Directly calling the CF worker - this is if you are calling from a service where this worker is hosted Calling an endpoint that calls the CF worker for you - this is if you are calling another service, this endpoint will make sure you are authorized to do so

Here I am a little bit confused, can you please explain a bit more on how directly calling CF workers from the service where a worker is hosted, will not be protected?

My bad, this from a service where the worker is not hosted. Assuming CF worker is in website-backend and I want to access from something else like cron-job or something, then in that case. I am also bit confused here because I am not sure how all things works together, so not sure if this is even required.

somyadh commented 5 months ago

Had a call with @ankushdharkar, this will be a generic service to be used by multiple other features.