PhoneML - Teleku. Lets Explore It!!!

Tuesday, March 30, 2010 by Aslam - The Alexendra
Hi,
Last day I Explored PhoneML by Teleku. It is very good "Phone Web Service API". Enterprise-grade, cloud-based RESTful Phone Web Service API for building speech & touch tone Voice and SMS phone applications! Control any phone with simple & open PhoneML XML or JSON Web responses that work with all Web programming languages.



The best part i found with Teleku is that i can easily test my application built on Teleku using "Skype" without need of any Phone etc. (My last experience was with Twilio, a very advance and cool TwiML APIs. But the applications i built on Twilio, i had to test it using a Phone, by that time they do not provide Skype support, as per my knowledge. Dont know, now they have provided or not).

So, it is very easy to build your extension applications on Teleku and test it on Skype. Here are the steps:-

1) Register for free on Teleku.
2) Make your sample application using <Speak> PhoneML as below
<phoneml><speak>Hello Dear, how are you</speak></phoneml>

3) Now you will be provided one extension number.
4) After saving your application , you will be provide some numbers to call including Skype. Just click on Skype call and you will be prompted for entering Extension number. After entering you will listen you message. Isn't it good.

Teleku Provide folloing PhoneML commands:-

i) <speak>
<speak> allows you to speak or read text-to-speech (TTS) sentences and data to the caller

ii) <play>
<play> allows you to play MP3, WAV, or VOX audio files to the caller.

iii) <input>
<input> allows you to specify input options (grammars) to collect from the caller. These options can include both numeric touch tone options or words for speech recognition (ASR). Values are separated by commas. If you are interested in allowing the caller to enter or say a string of digits, you may specify free form entry as <input>digits<input>.

iv) <record>
<record> allows you to record an audio file and post it to your desired URL.

v) <transfer>
<transfer> allows you to transfer the call to another number. Note: ";postd=ppp1234" or simply "x" can be added to the dial string to represent pauses in dialing.

vi) <goto>
<goto> allows you redirect the flow of the voice application to another URL for processing.

vii) <hangup>
disconnects the call. You may specify a URL of your application to call for processing within the tags.

So go and Explore yourself:-

Teleku


Now my next plan is to integrate this with Salesforce Off Course !!!

Thanks
Aslam Bari


Posted in | 1 Comment »

RSS Feed Power With Salesforce

Tuesday, March 9, 2010 by Aslam - The Alexendra
Hi All,

Here i am again with something interesting thing with Salesforce.

Do you think how it is cool if our Salesforce Organiztion's information will be displayed on variety of Adhoc Web clients. For example I want to display my open cases from my organiztion on iGoogle Home page as a Gadget, my Blackberry or iPhone mobile or My Gmail , Yahoo page or GTalk or Google Reader and so on .... at the same time and same information. Isn't it cool!!!


Yes this is the Power of RSS Feed.


What Is RSS and Why to use it.

RSS was designed to show selected data.

Without RSS, users will have to check your site daily for new updates. This may be too time-consuming for many users. With an RSS feed (RSS is often called a News feed or RSS feed) they can check your site faster using an RSS aggregator (a site or program that gathers and sorts out RSS feeds).

Since RSS data is small and fast-loading, it can easily be used with services like cell phones or PDA's.

Web-rings with similar information can easily share data on their web sites to make them better and more useful.

So, here in this tutorial i am going tell you how you can convert Case Information like your case number with priority and a small Case summary from your Salesforce Organization into RSS Feed and then how you can consume these feeds into your iGoogle/My Yahoo home page or any variety of consumers.

1) Make a contoller with following code (RssFeedController):-

public class RssFeedController{
public List<Case> caseList {get;set;}
public RssFeedController(){
caseList = [SELECT Id, CaseNumber, Subject, Priority from Case];
}
}

2) Make a Visual Force with following code (RssFeedGenerator):-
<apex:page contenttype="text/xml" sidebar="false" showheader="false" controller="RssFeedController">
<rss version="2.0">
<channel>
<title>SFDC Case List</title>
<description>The List gives you all cases open in Your SFDC Org</description>
<link>https://ap1.salesforce.com/500?fcf=00B90000001SEXr</link>
<apex:repeat value="{!caseList}" var="cnt">
<item>
<title>{!cnt.CaseNumber} - {!cnt.Priority}</title>
<description>{!cnt.Subject}</description>
<link>https://ap1.salesforce.com/{!cnt.Id}</link>
</item>
</apex:repeat>
</channel>
</rss>
</apex:page>

