Overview

You can use this request to add contacts to a workflow.

The Method

API-Method
RESTPOSThttps://[Your URL]/api/3.0/workflows/subscribe-contacts

Parameters

Required Parameters

You must specify the name and email of the customer you want to create.

PropertyTypeDescriptionRequired
workflow_idintegerThe ID of the Workflow you with to add the contacts to. This can be found by hovering over the checkbox of the Workflow on the Workflow History page.yes
contactsarrayArray of contacts to add to the workflow. These contacts need to already exist in the system on the list that the workflow is linked to.yes
Contacts

The contacts parameter can use one of two ways to identify the contact. See the following table:

PropertyDescription
contact_emailIf you use this option, the contact will be found using their email address. If more than one contact exists with this email address, use the other field.
contact_unique_idUse this field if you want to select the contact using their unique ID. You can set this field to whatever you like.

Responses

PropertyTypeDescription
resultstringA string that can either be “error” or “success”. “success” means all contacts successfully added to the Workflow. “error” means that one or more contacts failed to add to the Workflow.
messagestringA string that describes the result. It will state what the error was if there was an error.
contacts not foundarrayArray of contacts that either do not exist in the product, or they are not subscribed to the list assigned to the Workflow provided.
contacts failedarrayArray of contacts that failed to add to the Workflow.
contacts succeededarrayArray of contacts that succeeded if there was an error. This property is not returned if all contacts succeeded, because there is no need.

Code Samples

The following is a code sample for the create customer request:

<?php
$user = '(Your username)';
$apiKey = '(Your API Key)';
$host = '(Your URL)';
$path = '/api/3.0/workflows/subscribe-contacts';
$method = 'POST';
$json = '
{
    "workflow_id": 13,
    "contacts":[
        {"contact_unique_id":"abc"},
        {"contact_unique_id":"xyz"}
    ]
}
';
$cSession = curl_init();
$auth = base64_encode($user . ':' . $apiKey);
$headers = array();
$headers[] = 'Authorization: Basic ' . $auth;
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
curl_setopt($cSession, CURLOPT_URL, $host . $path);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, strtoupper($method));
curl_setopt($cSession, CURLOPT_POSTFIELDS, $json);
$result = curl_exec($cSession);
curl_close($cSession);
echo $result;
?>