Overview

Namespaces

  • Ctct
    • Auth
    • Components
      • Account
      • Activities
      • Contacts
      • EmailMarketing
      • Library
      • Tracking
    • Exceptions
    • Services
    • Util
    • WebHooks

Classes

  • CTCTWebhookUtil
  • Overview
  • Namespace
  • Class

Class CTCTWebhookUtil

Main Webhook Utility class.
This is meant to be used by users to validate and parse Webhooks received from ConstantContact.

Namespace: Ctct\WebHooks
Package: WebHooks
Author: Constant Contact
Located at WebHooks/CTCTWebhookUtil.php
Methods summary
public Ctct\WebHooks\CTCTWebhookUtil
# __construct( string $clientSecret = '' )

Constructor that creates a validation Object for WebHooks.

Constructor that creates a validation Object for WebHooks.

Parameters

$clientSecret
  • The client secret associated with the api key

Returns

Ctct\WebHooks\CTCTWebhookUtil
public string
# getClientSecret( )

CTCTWebhookUtil::getClientSecret()

CTCTWebhookUtil::getClientSecret()

Returns

string
  • the secret API key
public
# setClientSecret( string $clientSecret )

CTCTWebhookUtil::setClientSecret() Set the clientSecret

CTCTWebhookUtil::setClientSecret() Set the clientSecret

Parameters

$clientSecret
  • The client secret associated with the api key
public The
# getBillingChangeNotification( xCtctHmacSHA256 $xCtctHmacSHA256, bodyMessage $bodyMessage )

Get Billing Change Notification.

Get Billing Change Notification.

Validates and parses the bodyMessage into

Parameters

$xCtctHmacSHA256
value in the x-ctct-hmac-sha256 header.
$bodyMessage
body message from the POST received from ConstantContact in Webhook callback.

Returns

The
object corresponding to bodyMessage in case of success; an exception is thrown otherwise.

Throws

Ctct\Exceptions\CtctException

Thrown when :

  • message encryption does not correspond with x-ctct-hmac-sha256 header value;
  • or an error is raised when parsing the bodyMessage.

public true
# isValidWebhook( xCtctHmacSHA256 $xCtctHmacSHA256, bodyMessage $bodyMessage )

Check if a Webhook message is valid or not.

Check if a Webhook message is valid or not.

Parameters

$xCtctHmacSHA256
value in the x-ctct-hmac-sha256 header.
$bodyMessage
body message from the POST received from ConstantContact in Webhook callback.

Returns

true
if in case of success; false if the Webhook is invalid.
API documentation generated by ApiGen