You are here

class MailchimpAutomations in Mailchimp 8

Same name in this branch
  1. 8 lib/mailchimp-api-php/src/MailchimpAutomations.php \Mailchimp\MailchimpAutomations
  2. 8 lib/mailchimp-api-php/tests/src/MailchimpAutomations.php \Mailchimp\Tests\MailchimpAutomations

Hierarchy

Expanded class hierarchy of MailchimpAutomations

File

lib/mailchimp-api-php/src/MailchimpAutomations.php, line 5

Namespace

Mailchimp
View source
class MailchimpAutomations extends Mailchimp {

  /**
   * Gets information about all automations owned by the authenticated account.
   *
   * @param array $parameters
   *   Associative array of optional request parameters.
   *
   * @return object
   *
   * @see http://developer.mailchimp.com/documentation/mailchimp/reference/automations/#read-get_automations
   */
  public function getAutomations($parameters = []) {
    return $this
      ->request('GET', '/automations', NULL, $parameters);
  }

  /**
   * Get information about a specific Automation workflow.
   *
   * @param string $workflow_id
   *   The unique id for the Automation workflow.
   *
   * @return object
   *
   * @see http://developer.mailchimp.com/documentation/mailchimp/reference/automations/#read-get_automations_workflow_id
   */
  public function getWorkflow($workflow_id) {
    $tokens = [
      'workflow_id' => $workflow_id,
    ];
    return $this
      ->request('GET', '/automations/{workflow_id}', $tokens);
  }

  /**
   * Gets a list of automated emails in a workflow.
   *
   * @param string $workflow_id
   *   The unique id for the Automation workflow.
   *
   * @return object
   *
   * @see http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/#read-get_automations_workflow_id_emails
   */
  public function getWorkflowEmails($workflow_id) {
    $tokens = [
      'workflow_id' => $workflow_id,
    ];
    return $this
      ->request('GET', '/automations/{workflow_id}/emails', $tokens);
  }

  /**
   * Gets information about a specific workflow email.
   *
   * @param string $workflow_id
   *   The unique id for the Automation workflow.
   * @param string $workflow_email_id
   *   The unique id for the Automation workflow email.
   *
   * @return object
   *
   * @see http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/#read-get_automations_workflow_id_emails
   */
  public function getWorkflowEmail($workflow_id, $workflow_email_id) {
    $tokens = [
      'workflow_id' => $workflow_id,
      'workflow_email_id' => $workflow_email_id,
    ];
    return $this
      ->request('GET', '/automations/{workflow_id}/emails/{workflow_email_id}', $tokens);
  }

  /**
   * Gets queued subscribers from a Mailchimp workflow automation.
   *
   * @param string $workflow_id
   *   The unique id for the Automation workflow.
   * @param string $workflow_email_id
   *   The unique id for the Automation workflow email.
   *
   * @return object
   *
   * @see http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/queue/#read-get_automations_workflow_id_emails_workflow_email_id_queue
   */
  public function getWorkflowEmailSubscribers($workflow_id, $workflow_email_id) {
    $tokens = [
      'workflow_id' => $workflow_id,
      'workflow_email_id' => $workflow_email_id,
    ];
    return $this
      ->request('GET', '/automations/{workflow_id}/emails/{workflow_email_id}/queue', $tokens);
  }

  /**
   * Gets a subscriber from a Mailchimp workflow automation email queue.
   *
   * @param string $workflow_id
   *   The unique id for the Automation workflow.
   * @param string $workflow_email_id
   *   The unique id for the Automation workflow email.
   * @param string $email
   *   The email address of the subscriber.
   *
   * @return object
   *
   * @see http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/queue/#read-get_automations_workflow_id_emails_workflow_email_id_queue_subscriber_hash
   */
  public function getWorkflowEmailSubscriber($workflow_id, $workflow_email_id, $email) {
    $tokens = [
      'workflow_id' => $workflow_id,
      'workflow_email_id' => $workflow_email_id,
      'subscriber_hash' => md5(strtolower($email)),
    ];
    return $this
      ->request('GET', '/automations/{workflow_id}/emails/{workflow_email_id}/queue/{subscriber_hash}', $tokens);
  }

