Contact by channel

Overview

The GET Contact by Channel API allows you to retrieve the contact for a given database, channel, qualifier and destination. The PATCH Contact by Channel API will add or update a contact with the given contact data using channel information.

Functionalities Available

The ContactbyChannel API call has GET functionalities.

GET: This call returns the contact that matches the database, channel, qualifier and destination information provided in the request call.

GET /databases/{databaseId}/contactbychannel/{channel}-{qualifier}/{destination}

(e.g. /databases/746583/contactbychannel/PUSH-appKey1000/MUID1234|XCID4321)

Scenarios that can be accomplished using this API

Retrieve a contact for the given database ID, channel, qualifier, and destination.

Request body

Not applicable.

Path Parameters

ParameterValueDescriptionParameter typeData type
databaseIDRequiredID of the database enabled for SMS or Pushpathlong
channelRequiredSMS or PushpathString
qualifierRequiredText to Join Program ID for SMS; AppKey for PushpathString
destinationRequiredSMS phone number for SMS; Xtify user ID and chnnel ID for PushpathString

Response Content Type

application/json

AttributeRequiredDescriptionData type
emailNoA contact's email addressString
emailTypeNoThe type of email to send to a contact (HTML or TEXT)String
leadSourceNoThe lead source for a contactString
optInDetailsNoThe opt in details of a contact; can only be set on a contact being addedString
customFieldsNoA list of custom field valuesArrayFieldValue

Response Model Schema

{
"email": "String",
"emailType": "String",
"leadSource": "String",
"optInDetails": "String",
"customFields": [
"FieldValue"
]
}

Sample JSON Response Body

{ 
"email":"[email protected]",
"emailType":"HTML",
"leadSource":"Trade Show",
"optInDetails":"Opted in via iPad",
"customFields":[ 
{ 
"name" : "First Name",
"value" : "Bob"
},
{ 
"name" : "Last Name",
"value" : "Andrews"
},
{ 
"name" : "Alias Id",
"value" : "UserAccount4567"
}
]
}

Swagger URL

https://api-campaign-[data center]-[pod#].goacoustic.com/restdoc/#!/databases/databases_contactbychannel_get_get_11

Functionalities available

The API call has PATCH functionalities.

PATCH: This call is used to add or update a contact with the given contact data using channel information.

PATCH /databases/{databaseId}/contactbychannel

(e.g. /databases/746583/contactbychannel)

Scenarios that can be accomplished using this API

If a contact is found, the record is updated with the given information and consent is applied. If a contact is not found, the API will add a new contact record and apply consent.

Populate any profile fields in the contact record based on the information you know from their registration or from their profile data in the external system. It is recommended to pass the external system’s alias identifier to Acoustic Campaign so that it can be stored in the contact record and used as a lookup key field. Additionally, the mobile app could pass the appkey, userid/channelid back to the external system and store this as a unique identifier in the customer’s record.

Note: For the Push channel the Contact by Channel API is used by backend systems to add a contact and consent for push to Acoustic Campaign with registration IDs provided by our internal Push platform. It cannot be used to add consent for push by custom systems and any contacts or consent added will not result in push notifications being delivered by Acoustic Campaign.

Request Body

Path Parameters

ParameterRequiredDescriptionData type
databaseIdYesID of the SMS or Push-enabled Database where the Contact will be inserted or updatedlong

ContactByChannelSpecification

AttributeRequiredDescriptionData type
channelYesThe channel data to identify a contactmodel
contactNoThe values to set on the new or updated contactmodel

Channel Data

AttributeRequiredDescriptionData type
channelTypeYesSMS or PUSHString
qualifierYesText to Join Program ID for SMS; AppKey for PushString
destinationYesSMS phone number for SMS; Xtify user ID and channel ID for PushString
statusNoOpt in status. Acceptable values are ‘OPTED-IN’ and ‘OPTED-OUT’String
consentDateNoOptional timestamp represented in a String (1970-01-01T00:00:00.000Z). ISO is the default format.Date
consentSourceNoThe source of the contact. Defaults to ‘API’ if not included.String

Attributes

AttributeRequiredDescriptionData type
timezoneIdNoID of the time zoneString

Contact

AttributeRequiredDescriptionData type
emailNoNoString
emailTypeNoThe type of email to send to a contact (HTML or TEXT)String
leadSourceNoThe lead source for a contactString
optInDetailsNoThe Opt In details of a contact; can only be set on a contact being added.String
customFieldsNoName value pairs representing columns in the database and their values.ArrayFieldValue

Swagger URL

https://api-campaign-XX-Y.goacoustic.com/restdoc/#!/databases/databases_contactbychannel_get_get_14

Note: XX is Country and Y is the number (https://api-campaign-us-0.goacoustic.com/restdoc/#!/databases/databases_contactbychannel_get_get_14)

SampleJSON Request Body

{ 
"channel":{ 
"channelType":"PUSH",
"qualifier":"appKey100",
"destination":"MUID1234|XCID4321",
"status":"OPTED-IN",
"consentDate":"2015-05-01T23:01:12.000Z"
},
"contact":{ 
"email":"[email protected]",
"emailType":"HTML",
"leadSource":"Trade Show",
"customFields":[ 
{ 
"name" : "First Name",
"value" : "Bob"
},
{ 
"name" : "Last Name",
"value" : "Andrews"
},
{ 
"name" : "Alias Id",
"value" : "UserAccount4567"
}
]
}
}

When you use the GET method for the contactychannel Rest API call, you can retrieve the contact for a given database, channel, qualifier, and destination regardless of bad data.

When you use the Patch method for the contactychannel Rest API call, you will get a 422 error for bad data. Since the PATCH method is used to add or update a contact with the given contact data using channel information, the validation process will run for this call.

The error could be generated for bad data in ANY of the data fields for the record and not just for the fields that they are specifying in the Rest API call.