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?
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
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.
Thanks for sharing this Pete, I'm sure someone else out there will need something like this!
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
Regards
Ian
Please sign in to leave a comment.