Connecting to Highrise CRM using Web Services

Source code

Here is the source code for the highrise module. To use it:

  1. Create a new shared module called “highrise” and copy paste in the code below.
  2. Add the code require(‘highrise’) at the top of the main module.
  3. Test using sample data.

Code for main:


URL_p='' -- url for people (create or read all)
URL_fs='' --individual example url for read

function main(Data)
   local msg, name = hl7.parse({vmd = 'demo.vmd', data = Data})
   local T = highrise.InsertTemplate()

   -- read an individual contact from highrise
   local R,C,H = net.http.get{url=URL_fs,live=true,
      auth={username='Your Highrise API Token here', password='X'}}
   -- read all contacts (only change is the URL)
   R,C,H = net.http.get{url=URL_p,live=true,
       auth={username='Your Highrise API Token goes here', password='X'}}

   -- create a new contact in highrise
   R,C,{url=URL_p,live=false,  -- live=true, -- for testing
      auth={username='Your Highrise API Token goes here', password='X'},
   print(C,R,H) -- code 201 (c=201) is a successful insert

function mapPatientData(Xml,Msg,Name)
   if Name=='ADT' then
   return Xml

, 'fIncludeLineNumbers

Code for highrise module:


function highrise.InsertTemplate()
   return xml.parse
      '  <first-name>#</first-name>'..
      '  <last-name>#</last-name>'..
--      '  <background>#</background>'..
--      '  <title>#</title>'..
--      '  <company-name>#</company-name>'..

function node.S(ANode)
   return tostring(ANode)

Possible modifications interesting notes etc:

  • You need to use the API token from your own Highrise account to logon (replace “Your Highrise API Token here” on lines 14, 18 and 23 of main)
  • Gotcha: you need placeholders like # in the XML template (highrise module), deleting them causes errors in mapPatientData() – try it and see if you want.
  • There are three other Contact fields you can include in the insert <background>, <title> and <company-name>
  • Adding personal details to contacts
  • When I tried an insert including contact data (email, phone, address etc) the <contact-data> segment was ignored
  • When I tried an insert with a <tag> segment the insert failed
  • Try an update using the Contact Id in the returned Header Message (the H return in the code)
  • The XML formats on the highrise API reference page are not 100% clear, I suggest using Highrise to update a contact , and looking at the returned XML.

Leave A Comment?