Adding a contact to a campaign

A perhaps (on my part) misunderstanding of the docs here…

https://developer.infusionsoft.com/docs/rest/#!/Campaign/addContactsToCampaignSequenceUsingPOST

I’ve gotten the campaigns, id’s and sequence id’s from various calls - have worked out how to add contacts and opt in their emails etc - all working spiffily.

However - my client is asking me to add the signed up clients to campaigns but the info he is giving me isn’t obviously linked to a sequence, I have the campaign id of course - but the sequence escapes me.

He’s given me ‘call name’ and ‘integration’ which i cant find reference to when i call the campaigns down.

I can do either xml or rest approach (the sdk is very cool for that!) - but just would like a tiny steer on where i should be going to add a user to an existing campaign and get them started.

@Owen_Lees,

There is no way (yet) to identify campignee’s from campaign builder with the api (although I believe they are working on that). What you can do is to have a tag at the beginning of a campaign (or for that matter at the beginning of each sequence) that identifies that contact as being in that campaign/sequence. You can then use the ContactGroupAssign table to query for all contacts with that tag.

Alternatively, there are campaign reports that, if you create saved searches from them, you can use the search object to pull data from as well.

Hi John, thanks for the informative reply but I think you may missed the exact angle I am after.

I can see existing contacts via tags, so that not the problem. The issue is that I need to actually add them in the first place to a campaign. ie: take a contact previously added via the api (from our web forms) and add them to an existing campaign.

What I cant wok out is how to identify the sequence id required by the API to place the contact in and get them started. I can see the campaigns and can see sequences but when I try to use a sequence id it fails.

i get this error: (when using the xml-rpc version):

Message: exception ‘fXmlRpc\Exception\FaultException’ with message ‘[Loading]Error loading follow-up sequence’ in /home/**/public_html/vendor/lstrojny/fxmlrpc/src/fXmlRpc/Exception/FaultException.php:32

