How Best to Integrate Twitter with Salesforce

I have meaning to write this blog post for some time now and finally have some time to share with you my take on this functionality. A few months ago, I was trying to see how this functionality would work and how best to integrate Twitter with Salesforce. If you are familiar with Salesforce’s Web-to-Lead functionality and assume to integrate with Twitter you would  have to use this functionality you are right. What I will cover today is how to set up a simple integration with Twitter and convert potential followers to leads in Salesforce.

Twitter Cards

A Twitter card infrastructure allows you to have these rich media experiences that go far beyond a 140-character written message right within Twitter. You can attach rich photos, videos and media experience to Tweets that drive traffic to your website. Simply add a few lines of HTML to your webpage, and users who Tweet links to your content will have a “Card” added to the Tweet that’s visible to all of their followers. Currently, these are the types of Twitter cards available:

  • Summary
  • Large photo summary
  • Product
  • Player
  • Audio
  • Photo
  • Gallery
  • Application
  • Website
  • Lead generation –

The last card above, the Lead card allows you to grow your email list.  This card allows users to sign up for a special offer, view a white paper or opt in to a newsletter right from Twitter. With this lead card Twitter even fills in your email address so all you have to do is say yes. These cards stand alone; they can’t be attached to specific content or URLs right now.

Salesforce Setup

First you must have Salesforce Web-to-Lead functionality setup and running. See my post last summer on how best to set this functionality up. Once you have set up web to lead and identified the key fields you want to capture from the Twitter card, lets then take a look at the URL you will post in the Twitter card “Submit URL” field.

The Salesforce URL

Below is a sample URL, which can be generated from your Web-to-Lead set up. We will dissect this URL and show you how it works for your Twitter integration with Salesforce.
The URL above would actually place a lead in an Salesforce org if I had a valid Org ID where the “****…”  is located. Lets take a look at what this URL can do.
Key parts of the URL: 
1. This is the Salesforce web-to-lead URL.  It is generic, nothing specific about an org  –>
2.  oid=*************** is what links you to a specific Salesforce org ID.  This is what you need to place the lead into your your Salesforce org. To find your org id, review this Salesforce help article.
3. retURL=  is where Salesforce redirects you after the lead is generated. In this case, the user would be redriected to the Merivis Blog!
4. the other URL parameters are the same (first_name, last_name) as you get from the standard web-to-lead “generate web to lead form” in salesforce.
So we have the Web-to-Lead set up, we have the URL figured out and now we want the leads to come in from Twitter.  We are almost there, the last piece is to configure your Twitter card.  This will be all done through simple configuration in which  you are basically telling Twitter what the Salesforce field names are and what the URL to the Salesforce Web-to-Lead servlet is.

Twitter Card Setup

To set up your Twitter card, log into your Twitter account and find the Twitter card section to where you will go to “Technical Settings”. On this page, then you will set up your Twitter card for Salesforce leads.  Select “POST” as the function and  the Submit URL is from 1. above.  The Fallback URL is a backup in case the device can’t use the default Twitter card – link to the SFDC Web-to-Lead form actually on the company website somewhere.  Privacy policy link is the next one.
Inline image 1
now on the custom hidden fields – you MUST capture the org id (oid) per the screenshot below.  You could also capture other fields (lead source comes to mind with a static value of twitter, or the name of the specific ad you are running)
Inline image 2
One other hidden field you might use is the retUrl – where you get directed after the lead is generated.  I actually don’t think you want to add it, as I think twitter will want to keep you on/in twitter….but you can test it out optionally.
My recommendation – test out using your dev org.  If you have to sign up for twitter adverts, I am not sure what that cost is; I assume the company you are working for will already have an account you can play with if necessary as well.