How to notify an ASP.NET Core MVC web app about an event occurred in a third party app - http

I have a requirement wherein I need to perform certain action in my web application based on phone call receiving event that occurs in a third party application - Knowlarity SR calling app.
We are using Knowlarity Super Receptionist calling API to receive calls to a virtual number and then route those calls to call center Agents as per their availability. There is another web application we have built which call center agents uses to manage customers and orders. Agents login to this web application (web app in Azure) and places orders for customer who is calling over the phone from Knowlarity. Here the requirement is whenever Knowlarity routes the call to any agent and when the agent picks up the call, it should notify this action to web app (CRM) the web app should automatically redirect the same Agent to a specific page.
Please suggest a solution how I can listen to the call receiving event in Knowlarity and do some action(page redirection) on the web app side.
Thanks.
I tried writing an Api method in Web app which Konwlarity will call to send event notification with some information. Also tried implementing HttpHandler for this. Please suggest the correct approach for this. Remember that it is a Web app so multiple agents can login, they have their own session so how to handle this.

Related

Change user in testing time

I want to change or switch user in asp.net web application at time of automation testing. As there is no login page. The web application directly take user id from OS using (user.identification) and send to third party application and that send all the details of user like that user get login into web app.
Any one can tell me how change or switch user when do testing using protractor?

SignalR: Reply to Web Forms client on same machine as web application originating request

