Contact REST API

Use the Contact REST API to create, update or delete Contacts.

API Contact

The Contact API is used to create or update a single contact POST, retrieve a contact GET, or delete a contact DELETE.

If a contact already exists, the contact is updated with any new values.

  1. /API/Contact/[DSID]

Sending a GET request with the DSID of the Contact you wish to retrieve. To see this in action, login to DailyStory and navigate to an existing contact. For example, /Contact/Detail/1359c31a651f4684a04c6e9d12ec154d. Then change the URL to API/Contact/1359c31a651f4684a04c6e9d12ec154d to see the JSON representation.

Sample response body

Returns 200 OK when created. The body of the response includes a JSON object with additional data with the DSID of the Contact.

{
"Status": true,
"Message": "",
"Code": 200,
"Response": {
"contact": {
"dsId": "1359c31a651f4684a04c6e9d12ec154d",
"salutation": "",
"firstName": "Ben",
"lastName": "Smith",
"optOut": false,
"email": "ben@example.com",
"title": "",
"status": "Active",
"company": "Carter Homes",
"numberOfEmployees": 0,
"industry": 0,
"annualRevenue": 0,
"website": "",
"phone": "",
"mobilePhone": "",
"timezone": "",
"avatarPath": "none",
"country": "",
"city": "",
"postalCode": "",
"address": "",
"geoCode": "32.8462546,-97.1137307",
"dateFirstSeen": "1753-01-01T00:00:00",
"dateLastSeen": "1753-01-01T00:00:00",
"region": "",
"gender": 10,
"dateBirth": null,
"age": 0,
"extendedProperties": {
"eligibility_date": "",
"group_code": "",
"product_code": "",
"source": ""
},
"dateContactCreated": "2018-07-17T00:00:00",
"timestampCreated": "2018-07-17T16:01:44.717",
"dateContactLastModified": "2018-07-17T20:00:12.023",
"dateLastContacted": "2018-07-17T20:00:12.023",
"accountId": 0
},
"id": "1359c31a651f4684a04c6e9d12ec154d"
}
}
  1. /API/Contact

The POST method of /API/Contact is used to create or update a Contact.

If you intend to update multiple records, use /API/Contact/Import (see below)

Sample request body

The body of the POST must include a JSON representation of the Contact. The only field that is required is an email address:

{
"email": "api@example.com"
}

Request body fields

Field Description Format Required
email The email address of the contact. string Yes

When creating a contact the following fields can also be specified.

Important - if you are updating an existing lead, these fields will be ignored. Instead you will need to use the Contact API to update fields for an existing Contact.

Field Description Format Required
salutation Mr., Mrs., etc. string No
firstName The first name of the person. string No
lastName The last name of the person. string No
title The person's title string No
numberOfEmployees The number of employees or people in the organization number No
industry The Standard Industrial Classification number for the organization number No
annualRevenue The annual revenue for the organization number No
website A url for the person or organization string No
address A street address string No
country The two character country code of the person's location string No
region The region or state of the person's location string No
city The city of the person's location string No
postalCode The postal or zip code of the person's location string No
geoCode The latitude and longitude of the person's location string, e.g. 47.60621,-122.33207 No
company The company or organization the person is part of string No
mobilePhone Primary or mobile phone, used for Text Message campaigns string No
phone Secondary or non-mobile phone string No
avatarPath Url to the person's avatar or image string No
gender Person's gender string No
dateOfBirth Person's date of birth date or null No

To specify additional data, such as custom fields, use extendedProperties. For example, if a customer downloaded your mobile app from the Apple App Store.

{
"email": "api@example.com"
"extendedProperties": {
"appStore": "Apple",
"downloaded": "2018-07-26T00:18:02.623"
}
}

Custom data added to extendedProperties is part of the Contact and can be used for segmentation and search for enterprise customers. All customers can use custom data for personalization.

  1. /API/Contact/[DSID]

Sending a DELETE request with the DSID of the Contact you wish to delete. Once a Contact is deleted it is ineligible for any DailyStory workflows or camapigns.

Contacts are deleted, but are not removed from DailyStory immediately.

API Contact RegisterDevice

The /API/Contact/RegisterDevice API is used to register multiple devices (iOS or Android) for Contacts to receive push notifications. Push notifications are configured as part of a Campaign's Workflow.

Important before using the RegisterDevice API you must have configured a Twilio Notify Service.

  1. /API/Contact/RegisterDevice

The POST method of /API/Contact/RegisterDevice is used to register either an Apple or Android device with a Contact. If multiple devices are registered to the same user, simply call this API with each of the unique device ids.

Sample request body

The body of the POST must include a JSON object that identifies the device_type, device_id, and the Contact's DSID:

{
"device_type" : "ios",
"device_id" : "abcdefgh1234567890",
"dsid" : "1234567890"
}

Request body fields

Field Description Format Required
device_type Indicates the type of device `ios` or `android` Yes
device_id The unique device id String Yes
dsid The Contact's unique DailyStory Id String Yes

Sample response body

Returns 200 OK when created.

{
"Status": true,
"Message": "",
"Code": 200,
"Response": {}
}

API Contact Import

The Contact Import API is designed for bulk importing/updating of contacts. A POST to the API is identical to /API/Contact. However, the Import API does not return the DSID of newly created Contacts as there are created in bulk.

If a contact already exists, the contact is updated with any new values.

  1. /API/Contact/Import

Sample request body

The body of the POST must include a JSON representation of the Contact. The only field that is required is an email address:

{
	"email": "api@example.com"
}

See the /API/Contact for additional request body fields.

Sample response body

Returns 200 OK when created. Unlike the POST:API/Contact, the bulk import does not return the DSID of the contacts created.

{
    "Status": true,
    "Message": "",
    "Code": 200,
    "Response": {}
}

A successful response indicates that the contact is queued for bulk import.