How to setup campaign for contacts added via API

Hi all!



I will be adding contacts to my self hosted mautic site via the API.

I want to start the timer to send an email sequence to new contacts but I’m a bit confused how to setup the campaign as I only see options for contacts added via forms.

Do I need to add them to a specific segment or something too?



Thanks



John

Hi all!

I will be adding contacts to my self hosted mautic site via the API.
I want to start the timer to send an email sequence to new contacts but I’m a bit confused how to setup the campaign as I only see options for contacts added via forms.
Do I need to add them to a specific segment or something too?

Thanks

John

Hi @john, adding to a segment would be my approach – with the Campaign based on the Segment.

After calling $contactContext->create() it returns an array that represents the contact. I used $contact['contact']['id'] to retrieve the new contact ID, then call $segmentContext->addContact($segmentId, $contactId); or you could simply add a certain Tag and then apply a Filter to the segment based on that tag.