I'm looking for a way to support the following process:
Button is clicked in web application running on machine named PC1234.
Call is made to server (either the web server or an API on another server, it doesn't matter) to Do Something.
The server sends a notification to a Windows Forms client installed on PC1234 that the action is complete.
I've got the easy part working using SignalR. I can call a method on the web server and then send a notification with SignalR to ALL clients that the method has completed. The problem is notifying ONLY the client on the originating machine.
My initial plan was to include some unique identifying attribute of the machine with the call to the server which could then be used to direct the SignalR notification back to just that machine, but that doesn't seem to be possible.
An alternative idea was to have the call to the server include a unique reference and also update a file locally (i.e. a Cookie) with that reference, then have the client app poll the Cookie for new references and filter all SignalR messages received for that unique reference. This would be a bit clunky even if it worked, which it doesn't really, not least because I want this to work cross-browser, and different browsers store cookies in different places.
Ultimately this is to support printing locally and silently from a web application. The user selects a document in the web application, hits a print button, the request is sent to the server which retrieves the document from the database, saves it to a network share and sends a notification to a client app on the machine from which the print request was generated. The client app then prints the document from the network share and deletes it.
I never found a way to do exactly what I described in my question, but I came up with an alternative which worked well enough.
In both my web application and my Windows Forms client, the user was logged in with the same Windows credentials. I was therefore able to have the server respond to the button click in the web application by broadcasting a SignalR message to all SignalR clients where the same user was logged in, using
Clients.User(userId).send(message)
See this article for more detailed examples and instructions.
In my Windows Forms client, I included code to track how many instances of the client were connected to the SignalR Hub with the same user credentials and code to handle the receipt of a SignalR message from the server when multiple client instances were connected with the same user details (in my case, this meant displaying a message saying something like "You've requested a print from the web application but you're logged in at multiple workstations. Do you want the document to print here?").

Launching AngularJS (1.6) app from external application with User Authentication Token

I am looking forward for any help w.r.t launching my AngularJS (1.6) app from external application (A third party App, most probably will be .NET based) with User Authentication Token. This third party app will do authentication and load list table to Products, when they click details it should launch my app and load details of that Product, So I am looking forward to know how to pass ProductID, User Auth Token (or any other way maybe session cookies)

External Authentication Services with an Client page

I am using facebook/twitter logged in user to authenticate my web api. i followed this
Okay that was most likely what I what. But my view page will be differently hosted. That is user will be logging in with a different page and they will send an ajax request get values from api controller.
I would authorize the web api only to user who is logged in.
If by "differently hosted" you mean on separate domains, then you won't be able to share a cookie between the two. If you mean that the client is a iOS app or Windows Phone app running on a device, the general pattern is to use a "Browser Control" and build a little UI as part of your API site. You can show your users this UI in the browser control and then scrape the token out. If you use Azure ACS, this is much easier with the "javascriptnotify" protocol that enables the token to be pushed out of the browser control.
The best article I've seen on this is http://www.cloudidentity.com/blog/2012/04/04/authenticating-users-from-passive-ips-in-rich-client-apps-via-acs-2

how to send mails automatically using windows service in asp.net mvc

In my project, i have used schedule control. It can be able to fix appointments for single/several users. I have configured of sending mails to the selected users through save /edit appointment actions.
Now i need to send mails automatically using windows service for every 30mins to the selected users during appointment time. for e.g. if appointment spans for a user 2pm to 4pm, mail need to be sent for every 30mins bet 2pm to 4pm automatically.
I have installed windows service. But i don't know how to connect my MVC web project with the windows service. I'm using MDF database in my web project. I don't know how to process those datas in window service.
Please suggest me some way. I'm totally new to MVC and Windows service.
Thanks in advance.
The issue outlined in your question sounds like a good use of the Revalee open source project.
Revalee is a service that allows you to schedule web callbacks to your ASP.NET MVC application. Revalee manages task persistence and scheduling using a Windows Service, but leverages your ASP.NET MVC application to handle the processing effort (i.e., "the work"). In your case, your would use your MVC application to send an automated email messages to a user when the MVC application was called back by Revalee.
The following shows an overview of the workflow used by an MVC application with Revalee:
(source: sageanalytic.com)
When an appointment is scheduled, your application would register a callback action with Revalee. This would include a date & time to call the MVC application back as well as the URL to call. Therefore to register a callback with Revalee you might include the following method in your MVC application.
private void ScheduleAppointmentReminderEmail(int appointmentId)
{
// The DetermineAppointmentReminderTime() method is your private method
// which returns an appointment's next reminder time as a DateTimeOffset.
DateTimeOffset callbackTime = DetermineAppointmentReminderTime(appointmentId);
// The callback should at the task's end time
Uri callbackUrl = new Uri(
string.Format(
"http://mywebapp.com/Email/SendAppointmentEmail/{0}",
appointmentId
)
);
// Register the callback request with the Revalee service
RevaleeRegistrar.ScheduleCallback(callbackTime, callbackUrl);
}
When your MVC application receives the callback, the SendAppointmentEmail action might look like:
[AllowAnonymous]
[CallbackAction]
public ActionResult SendAppointmentEmail(int appointmentId)
{
// TODO 1. Validate the appointmentId,
// 2. Lookup the appointment's information, &
// 3. Send the email message
// ...
return new EmptyResult();
}
The Revalee website has a complete API Reference as well as instructions on how to install and configure the Windows Service. The service is available for easy deployment & intallation at Chocolatey, while MVC client libraries ready for use in Visual Studio are available at NuGet. (There are non-MVC client libraries too.) Naturally, as an open source project, Revalee's complete source code is available on GitHub.
Finally, in case it was not clear above, the Revalee Service is not an external 3rd party online scheduler service, but instead a Windows Service that you install and fully control on your own network. It resides and runs on a Windows server of your own choosing where it can receive callback registration requests from your ASP.NET MVC application.
I hope this helps. Gook luck!
Disclaimer: I was one of the developers involved with the Revalee project. To be clear, however, Revalee is free, open source software. The source code is available on GitHub.
I did´t understand your question very well, however, the connection point between the web application and the windows service is the database. Your web application writes in the database the pending appointments. Then, your windows service checks every 30 minutes, for example, if there is any pending appointment for which it has to send the emails. If it finds out that it has to send some emails, it sends them and marks the entry in the Db as completed (meaning that it has sent the notifications). You can also use Quartz.net as I mentioned in another answer, but a windows service is also a good solution.
You don't have to use the windows service. Everything you described can be solved by using the application built-in HttpModule aka Global.asax .
The high level concept is to keep the HttpApplication running, and within the life time of the application, which is your MVC web application deployed to IIS. This is to prevent the Application_End firing due to inactivity default at 20 minutes.
Once you kept the application running, you can schedule the preferred time interval to talk to database and send emails. This would be the simplest way to do your task.
There is a codeproject sample: http://www.codeproject.com/KB/aspnet/ASPNETService.aspx

Resources