PHP: Create ContactAction and assign to Contact

Hello,

I am trying to create a ContactAction (in this case to create a Note) and then attach it to a contact. I’ve tried using this code:

code1

but I keep getting an error that the class Infusionsoft_ContactAction() not found.

I did not see anything for this here: https://developer.infusionsoft.com/docs/xml-rpc/#contact
so I was wondering if I could get any help with the issue or a place where I could find a solution. Thanks for the help.

Hi @Rameal_Nabeeh, do you know if you’re using the official Infusionsoft PHP SDK or one of the third party SDKs? To my knowledge the official SDK does not contain a class named Infusionsoft_ContactAction.

Yeah I’m pretty sure, this is my composer.json file

code2

I saw the Infusionsoft_ContactAction function from a stack overflow post. I was hoping that there is a create note function or something similar, native to the infusionsoft php sdk

I think the stack overflow post you found may have been using a third party SDK. In order to add a note using the official SDK, you would do something like this, adding all of your desired properties to the data array.

$data = array(
	'ContactId' => $ContactId,
	'UserID' => $UserId,
	'CreatedBy' => $CreatedBy
);
$infusionsoft->data()->add("ContactAction", $data);

We usually see Infusionsoft_ContactAction in relation to the Novak Solutions version which parses out the methods into common objects and creates an object tree in that way. The composer generated install does not have the same class.