Skip to main content

Suppression GraphQL Request

Overview

The Suppression GraphQL Request allows you to manage contact suppression lists for your team. This system helps you maintain a list of contacts that should be excluded from your communications, ensuring compliance with user preferences and privacy requirements.

How It Works

  • You submit one or more contacts to be suppressed via the Suppression request.
  • The system checks for existing suppressions to prevent duplicates.
  • Each contact is processed and added to your team's suppression list if not already present.
  • Detailed results are provided for each contact's processing status.

This system is designed to be efficient and reliable, handling both single and bulk suppression requests with ease.


Authentication

Most mutations and queries require authentication. The auth object must be provided as part of the request. It includes:

Auth Object

FieldTypeDescription
appIdStringThe application ID. Request this from [email protected].
appSecretStringThe application secret. Request this from [email protected].

Operations

Mutation: suppression

Adds one or more contacts to your team's suppression list.

Endpoint

mutation HeroPixel(
$auth: AuthRequestInput!
$event: SuppressionEventInput!
) {
suppression(auth: $auth, event: $event) {
message
code
data
}
}

Parameters

ParameterTypeRequiredDescription
authAuthRequestInputYesThe authentication credentials.
eventSuppressionEventInputYesDetails of the contacts to suppress.

SuppressionEventInput Fields

FieldTypeRequiredDescription
contactsContact[]YesArray of contacts to suppress.

Contact Fields

FieldTypeRequiredDescription
emailStringYesThe email address to suppress.
reasonStringNoOptional reason for the suppression.

Example Request

{
"query": "mutation HeroPixel($auth: AuthRequestInput!, $event: SuppressionEventInput!) { suppression(auth: $auth, event: $event) { message code data } }",
"variables": {
"auth": {
"appId": "yourAppIdHere",
"appSecret": "yourAppSecretHere"
},
"event": {
"contacts": [
{
"email": "[email protected]",
"reason": "Unsubscribed"
},
{
"email": "[email protected]",
"reason": "Bounced"
}
]
}
}
}

Example CURL Request

curl -X POST https://sweet-colt-9750.ddn.hasura.app/graphql \
-H "Content-Type: application/json" \
-d '{
"query": "mutation HeroPixel($auth: AuthRequestInput!, $event: SuppressionEventInput!) { suppression(auth: $auth, event: $event) { message code data } }",
"variables": {
"auth": {
"appId": "yourAppIdHere",
"appSecret": "yourAppSecretHere"
},
"event": {
"contacts": [
{
"email": "[email protected]",
"reason": "Unsubscribed"
},
{
"email": "[email protected]",
"reason": "Bounced"
}
]
}
}
}'

Example Response

{
"data": {
"suppression": {
"code": 200,
"data": {
"success": true,
"results": [
{
"email": "[email protected]",
"status": "success"
},
{
"email": "[email protected]",
"status": "already_suppressed"
}
],
"summary": {
"total": 2,
"suppressed": 1,
"skipped": 1
}
},
"message": "Success"
}
}
}

Response Status Types

StatusDescription
successContact was successfully added to the suppression list.
already_suppressedContact was already present in the suppression list.

Response Object

The response object for all API calls adheres to the following structure:

export interface ApiResponseType {
code: number;
message: string;
data: sdk.JSONValue;
}
  • code: Indicates the result of the operation.
    • 200: Successful operation.
    • 400: Client error, such as invalid input.
    • 401: Unauthorized - Invalid credentials or team not found.
    • 500: Server error.
  • message: A descriptive message about the operation's outcome.
  • data: Contains the result of the operation. For errors, this will be an empty object.

Error Handling

Common Errors

CodeMessageDescription
200Operation SuccessfulThe operation completed successfully.
400Invalid InputOne or more input fields are invalid.
401UnauthorizedInvalid credentials or team not found.
500Internal Server ErrorAn unexpected error occurred on the server.

Example Error Response

{
"code": 400,
"message": "Invalid email addresses found in request",
"data": {}
}
{
"code": 401,
"message": "Unauthorized - Team not found",
"data": {}
}

For all error responses, the data field will be an empty object, and the message field will describe the issue encountered.


Contact

For additional support, contact our development team at [email protected].