Test (POST) Webhook Subscriptions
After you subscribe to a webhook, make a POST call to the partner/webhooks/subscriptions/{topic_id}/tests endpoint to trigger a test notification for a chosen webhook topic_id and validate the webhook subscription.
POST Notification Example
If the request is successful, Constant Contact automatically sends a POST notification to your callback URI with data for the topic. For example:
{"url":"https://api.cc.email/v3/partner/accounts/a07e1my9tbxo/plan","api_key":"40a0b12-342b-436d-97c3-000000000000","event_type":"tier.increase"}JSON Schema
The following describes the JSON schema that is returned in the response body:
-
topic_id: The ID that identifies the type of topic. Supported types include:1: Billing Tier Upgrade2: Bill Tier Downgrade3: Account Cancelled4: Account Disabled
-
hook_uri: The webhook callback URI that Constant Contact uses to notify you about POST requests for a topic. The URI must begin withhttps://and be no more than 512 characters in length.For example:
https://www.examplename.com/webhooks/billingTier -
topic_name: The name of the topic.For example:
Billing Tier Downgrade -
topic_description: Describes the topic and when to expect to be notified.For example:
Executes when an accounts's billing tier is downgraded.
Example POST Webhooks Request
To test your webhook, make a POST call:
https://api.cc.email/v3/partner/webhooks/subscriptions/2/testsOkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.cc.email/v3/partner/webhooks/subscriptions/2/tests")
.method("POST", body)
.addHeader("x-api-key", "40a0b12-342b-436d-97c3-000000000000")
.addHeader("Authorization", "{access_token}")
.build();
Response response = client.newCall(request).execute();JSON Response
{
"topic_id": 2,
"hook_uri": "https://my.host.com/mywebhook",
"topic_name": "Billing Tier Downgrade",
"topic_description": "Executes when an account's billing tier is downgraded"
}Although technology partner endpoints cannot be tested using our API Reference Tester, response samples and schema are available to view for this endpoint.