C
C#15mo ago
emileSWAAA

❔ Event driven architecture

I have a question about some greenfield architecture and wondering how to best achieve this. Using .NET 7 and wanting to host on Azure with cloud-native services if possible. We (2 people) are creating a chatbot that summarizes conversations from WhatsApp using OpenAI. We have the following problem regarding the archicture design: Twilio sends a post request whenever someone sends a whatsapp message to a specific receiver to our API endpoint. The message gets put on a message queue (service bus) and this triggers an Azure function to process a response to the user or end the conversation We see that people send whatsapp messages right after each other, sometimes with delays of up to 2 minutes, these messages trigger functions and are being processed as a conversation on its own. We need to aggregate these messages into one single message to draft a response and if the conversation is ended a summarization. I am trying to think of ways we can create this without the need of distributed locks or timers. Anyone have some ideas how to best design this?
8 Replies
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Omnissiah
Omnissiah15mo ago
yeah, would end conversation be just a timeout? or like an idle timing also, what do you have to store the messages? how would the aggregator know where to take them?
emileSWAAA
emileSWAAAOP15mo ago
Correct. There is no real way of knowing when the batch is full. So implementing some sort of sliding countdown timer would mean end of the conversation. Creating a recurring cron job will work but due to the nature of the application we do not expect messages all throughout the day. I am thinking about using Azure Functions because of the Trigger bindings and cost effectiveness. Having a job being idle 24/7 might be a bit overkill. The thing with Azure Function triggers is that they get triggered for every message, while I only want to process a batch of messages if the timeout of 1-2 minutes has passed It could be I am overthinking this and a cron job would suffice, but I am looking for other options, feel free to ask if anything is unclear.
Omnissiah
Omnissiah15mo ago
so doesn't this responsibility fall on twilio? if you can't configure it to accumulate and send what other choices do you have
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
emileSWAAA
emileSWAAAOP15mo ago
We are not posting on Upwork. Just a two-man project. Summarization is expensive so repeating is not very cost efficient. I'd rather spend more on a recurring job than OpenAI tokens
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server