Closed Bug 908451 Opened 11 years ago Closed 11 years ago

[Firefox & You] Potential email + Twitter Integration

Categories

(www.mozilla.org :: Newsletters, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jdavis, Assigned: jayleen)

Details

(Whiteboard: [kb=1118988] )

Twitter has a neat integration for their users to easily signup for our Firefox & You newsletter with one-click (they'll still have to confirm their subscription through our double opt-in process = awesome).

Here are the details to get the integration going by setting up our own endpoint:

1. The main requirement for the endpoint partner is to host a secure https URL where the leads data can be submitted by Twitter. Partner will need to provide Twitter with a HTTPS endpoint, either GET or POST but preferably POST.

2. The data will be sent via https:// GET or POST to an endpoint that you provide in the ads.twitter UI. Only HTML response codes are accepted and the following codes are considered successful: 200, 201, 202, 204, 301, 302.

3. The request will contain 3 fields: User provided name, screen-name (@handle) and user email address.  All fields are supplied from the logged-in user's profile. There is nothing for the user to fill out.

4. In the Twitter ads UI, you can also map each of the 3 data fields to their custom key names (for example name to full_name, email to email_address.). The default parameter names are: "name", "email", "screen_name”.

5. Additionally, you can supply up to 10 hidden key-value pairs which will be sent with the request (for example source=TWITTER, campaign=lead_gen_test, UID=1234). These will be appended to the request URL.

6. All of these technical specs as well as creative specs (image, text, CTA button text) are tied to each card with a unique URL. In other words that URL, when tweeted and viewed on an official Twitter client, will always show the same card. And the card will submit lead data - even if the tweet was organic and not promoted.


We would want the standard fields passed through for the Firefox & You subscription:
EMAIL_FORMAT_ = H
TOKEN
EMAIL_ADDRESS
MOZILLA_AND_YOU_FLG
MOZILLA_AND_YOU_DATE
SOURCE_URL
CREATED_DATE
MODIFY_DATE
LANGUAGE_ISO2 = EN, ES, or PT - we're checking into the ability to have more than one particular Ad/Twitter card per language so we can pass through the proper one by default


Questions:

1) Is this possible to integrate?
2) How long would it take to knock it out?
We could do this without any code changes at all by setting it up so Twitter uses the same Basket API that Bedrock calls when someone submits a bottom-of-page signup form.

Twitter should post to "https://basket.mozilla.org/subscribe/".

Parameters should be:

    email = email address
    format = "H"
    lang = "en" or "es" or ....
    newsletters = "mozilla-and-you"
    source_url = ...
    country = "US" or ... (if we can get country, otherwise leave it out)

The nice thing is that this API already has all the logic to figure out if this person is already in the system, if they need to confirm, etc.
Sweet! Thanks Dan!

Jayleen is going to add a link to the full dev documentation needed to set up the Email Lead Generation Twitter Card using our own end point.  Stay tuned.
Hey Jayleen - any update on those dev docs?
Flags: needinfo?(jayleen)
Hey Jayleen - any update?
Here's an example of how to set it up:

http://www.pardot.com/faqs/forms/integrating-twitter-lead-generation-cards/


Per this info it looks like Jayleen's got everything she needs to set this up in Twitter based on Dan's info in Comment 1.

Jayleen, try setting up the twitter lead gen card and let me know if you run into any troubles. Or put some time on our calendars this week to walk through it together (you can share your screen with me on vidyo).
Assignee: dpoirier → jayleen
Flags: needinfo?(jayleen)
Whiteboard: [kb=1118988]
Hi Dan,

Quick question, Would the HTTP Method for the submit URL be "Post" or "Get"? 

Thanks!
It would be POST.
Thanks Dan!

I followed all the instructions and used: https://basket.mozilla.org/subscribe/

and I'm getting the following error when I test the card:

Result: Failure. Error submitting card data: hostname was not match with the server certificate.

and tokens are looking like this: 844a793489495c212488031ef7f45b07 when according to Jessilyn, they should include dashes. 

Do you know why this might be happening? Thanks!
Correction: the URL should be https://basket.mozilla.org/news/subscribe/

With that URL, I was able to successfully post per the instructions above and get back a token that looked valid.   I used curl to test:

