We’ve recently started using HighRise as our key CRM tool, and so far it looks like it will work very well for our needs. However, hooking our existing processes and our customer data into the web service takes a little bit of time & effort.
First of all, while HighRise has an excellent API… the “official” ruby code on the developers’ site is pretty minimal. Fortunately, some community efforts on GitHub have cleaned up this code and improved it dramatically. I’ve picked up this work and updated it slightly, and hopefully the lessons I learn can be rolled back into my GitHub repository.
One particularly tricky problem, even with a nice ActiveResource library like the one hosted on GitHub, is creating/updating contacts with associated “contact-data”. This includes adding email addresses, phone numbers, etc to contacts. I looked around on the developers forum, and there seem to be a number of people who have had questions about how to accomplish this… but no solid answers. After fiddling around with it for a while, I came up with the following solution:
Highrise::Person.create 'first-name'=>'Test', 'last-name'=>'API', 'contact_data'=>{ 'email_addresses'=>[ { 'address'=>'test@test.com', 'location'=>'Work' } ] }
This code creates the following POST xml:
<?xml version="1.0" encoding="UTF-8"?> <person> <contact-data> <email-addresses type="array"> <email-address> <address>test@test.com</address> <location>Work</location> </email-address> </email-addresses> </contact-data> <last-name>API</last-name> <first-name>Test</first-name> </person>
… And it works great! So hopefully this will help anyone out there who is struggling to get the HighRise API to do what they want via Ruby.
