Salesforce Pinger

Sunday, February 7, 2010

Lets Salesforce Talk With Your Team On GTalk

Introduction
An application used to ping your team on Gtalk (or any IM) whenever you want. For example if you want whenever you won an opportunity you want to send a (ping) your team on GTalk with its details. So, you can write one trigger on Opportunity and send message to your users by using just a single line of code:-

BotService.sendMessage('Hey!!!We won this opportunity');

Is it seems interesting!!!

Prerequisites and Setup:
1) You need to sign up for a new Bot. Go to IMified (http://www.imified.com) and sign up for a new Bot. Give one public url for your bot. It may be any valid url as far i know. I used a simple Salesforce Public Site VF page url to register. This VF page i have given with my package. You can choose any. The main important thing is here "BOT Key".
When you are completed with creation of Bot. You will get one imified bot email id like:
sfpinger@bot.im

Now, you can distribute your team this bot email id to add in your GTalk as Chat contact.


2) Now just install my "Salesforce Pinger" package from here.

https://login.salesforce.com/?startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04t90000000HG0o

(Link)

Proceed with installation step by step. (If you face any problem then mail me :) )

3) After installation, Go to Setup->Security Controls->Remote Site Settings->Add below url for your trust

https://www.imified.com



4) After package installation you will get a new Tab "SFPingers". Click on this tab, Click on New Button. A new Configuration page will be opened. Please note that YOU MUST HAVE At least one record properly configured here, otherwise SF Pinger application will not work properly. Please fill this form, all fields. Fields are self explanatory.

a) Name:- Given any name like "SF Config"

b) BOT KEY:- Provide your registered Bot's Bot Key.

c) Allowed Pinger Users:- Give comma separated user's email here who has added your bot to their GTalk or in IM and whom you wanted to get notified(pinged) on some action.
If you leave this field empty then all users who have added your bot will be notified. (No filtering)

d) Bot Username:- your bot application usename (Imified account username)
e) Bot Password:- your bot application password (Imified account password)


5) Now, you have done!!! Just use one line of code to send messages to your team or see one proper example below to see how it works.

Suppose whenever one opportunity stage changed to 'Closed Won', you want to send your team a message with Opportunity I d and Opportunity Name. Here is the trigger code:-

------------------------------------------------------------------------
trigger opportunityPinger on Opportunity (after insert, after update) {
Set oppNames = new Set();
for(Opportunity op: Trigger.NEW){
if(op.StageName == 'Closed Won'){
oppNames.add('[ Id: ' + op.Id + ' , Name: ' + op.Name + ' ]');
}
}

String opNames = 'Below Opportunity(s) are Closed Won:\n';

for(String str: oppNames){
opNames += str + ',';
}

//THE MAIN CODE FOR PINGING MESSAGES
BotService.sendMessage(opNames);

}
----------------------------------------------------------------------



6) Just open one opportunity and change its stage to 'Closed Won' and save it. AND.....
You will get a GTalk pinger message suddenly from your GTalk saying:-

Below Opportunity(s) are Closed Won:
[ Id: 00690000002LtoJAAS , Name: Test Opp ]


Quite interesting and Useful too. Isn't It?


For any further help. Mail me. :)

Aslam Bari
aslam.bari@gmail.com

Followers

About Me

My photo
Salesforce Certified Software Professional

Expertise In SFDC Solutions integration with adhoc web technologies including:-
1) Twilio Cloud Telephony
2) Google Apps API
3) Phonegap
4) AngularJS / BackboneJS / RequireJS
5) Android Apps SDK
6) Payment Methods (ex. Paypal)
7) Box.Net API / DropBox API
8) JQuery / JQuery Mobile / InfusionSoft
9) J2EE/.NET/PHP/Python/Ruby