+1 on this one. We are trying to achieve the same thing.
We have coded a custom deep data integration. & now need to also update some custom fields every time an order goes through. Thinking using the add/sync contact update is the best idea, but lots how to update 10 fields at once.
But it does not tell how we can update multiple custom fields at once and also it does not allow us to add/sync contacts and set the custom fields at the same time. According to documentation, we would have to do 2 Http calls to simply add a contact and set custom fields:
1- http call to sync the contact
2- http call to update custom fields (I don’t even know if this is possible as the documentation shows only one custom field at request body. I’ll try it out passing multiple fields in request body to see how api will respond.
Even if this option works, would be necessary to do 2 http calls. Would be easier if add-sync contact Api call also supports custom fields, as they are directly related to contacts.
Note: It sounds possible on API version 1. API Examples Using contact_add. I will keep you update if I find a good solution for that.
Currently we use active campaign heavily. we have around 8100+ contacts. We currently add new contacts directly via the site itself but we are wanting to add contacts from another source like another database using the api.
I can create a contact, create an account and create an account association but the contact has custom fields for address, city, state etc. So how do i associate the contacts address etc via the custom fields?
Create custom fields sounds like it creates a brand new custom field. Does the ‘Create Custom Field Values’ do the work of associating the contact with the correct custom field?
Hey Everyone, there’s an undocumented call you can use to do this sort of thing, but it also allows you to BULK UPDATE EVERY CONTACT!!! I write in caps, because we had an error that updated a whole stack of contacts because the payload was created incorrectly. You will want adequate protection in your update command to ensure that it always has a contact id included in the payload.
Here’s a laravel implementation we completed which you could modify for your own purposes.
if(data_get($customFieldPayload, 'contactIds') === null) {
throw new \InvalidArgumentException('An ID must be supplied to prevent catastrophic updates in AC which can cause mass mailouts');
}
// This api call is not documented. AC may change it without notice. Keep an eye out for errors.
$this->getClient()->post('contact/bulk_update', $customFieldPayload);
I’m dealing with the same issue, how to create a contact with custom fields.
I interpreted the
{
“fieldValue”: {
“contact”: 2,
“field”: 3,
“value”: “Blue”
}
}
code as what is needed to create a field via the API. The fields are already created in my AC account, I just need to create/sync contact with custom field values.
Has anyone worked this out?
A bulk update makes me very nervous.
Anyone else who finds this thread looking for the answer. If you are using the php wrapper they put out you can send all the custom fields in a single array. However it is recommended you wrap ALL of the custom field declarations in a urlencode. Like so. $contact[urlencode(‘field[%FIELDNAME%]’)] = ‘value’;
I don’t get it, as the field that I want to update is already in here I think:
{
“fieldValue”: {
“contact”: 4,
“field”: 24,
“value”: “Blue”
}
}
What value do I need to use for the id?.. Thanks for any help
Could you please provide the structure of the $customFieldPayload? Also, does the ‘bulk_update’ request only update (PUT only) already existing values or does it also create new contacts if email does not exist?
I am not able to get all field values from API (API Name : List all custom field values). Only 20 field values I am able to get at a time. If we apply filter still I am getting only 20 field values.