Salesforce outbound messages and visualforce
So I’ve been working on a project recently. A crazy one. One I hope to be able to package and sell on the app exchange.
What I am doing, is attempting to create a Salesforce application that will be packagable and sellable in the appexchange market. The challenge I am facing is allowing an end user to select when an apex class will be invoked, and pass their own data to it. I don’t know if a user will want to call a class when a contact is created, or a lead is updated, or an opportunity is deleted. The application is simply used for sending text (SMS) messages, based on criteria the user sets. The good news is that my application is pretty much done, save for one step. The bad news, that one step may be impossible, at least how I am trying to accomplish it.
My first thought on how to accomplish this was use a workflow rule (since workflow rules are easy enough for even regular end users to create) to send an outbound message to a visualforce page that comes with the app. The visualforce page would receive the SOAP data (which lives in the http request data), parse it out and send the data contained within to an apex class, which does the rest of the hard work of actually sending the message. The problem here is that, as far as I know, visualforce/apex have no way to access the data contained within the http request. Hence the SOAP data that is passed is useless, it is lost.
The key thing is here, is that I simply need an easy way for users to select when the apex class will be called, and what data they will pass to it (it only needs the phone number and the message). I don’t really care how it happens as long as it is easy for the user to set up.
If this will not work, I only have two other ideas. One is to make the workflow rule send an email to a designated email address that has a bot monitoring the inbox, which checks the mailbox every few seconds, reads the emails, extracts the message data (the email would probably have XML in the body) then with that information call the apex method that sends the message. The other approach is to have the outbound messages go to a webservice that my company controls on premise, which COULD access the SOAP data in http request, parse it out, then call a visualforce page associated with the target account and pass the message and phone in the URL as arguments.
I have just emailed a Salesforce engineer that I met recently and maybe he’ll be able to come up with a way to doing what I want to accomplish. Otherwise, if you have any awesome ideas, feel free to leave them in the comments. I’ll give a free copy of the app to anyone who can solve this last problem.