3) Enable sites in your organization and add VF page/Contoller to you sites. Also provide read permission on Case object for sites.

4) Now open your sites with our VF page like this:-
http://labsprojects-developer-edition.ap1.force.com/rssfeedgenerator

5) What you see on the page? Your page is converted to a RSS Feed Generator. Isn't it good!!!.
See the above section is for RSS Feed subscribtion area. The below is your feeds.


6) Now you can subscribe this page to variety of Feed Readers like google, yahoo , blogs etc.
For example click on My Yahoo or google from the top dropdown and click on subscribe. It automatically add one Feed Gadgets to your My Yahoo or iGoogle page like below:-



7) Now you can also play with it and add the above rss feed url to any consumer which support RSS Reading like blackberry, iPhone, GTalk, blogs or even your custom RSS Reader for you website.
For Example:-
a. iGoogle





b. My Yahoo


c. GTalk: There are many variety of free available bots which you can add into your gtalk for RSS Feed reading.

d. BlackBerry and iPhone: You can easily consume your rss feeds into your blackberry and iphone

e. Google Reader: Its easy to embed your rss feed into your Google Reader and let the worlds know about it

f. SMS: You can make one Google Channel with your RSS Feed. Then make it SMS enabled and whoever subscribe it , will get notified whenever a new feed comes via SMS.

g. Blog: There are many gadgets which are available for feed reading and you can just plug them into your blog easily into sidebar etc.

h. Website: Of course you can parse your rss feed with any language and add to your website.

So without login or not much code we can view useful information from our salesforce org to any of our client consumers. so, Play with this Good Feature.

Thanks
Aslam Bari

Salesforce JQuery AutoComplete Dropdown

Thursday, March 4, 2010 by Aslam - The Alexendra
Hi All
In previous 3 months i came across same type of Task in different projects. That is "AutoComplete Dropdown Textbox" for Account, Contact or different types of SObjects (Custom Objects).

I used JQuery Autocomplete plugin for this task here. It was working perfectly. But i was tired to do same stuff again and again from scratch like uploading jquery resources (js, css), making component, making class, integrate etc.

Then i decided to make it as a installable Package so that anybody can install it easily and do changes according their needs. You can install package from here

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

This package contains following components:-

1) Resources:- JQueryDialog, popupcss, popupjs
2) VF Page:- Search, AutocompleteTest
3) Apex Class:- ACSearchController
4) Component:- AutoComplete

The "AutoComplete" VF Component is main part and contains all js, css and client side login. Search page and ACSearchContoller is your Database related stuff means which SObject you need to query and output format etc. There is a Test VF Page "AutocompleteTest". After installing you can run this VF page, it contains one simple sample for Autocomplete Example for Contact object.

Give it a try!!!

Thanks
Aslam Bari
Posted in | 20 Comments »

SFDC Multilingual Page Now Easy

Tuesday, March 2, 2010 by Aslam - The Alexendra
Hi All,
Today I am going to show you quick way by using small piece of code you can turn you complete page in the language you want for end user. There is no need of any Translation configuration or anything...etc. I am going to do this using simply google translation apis. Lets go together:-

1) Identify elements on your page which you want to translate. For example label, h2, div, p tags etc.
<label>First Name<label>

2) Use below code to translate all "Label" on your page. The below code is converting english to french:-


<script src="http://www.google.com/jsapi" type="text/javascript">
</script>
<script type="text/javascript">

google.load("language", "1");

function initialize() {
allLabels = document.getElementById("maindiv").getElementsByTagName("label");
for(var i = 0; i < allLabels.length; i++){
translate(allLabels[i]);
}

}

function translate(lbl){
var text = lbl.innerHTML;
google.language.translate(text, "en", "fr", function(result) {
if (!result.error) {
lbl.innerHTML = result.translation;
}
});
}
google.setOnLoadCallback(initialize);
</script>

3) Now make one Dropdown with the language list you want to show user to select and convert:-


