Updating Contact with Wordpress User ID

Hi,

I am needing guidance on updating a contact’s custom field with their Wordpress User ID. The flow is as follows:

  1. Customer makes purchase on Keap checkout form
  2. HTTP POST sends contact info to Wordpress site where a new user is created using WP Webhooks
  3. Wordpress site sends created user’s Wordpress User ID back to Keap to be updated to the contact’s custom field.

I have 1 and 2 sorted. It’s point 3 I am unsure of. WP Webhooks does have a ‘send data’ webhook option. I should add that I do not wish to use Zapier or any other automation SaaS.

Thanks in advance.

You would need to use the REST API to update the Contact record, which would require adding additional PHP code to your site.

Since it’s a one-to-one with your Keap instance you can use a Personal Access Token to authorize the calls on the backend, then you would send a PATCH request to the API with the Contact’s Id in the resource path and the body contents containing the custom field value by id.

PATCH https://api.infusionsoft.com/crm/rest/v2/contacts/1?update_mask=custom_fields

{ "customFields": [ { "id": 1, "content": "value to replace in custom field" } ] }

https://developer.infusionsoft.com/pat-and-sak/
https://developer.infusionsoft.com/docs/restv2/#operation/patchContactUsingPATCH

Hi Tom,

Thanks for the information you’ve provided.

I can see how the process you’ve described would send a patch request to update a particular contact by their contact ID. How does one tie number 2 and 3 together in Wordpress, i.e. when the new user is created using the particular HTTP Post, the API call is fired by PHP code?

It would be great if there is an existing snippet of php for a Keap PATCH request somewhere you could point me to. I would say I’m a developer with intermediate skills - familiar with PHP/HTML/CSS but new to API. It is something I need to, and am keen to learn.

Regards.

Hi Tom,

Please ignore my question on tying the 2 together. I’ve just discovered WP Webhooks has a do_action argument which I can use.

It would be great if there’s an existing PHP snippet I could reference to action this. Thanks in advance.

I’m not a PHP developer by trade unfortunately. If you are requiring assistance with custom development I would refer you to one of the consultant marketplaces like Upwork or Dice.