curl \
  -F email=someemail@example.com \
  -F format=H \
  -F lang=en \
  -F newsletters="mozilla-and-you" \
  -F source_url="http://twitter.com" \
  -F country="US" \
  https://basket.mozilla.org/news/subscribe/

and the response was:

{"status": "ok", "token": "wwwwwwww-xxxx-yyyy-zzzz-aaaaaaaaaaaa", "created": true}

(token changed from letters and digits to www-xxx etc.)

However, you might still get that "hostname was not match with the server certificate" error - please try it and see.  It looks like the SSL certificate returned when you connect to basket.mozilla.org has a different hostname in it, and if Twitter is checking that, we might need to get that fixed by the IT folks.
Yes, still getting the same error. 

Result: Failure. Error submitting card data: hostname was not match with the server certificate

I'm fairly new in Bugzilla so I'm not sure how I should proceed on having IT take a look at that. Thanks!
pmac - how would we get the SSL certificate for basket.mozilla.org fixed to have the right hostname?  (Assuming we can...)
pmac - how would we get the SSL certificate for basket.mozilla.org fixed to have the right hostname?  (Assuming we can...)
Flags: needinfo?(pmac)
Okay, pmac and I have determined that the problem is SNI - Twitter apparently isn't sending it, and so is getting the wrong certificate.

But we can work around it.  Change "basket.mozilla.org" to "basket.mozilla.com" and the certificate matches.  The new URL should be https://basket.mozilla.com/news/subscribe/
Flags: needinfo?(pmac)
Hello Dan,

Thanks! Tried the new link but since its loading to a blank page, we are getting the following error:

Result: Failure. Received an invalid response code: 400.

Let me know if there is a way to fix this. We are one step closer to getting it right :)
I don't understand the "loading to a blank page" part.  Or where a 400 is coming from.  Can you give more detail about what you did and what you saw?
Flags: needinfo?(jayleen)
Hello Dan,

Sorry, disregard the loading to a blank page part. I changed the submit url to: https://basket.mozilla.com/news/subscribe/

and clicked on update and Twitter ran a test that showed the following error: 

Result: Failure. Received an invalid response code: 400.

Here you can see more info on Twitter errors: https://dev.twitter.com/docs/error-codes-responses

Let me know if there is something we can do to fix this error. Thanks!
Flags: needinfo?(jayleen)
It looks like the help for this feature from Twitter is at https://support.twitter.com/articles/20170389, but Twitter won't even let me look at that page unless I'm buying ads from my account.  There might be something helpful there.

Maybe you can take a screenshot or shots of all your settings, and either attach them here, or you can email them to me if anything is sensitive? Then I might be able to see what's not right.
Flags: needinfo?(jayleen)
Just to clarify, what we probably need to see are the settings for the Twitter Lead Generation Card.

The error 400 is a pretty standard HTTP status code, it just tells us that something Twitter sent to us wasn't what we were expecting.  It's possible we logged something about it, and with the exact date and time of the error I could look, but I'm not too hopeful, not everything gets logged.
Just ran a test right now: 09/27/2013 at 4:12PM EST
Flags: needinfo?(jayleen)
Didn't see anything in the logs. Will wait for the settings from the Lead Generation Card.
Flags: needinfo?(jayleen)
I got the screenshots, thanks.

Here are the settings that will need to be made.

  The URL is correct: https://basket.mozilla.com/news/subscribe/

  Under "User information to be received", next to Email, set a 
  custom key name of "email" (all lowercase)

  Add the following custom hidden data values:

   key=format, value=H
   key=lang, value=en
   key=newsletters, value=mozilla-and-you
   key=source_url, value=http://twitter.com  (or whatever you want)
   key=country, value=US

That ought to give Basket the information it needs. Let us know how that works.
Good morning Dan,

It worked!! Can you please confirm that the email database received Twitter's test data? 


Thanks! :)
Flags: needinfo?(jayleen)
If you used a valid email address, you should have gotten an email message either welcoming you to the newsletter or asking you to confirm the subscription.
Hello!

Just sent you a screenshot. Check inbox. Thanks!
Just heard from Jayleen that this is up and running! Thanks!
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.