Home > Back-end >  Making a Notification API in C#
Making a Notification API in C#

Time:12-06

I'm a newbie at c#, but I'm trying to make a notification API that sends email notifications to authenticated users, much like the way Slack sends email notifications when you're away from the app and you've been mentioned or received DMs. I'm using vscode not Visual Studio, so it seems more challenging. The API is going to be used by a web app.

I am firmly convinced that there are tutorials on making this exact API, but I need help finding them. I'd really appreciate it if someone could tell me where to find tutorials on making an email and SMS notification API using C#. Alternatively, I will appreciate a walkthrough on how to create this API.

So far, I have found this tutorial useful: https://learn.microsoft.com/en-us/training/modules/build-web-api-aspnet-core/9-summary. But my question is does anyone know a tutorial that directly targets building an email notification API in C# (not a todo API or other kinds of API)?

CodePudding user response:

notification usual consist of parts:

  • data colector: Changes in data should be collected in some buffer (database) to be processed later, to don't make influence on existing process. Alternativelly you can execute notification immediatelly, in same thread with editing data.
  • template creator: changed data should be transformed to message (email, sms, twitter, html, excel, word, pdf etc). Message it self consist of static and dynamic parts. So you can develop one template for all similar messages. Template consist of text with special placeholders during processing those placeholders should be replaced with dynamic content (with collected data). So somewhere should be developed mechanism to store,edit,update,remove those templates (easiest mode - file system - folder with text files).
  • data processor: process/job/task which pickup modified data and record by record using one of template converting to final static message (or document).
  • message sending: another job which is trying to send messages by email server, sms server, network hub etc

You could develop own variant - last part could be hard to arrange, because of email box could be blocked in case when lot of messages are going to be send in short time period. sms(twilio), twitter or other services are paible.

You could find and use existing (usual paible) notification service. This service could provide you part of above described points (templates managment, template data processor etc). you just need to send those dynamic data to service api - rest will be executed on service server (aka: mailchimp).

  • Related