Sorry, me again! :)
Thanks to David_B's help using the SDK I can now create contacts via API, but when the Marketing people look at the list, all the new contacts created by our website users are marked as 'Implied permission', we want them marked as 'Express consent'.
To do this I thought I could create them as ACTION_BY_VISITOR rather than ACTION_BY_OWNER as shown below:
EmailAddress email = new EmailAddress()
EmailAddr = contactRec.Email,
Status = "ACTIVE",
ConfirmStatus = "NO_CONFIRMATION_REQUIRED",
OptInSource = "ACTION_BY_VISITOR",
OptInDate = DateTime.UtcNow.ToString("o")
However when calling contactService.AddContact() I get the message:
"query.param.action_by.does_not_match.opt_in_source:action_by and opt_in_source must be consistent when creating a contact."
Note I've also tried setting 'Source' in the contact record to ACTION_BY_VISITOR
Is it possible to create records as ACTION_BY_VISITOR? I note from another topic Change Consent that it's not possible to change the action type via the API, but can they be created that way?
Solved! Go to Solution.
When an integration creates a contact, it can do so with the action_by parameter set as either action_by_visitor or action_by_owner; which method used determines if a contact is making the change, and thus if they are added as express or implied. An integration should only submit contacts as "action_by_visitor" if a contact themselves is making the change through something like a signup form on a website. "Action_by_owner" should be used any time that the account owner is creating or updating contacts to make sure that previously unsubscribed contacts are not re-subscribed without their permission.
The source is returned when you get a contact, but not something you need when creating one; I might suggest not passing that through.
ACTION_BY is set as a parameter and does not go in the JSON data; it is used as a URL parameter exactly the same way that your API Key is used.
I know you're using our C# SDK and the way you set ACTION_BY is by passing a boolean with your call i.e.
public Contact AddContact( string accessToken, string apiKey, Contact contact, bool actionByVisitor )
// Passes as action_by_owner contactService.AddContact(contact, false); // Passes as action_by_visitor contactService.AddContact(contact, true);
Please let me know if you have any questions!
Tier II API Support Engineer
Once again, thank you. That works fine. I'll mark your answer as the solution.