  /**
   * Adds a subscriber to a Mailchimp workflow automation email queue.
   *
   * @param string $workflow_id
   *   The unique id for the Automation workflow.
   * @param string $workflow_email_id
   *   The unique id for the Automation workflow email.
   * @param string $email
   *   The email address of the subscriber.
   * @param array $parameters
   *   Associative array of optional request parameters.
   *
   * @return object
   *
   * @see http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/queue/#create-post_automations_workflow_id_emails_workflow_email_id_queue
   */
  public function addWorkflowEmailSubscriber($workflow_id, $workflow_email_id, $email, $parameters = []) {
    $tokens = [
      'workflow_id' => $workflow_id,
      'workflow_email_id' => $workflow_email_id,
    ];
    $parameters += [
      'email_address' => $email,
    ];
    return $this
      ->request('POST', '/automations/{workflow_id}/emails/{workflow_email_id}/queue', $tokens, $parameters);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Mailchimp::$api_key private property The Mailchimp API key to authenticate with.
Mailchimp::$api_user private property The Mailchimp API username to authenticate with.
Mailchimp::$batch_operations private property Array of pending batch operations.
Mailchimp::$client protected property The HTTP client.
Mailchimp::$debug_error_code private property A Mailchimp API error code to return with every API response.
Mailchimp::$endpoint protected property The REST API endpoint.
Mailchimp::$version public property API version.
Mailchimp::addBatchOperation protected function Adds a pending batch operation.
Mailchimp::DEFAULT_DATA_CENTER constant
Mailchimp::ERROR_CODE_API_KEY_INVALID constant
Mailchimp::ERROR_CODE_API_KEY_MISSING constant
Mailchimp::ERROR_CODE_BAD_REQUEST constant
Mailchimp::ERROR_CODE_COMPLIANCE_RELATED constant
Mailchimp::ERROR_CODE_FORBIDDEN constant
Mailchimp::ERROR_CODE_INTERNAL_SERVER_ERROR constant
Mailchimp::ERROR_CODE_INVALID_ACTION constant
Mailchimp::ERROR_CODE_INVALID_METHOD_OVERRIDE constant
Mailchimp::ERROR_CODE_INVALID_RESOURCE constant
Mailchimp::ERROR_CODE_JSON_PARSE_ERROR constant
Mailchimp::ERROR_CODE_METHOD_NOT_ALLOWED constant
Mailchimp::ERROR_CODE_REQUESTED_FIELDS_INVALID constant
Mailchimp::ERROR_CODE_RESOURCE_NESTING_TOO_DEEP constant
Mailchimp::ERROR_CODE_RESOURCE_NOT_FOUND constant
Mailchimp::ERROR_CODE_TOO_MANY_REQUESTS constant
Mailchimp::ERROR_CODE_USER_DISABLED constant
Mailchimp::ERROR_CODE_WRONG_DATACENTER constant
Mailchimp::getAccount public function Gets Mailchimp account information for the authenticated account.
Mailchimp::getBatchOperation public function Gets the status of a batch request.
Mailchimp::getDataCenter private function Gets the ID of the data center associated with an API key.
Mailchimp::getDefaultHttpClient private function Instantiates a default HTTP client based on the local environment.
Mailchimp::processBatchOperations public function Processes all pending batch operations.
Mailchimp::request public function Makes a request to the Mailchimp API.
Mailchimp::setClient public function Sets a custom HTTP client to be used for all API requests.
Mailchimp::setDebugErrorCode public function Sets a Mailchimp error code to be returned by all requests.
Mailchimp::VERSION constant
Mailchimp::__construct public function Mailchimp constructor. 7
MailchimpAutomations::addWorkflowEmailSubscriber public function Adds a subscriber to a Mailchimp workflow automation email queue.
MailchimpAutomations::getAutomations public function Gets information about all automations owned by the authenticated account. 1
MailchimpAutomations::getWorkflow public function Get information about a specific Automation workflow. 1
MailchimpAutomations::getWorkflowEmail public function Gets information about a specific workflow email. 1
MailchimpAutomations::getWorkflowEmails public function Gets a list of automated emails in a workflow. 1
MailchimpAutomations::getWorkflowEmailSubscriber public function Gets a subscriber from a Mailchimp workflow automation email queue. 1
MailchimpAutomations::getWorkflowEmailSubscribers public function Gets queued subscribers from a Mailchimp workflow automation. 1