Creating Contacts with Contact Infos

I have a rails app that I'm using Insightly as the CRM backend for. It's basically working, but I'm trying now to pass the skype and phone I'm getting into Insightly and it seems to be ignoring that data completely. The thing I'm passing to the api is:

 

```

def contact_attributes_from_application_form
{
first_name: application_form.first_name,
last_name: application_form.last_name,
contactinfos: [
{
contact_info_id: 0,
type: 'Email',
detail: application_form.email
},
{
contact_info_id: 1,
type: 'Skype',
detail: application_form.skype
},
{
contact_info_id: 2,
type: 'Phone',
detail: application_form.phone
},
],
tags: [{
'TAG_NAME': application_form.preferred_workshop.insightly_workshop_tag
}],
date_created_utc: application_form.created_at.strftime('%Y-%m-%d %H:%M:%S'),
date_updated_utc: application_form.created_at.strftime('%Y-%m-%d %H:%M:%S')
}
end
```

The contact gets created, and all the data makes it through (including the email) except the skype and phone. Why?
0

Comments

4 comments
  • Hi, to debug an issue like this, I generally recommend the "monkey see, monkey do" method.

    1) get the Postman extension for Chrome

    2) create a lead in the web UI, with some sample contact infos, and note its ID (the last number in the URL for the details view)

    3) make a get request for that record at /v2.2/leads/{id}

    4) edit the contact infos, and make a put request

    If that works ok, replicate what you did in your Ruby app. BTW, I suggest using the v2.2 API as its got much improved documentation. You can also append/edit contact infos to existing objects via /leads/{id}/contactinfos for example, which reduces the risk of data loss on updates.

    Any questions, just let me know.

    Brian McConnell

    Insightly Engineering Team

    0
    Comment actions Permalink
  • Thanks for the help, I did what you suggested and got it working. For future reference, in case anyone has a similar issue:

     

    I stopped trying to manually assign contact_info_id, instead making them all 0.

     

    Also, it's apparently not possible to provide arbitrary "types" for the contact infos, so I had type: 'Skype', but that didn't work. The type is 'Phone', and the subtype and label are 'Skype', that went through.

     

    If either of these things are different, it will fail (silently) to update the record.  

    1
    Comment actions Permalink
  • Thanks for sharing this Pete, I'm sure someone else out there will need something like this!

    0
    Comment actions Permalink
  • This thread implies subtype and label have to be the same, but that is not what I see when testing GET through the help https://api.insight.ly/v2.2/#!/Contacts/GetContacts

    I set some subtypes through the UI, but the API returns sets like:

    "CONTACTINFOS": [
    {
    "CONTACT_INFO_ID": 352402986,
    "TYPE": "EMAIL",
    "SUBTYPE": null,
    "LABEL": "WORK",
    "DETAIL": "rhood@email.com"
    }
    ],

    In this example, SUBTYPE was not set for a Work email address, so it looks like only LABEL needs to be set.

    Is SUBTYPE used for anything?

    The API Reference is unclear:

    eg https://api.insight.ly/v2.1/Help/Api/POST-Contacts

    TYPE
    String
    Is Required
     
    TYPE must be one of the following values: 'Phone', 'Email', or 'Website'.
    SUBTYPE
    String
    Maximum length is 50 characters.
     
    <<< What's SUBTYPE for?  Why set? What values allowed? (this thread implies must be same as LABEL)
     
    LABEL
    String
    If TYPE is 'Website', then LABEL can be one of the following values: 'Work', 'Personal', 'Blog', or 'Other'. If TYPE is 'Phone', then LABEL can be one of the following values: 'Work', 'Mobile', 'Fax', 'Pager', 'Home', 'Skype', 'Y! Messenger', 'SIP', 'Other'. If TYPE is 'Email', then LABEL can be one of the following values: 'Work', 'Personal', 'Other'.
     
    <<< Should LABEL values be in uppercase, as returned by API?

     

    Regards

    Ian

    0
    Comment actions Permalink

Please sign in to leave a comment.