<select onChange="changelanguage()" id="languagelist">
<option value="en">English</option>
<option value="de">deutsch</option>
<option value="pt">português</option>
<option value="fr">français</option>
<option value="ja">日本語</option>
<option value="ar">عَرَبيْ</option>
<option value="it">italiano</option>
<option value="ru">pусский</option>
<option value="po">polski</option>
<option value="zh-CN">中文</option>
<option value="es">español</option>
<option value="ko">한국어</option>
<option value="nl">nederlands</option>
<option value="hi">हिन्दी </option>
<option value="el">Ελληνική</option>
<option value="ro">română</option>
</select>

4) JS method to trigger the this:-

<script>
function changelanguage(){
var language = document.getElementById("languagelist").value;
window.location.href = "/apex/Translator?language=" + language;
}
var lang = "{!$CurrentPage.parameters.language}";
var language = document.getElementById("languagelist");
language.value = lang;
</script>


5) Conclusion and Full Example:-
Suppose you want to make a customer Contact (Standard Object) form, see the below code of Visual Force Page and screenshot for example:-


<!--
Name : Translator
Author : Aslam Bari
Last Modified : 02-March-2010
Version : 1.0
Description :
-->
<apex:page standardController="Contact">
<!-- Transalator Code -->
<script src="http://www.google.com/jsapi" type="text/javascript">
</script>
<script type="text/javascript">

google.load("language", "1");

function initialize() {
allLabels = document.getElementById("maindiv").getElementsByTagName("label");
for(var i = 0; i < allLabels.length; i++){
translate(allLabels[i]);
}

allH2 = document.getElementById("maindiv").getElementsByTagName("h2");
for(var i = 0; i < allH2.length; i++){
translate(allH2[i]);
}

allH1 = document.getElementById("maindiv").getElementsByTagName("h1");
for(var i = 0; i < allH1.length; i++){
translate(allH1[i]);
}
}

function translate(lbl){
var text = lbl.innerHTML;
google.language.translate(text, "en", "{!$CurrentPage.parameters.language}", function(result) {
if (!result.error) {
lbl.innerHTML = result.translation;
}
});
}
google.setOnLoadCallback(initialize);
</script>

<!-- Transalator Code -->



<apex:form>

<div style="width:90%;text-align:left" id="maindiv">
<apex:sectionHeader title="Contact Form" subtitle="Multilingual Contact Form"/>
<label>Please select a language for translation the page: </label>
<select onChange="changelanguage()" id="languagelist">
<option value="en">English</option>
<option value="de">deutsch</option>
<option value="pt">português</option>
<option value="fr">français</option>
<option value="ja">日本語</option>
<option value="ar">عَرَبيْ</option>
<option value="it">italiano</option>
<option value="ru">pусский</option>
<option value="po">polski</option>
<option value="zh-CN">中文</option>
<option value="es">español</option>
<option value="ko">한국어</option>
<option value="nl">nederlands</option>
<option value="hi">हिन्दी </option>
<option value="el">Ελληνική</option>
<option value="ro">română</option>
</select>
</select><br/>
<label>This is a demo page to show the power of Google Transation API with Force.com :-</label>
<apex:pageBlock title="Please fill the form">
<apex:pageBlockSection>
<apex:inputField value="{!Contact.FirstName}"/>
<apex:inputField value="{!Contact.LastName}"/>
<apex:inputField value="{!Contact.Email}"/>
<apex:inputField value="{!Contact.Phone}"/>
<apex:inputField value="{!Contact.Title}"/>
<apex:inputField value="{!Contact.Birthdate}"/>
<apex:inputField value="{!Contact.Address__c}"/>
<apex:inputField value="{!Contact.Description}"/>
</apex:pageBlockSection>
</apex:pageblock>
</div>

</apex:form>
<script>
function changelanguage(){
var language = document.getElementById("languagelist").value;
window.location.href = "/apex/Translator?language=" + language;
}
var lang = "{!$CurrentPage.parameters.language}";
var language = document.getElementById("languagelist");
language.value = lang;
</script>
</apex:page>


Screen Shots:-
Form in Hindi---

Form in Arabic---


And many more....

Isn't it a quick way to do interesting thing :)

Aslam Bari
Posted in | 8 Comments »