I’ve not yet worked out how to use the REST version of this via the sdk yet,i suspect that I could do it with Guzzle easily and bypass the sdk (I’m currently mixing and matching the Rest and Xml calls to achieve the result.

So essentially - how can I identify the ‘sequence id’ from the campaigns?

Here’s a partial dump of the sequences gotten from the API for a campaign:

{“error_message”:null,“date_created”:“2017-08-15T11:27:16.000+0000”,“name”:“10. Marketing - Idea generator - Lead magnet to course purchase campaign”,“active_contact_count”:0,“completed_contact_count”:30,“published_status”:true,“id”:171,“published_time_zone”:“Europe/London”,“time_zone”:“Europe/London”,“published_date”:“2017-08-16T15:47:24.000+0000”,“sequences”:[{“id”:32,“name”:“Push start button”,“paths”:[{“id”:641,“items”:[{“id”:819,“name”:“Apply 1 Tag:”,“type”:“Tag”,“next_item_id”:null,“previous_item_id”:null}]},{“id”:642,“items”:[{“id”:791,“name”:“Apply 1 Tag:”,“type”:“Tag”,“next_item_id”:null,“previous_item_id”:null}]}],“active_contact_count”:2,“active_contact_count_completed”:0,“historical_contact_count”:{“24_hours”:0,“30_days”:2}},{“id”:33,“name”:“Push stop button”,“paths”:[{“id”:359,“items”:[{“id”:765,“name”:“Apply 1 Tag:”,“type”:“Tag”,“next_item_id”:null,“previous_item_id”:null}]}],“active_contact_count”:1,“active_contact_count_completed”:0,“historical_contact_count”:{“24_hours”:0,“30_days”:1}},{“id”:3,“name”:“Email 1 sequence”,“paths”:[{“id”:624,“items”:[{“id”:827,“name”:“Apply 1 Tag:”,“type”:“Tag”,“next_item_id”:null,“previous_item_id”:null}]},{“id”:568,“items”:[{“id”:787,“name”:“Email 1”,“type”:“BardEmail”,“next_item_id”:null,“previous_item_id”:null}]},{“id”:139,“items”:[{“id”:785,“name”:“Apply 1 Tag:”,“type”:“Tag”,“next_item_id”:805,“previous_item_id”:null},{“id”:805,“name”:“Remove 5 Tags:”,“type”:“Tag”,“next_item_id”:823,“previous_item_id”:785},{“id”:823,“name”:“Apply 2 Tags:”,“type”:“Tag”,“next_item_id”:null,“previous_item_id”:805}]},{“id”:140,“items”:[{“id”:763,“name”:“Remove 1 Tag:”,“type”:“Tag”,“next_item_id”:817,“previous_item_id”:null},{“id”:817,“name”:“Wait at least 8 hours and then run at 8:00 AM”,“type”:“DelayTimer”,“next_item_id”:789,“previous_item_id”:763},{“id”:789,“name”:“Apply 1 Tag:”,“type”:“Tag”,“next_item_id”:null,“previous_item_id”:817}]}],“active_contact_count”:0,“active_contact_count_completed”:15,“historical_contact_count”:{“24_hours”:0,“30_days”:15}},{“id”:83,“name”:“Stop campaign sequence”,“paths”:[{“id”:524,“items”:[{“id”:803,“name”:“Remove 5 Tags:”,“type”:“Tag”,“next_item_id”:777,“previous_item_id”:null},{“id”:777,“name”:“Apply 1 Tag:”,“type”:“Tag”,“next_item_id”:null,“previous_item_id”:803}]},{“id”:525,“items”:[{“id”:797,“name”:“Remove 1 Tag:”,“type”:“Tag”,“next_item_id”:775,“previous_item_id”:null},{“id”:775,“name”:“Apply 1 Tag:”,“type”:“Tag”,“next_item_id”:null,“previous_item_id”:797}]}],“active_contact_count”:4,“active_contact_count_completed”:0,“historical_contact_count”:{“24_hours”:0,“30_days”:4}},{“id”:4,“name”:“Re-opted in halfway through”,“paths”:[{“id”:422,“items”:[{“id”:807,“name”:“Remove 1 Tag:”,“type”:“Tag”,“next_item_id”:null,“previous_item_id”:null}]},{“id”:423,“items”:[{“id”:841,“name”:“Remove 1 Tag:”,“type”:“Tag”,“next_item_id”:null,“previous_item_id”:null}]},{“id”:424,“items”:[{“id”:781,“name”:“Re-opted in email”,“type”:“BardEmail”,“next_item_id”:null,“previous_item_id”:null}]}],“active_contact_count”:1,“active_contact_count_completed”:0,“historical_contact_count”:{“24_hours”:0,“30_days”:1}},{“id”:6,“name”:“Email 2 sequence”,“paths”:[{“id”:156,“items”:[{“id”:795,“name”:“Remove 5 Tags:”,“type”:“Tag”,“next_item_id”:769,“previous_item_id”:null},{“id”:769,“name”:"Apply 2

I had taken the sequences part and used the main id’s there - which is not correct, pointers please?

I hold my hands up, its entirely possible I am looking in the wrong place for this, I’m not an experienced (in any way) InfusionSoft user - just tasked with getting data in and out for the end user.

I don’t think the standard api can help you there but the newer REST implementation should work to add contacts to campaigns and gather campaign details:

https://developer.infusionsoft.com/docs/rest/#!/Campaign/getAllCampaignsUsingGET

Thanks John, I still think I’m not explaining myself properly.

I can’t find the SEQUENCE ID as requested by the API, I need a campaign ID and sequence ID according to the REST docs, pretty sure that the php sdk can’t do this (so I will use Guzzle for this) - but cant find where the sequence id is that I need.

I have got the sequence id’s and goal id’s along with the campaign - but when inputting them - i get the error described above.

http://help.infusionsoft.com/userguides/campaigns-and-broadcasts/campaign-goals/create-an-api-goal

This is what my client is doing, however - there’s no real correlation between this and the REST API calls.

Just found this:
https://developer.infusionsoft.com/docs/xml-rpc/#funnel

That contains the 2 items that my client has created - I’ll see if that works.

The Funnel method worked perfectly - happy days.