Monthly Archives: October 2014

Adding a Contact to Infusionsoft in a Ruby on Rails App ( or: Why I’ll Never do Business with “Confusionsoft” Again)

Infusionsoft is a popular CRM and that is unfortunate.

I had a specification that required new user’s emails to get sent to an Infusionsoft list.

This appears to be a relatively easy task, right? They even have a Ruby gem, which I added to my Gemfile:

gem 'infusionsoft'

Then I performed the required config:

# Added to your config\initializers file
Infusionsoft.configure do |config|
  config.api_url = ENV['INFUSIONSOFT_URL'] # example infused.infusionsoft.com
  config.api_key = ENV['INFUSIONSOFT_API_KEY']
  config.api_logger = Logger.new("#{Rails.root}/log/infusionsoft_api.log") # optional logger file
end

And to test, I ran the recommended scripts in my rails console:

# Add a new Contact
Infusionsoft.contact_add({:FirstName => 'first_name', :LastName => 'last_name', :Email => 'test@test.com'})

No dice. I get this error:

SocketError: getaddrinfo: nodename nor servname provided, or not known
from /Users/Justus/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:879:in `initialize'

Hmm. I wonder why? I do a bit of research. Let’s check the API docs for infusionsoft:

Infusionsoft API Getting Started Documentation

 

Hmm. The ruby gem’s documentation make’s no mention of client_id or redirect_uri. Maybe they mean API key?

I continue digging and find that Infusionsoft has a “developer portal” that requires a separate registration. Maybe I’ll get what I need from there…

Nope. I register my application and receive an “application key” and a “secret”.

What is a secret? Nobody’s mentioned a secret. Why do I need a separate account to use the API? Will be able to access my original account’s campaign and how?

I have a lot of questions, so I call Infusionsoft’s technical support:

“Hi Infusionsoft, I’d like to speak with someone about integrating your API with an existing Rails App.”

“Please hold.”*

*intolerably long hold*

“I’m sorry sir, we don’t have technical support services, please checkout our community forum for assistance with the API.”

Oh, ok then.

Let’s talk about their community forums.

I register for an account. I confirm my email…

I should be able to create a thread, no?

No.

I have to wait for a moderator to confirm my registration.

Fast-forward 24 hours.

I have a deadline and need to get this card completed. My forum registration is still restricted. StackOverflow and GitHub issues have yielded no useful responses.

I make a simple email form in the infusionsoft campaign builder and examine the HTML it provides:

Webform” />

Email *

Time for a hack.

Let’s dissect this HTML. We have form data being passed via POST request. Here are the pertinent key- value pairs:

inf_form_xid : SUPER_SECRET_NUMBER

inf_form_name : ‘Webform’

infusionsoft_version : ‘1.34.0.35’

inf_field_Email : “#{user.email}”

Ah now we’re getting somewhere. I test the POST request in Postman and receive HTML responses. If the email is invalid or a duplicate, the response is a form with error alerts. I already validate those in the rails app so I shouldn’t have to worry.

I use HTTParty to facilitate the request in a Rails service object called AddContactToInfusionsoft.rb

class AddContactToInfusionsoft
 def self.call(user)
   HTTParty.post("https://ns166.infusionsoft.com/app/form/process/961b755cc1de68e2d549824cf11890d5",
     query: 
     {
       inf_form_xid: '961b755cc1de68e2d549824cf11890d5',
       inf_form_name: 'Webform in Content App',
       infusionsoft_version: '1.34.0.35',
       inf_field_Email: '#{user.email}'
     }
   )
 end
end

I test the code in my rails console and it works fine. Push it and you should be all set.

*Paraphrasing obviously.

Will Auto Suggest Change the Way We Speak?

Tonight I was text messaging my girlfriend on an iOS device using SwiftKey. The autosuggestion mechanism was smart enough to predict simple phrases like: “I just got home” or “I’ll talk to you later”.

I thought: I can get used to this.

Then I thought about what life would be like if I always accepted the suggested message.

What if I had been intending to write: “I just got back” instead?

What if autosuggestion convinced enough people to specify “home” over “back”? Apple has an enormous user-base. Constantly altering their lexicon would certainly have an impact on popular communication and the larger english-speaking world.

What if auto-suggest recommended “tomorrow” over “later”? If you accidentally accept the additional specificity then in a sense you commit to it. Are we legally responsible for auto-correct? Some people text rapidly and are quick to hit the send button. There are innumerable examples of people sending ridiculous messages thanks to auto-correct.

I think intelligent language-learning interfaces are the future of technology.

And just like any other advancement in technology, there will be unintended consequences. Auto suggestion is only the beginning.

In the future you will dictate to smart transcribers which remove your ineloquent “uhs” and “likes” and channel your message to the other party, or onto paper.

Have you tried the voice-to-text feature on your phone lately? It’s only a matter of time before that technology is accounting for your regional dialect.

It might be happening already.

We’re in a renaissance of User Experience. Wearable technology is enabling interactional innovation and data collection unlike anything attempted before. Computing power isn’t going anywhere but our auditory and visual recognition capabilities are constantly growing. Trends in machine learning are only empowering these trends.

There is open source technology in voice recognition (CMU Sphinx, with a Ruby wrapper, just out this month!!!), open source facial recognition, and open source pattern recognition. A Boston start up called Indico is making Machine Learning Environments that could empower developers all over the world.

These are tools that anybody can pick up and start building off of.

I can’t wait to see what happens next.