Lead REST API

Use the Lead REST API to create or find leads in DailyStory.

Before working with a lead, always send a POST request to the lead API to get the Lead's Id. This will update the lead's activity date and ensure you have the correct id for the lead you wish to work with.

Create a Lead or update an existing Lead

To create a lead or find an existing lead you must have an email address and the Id of the Campaign the lead is part of.

The Id of the Campaign can be found by logining into DailyStory and navigating to a campaign. The Campaign Id will be the number in the URL.

Campaign Id

If a lead already exists within the campaign the API will return the id of the existing lead. Otherwise, DailyStory will create a new contact and then create a lead in the specified campaign.

  1. /API/Lead

Sample request body

The body of the POST must include a JSON representation of the Lead. For example, to create a new lead in campaign 649 with the email api@example.com:

{
	"campaignId": 649,
	"email": "api@example.com"
}

To see all the available fields login to DailyStory and navigate to an existing lead. For example, Lead/Detail/117604. Then change the URL to API/Lead/117604 to see the JSON representation.

{
	"leadId": 117604,
	"campaignId": 649,
	"ip": "",
	"leadSource": "Contact List",
	"points": 0,
	"score": 0.00,
	"workflowStepId": 0,
	"leadStatus": "Active",
	"leadOrigin": "List",
	"leadOriginId": "2",
	"leadOriginName": "Unit Test List",
	"leadExtendedProperties": {},
	"leadUID": "b685dd4acc364ac38cf1e75581ff187b-117604",
	"Description": "",
	"dsId": "b685dd4acc364ac38cf1e75581ff187b",
	"salutation": "",
	"firstName": "",
	"lastName": "",
	"optOut": false,
	"email": "api@example.com",
	"title": "",
	"status": "Active",
	"company": "Trial Account",
	"numberOfEmployees": 0,
	"industry": 0,
	"annualRevenue": 0,
	"website": "",
	"phone": "",
	"mobilePhone": "",
	"timezone": "",
	"avatarPath": "",
	"country": "",
	"city": "",
	"postalCode": "",
	"address": "",
	"geoCode": "",
	"dateFirstSeen": "1753-01-01T00:00:00",
	"dateLastSeen": "1753-01-01T00:00:00",
	"region": "",
	"gender": 0,
	"dateBirth": null,
	"age": 0,
	"extendedProperties": {},
	"dateContactCreated": "2018-03-26T00:00:00",
	"timestampCreated": "2018-03-26T02:45:36.623",
	"dateContactLastModified": "2018-06-26T00:18:02.623",
	"dateLastContacted": "2018-06-26T00:18:02.623",
	"accountId": 0
}

Request body fields

Field Description Format Required
email The email address of the lead. string Yes
campaignId The Id of the campaign the lead is part of. number Yes
leadSource Where the lead was created string No
description Text describing the lead, e.g. the contents from a form. string No

When creating a lead 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 either extendedProperties or leadExtendedProperties. For example, if a customer downloaded your mobile app from the Apple App Store.

{
	"leadId": 117604,
	"campaignId": 649,
	...
	"leadExtendedProperties": {
		"appStore": "Apple",
		"downloaded": "2018-07-26T00:18:02.623"
	}
}

Custom data added to leadExtendedProperties is available within the campaign for personalization, rules, and automations. Custom data added to extendedProperties is part of the Contact and can be additionally used for segmentation.

Sample response body

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

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

Get a Lead's Activities

A Lead Activity captures actions taken by the lead. Examples include: emails sent, pages viewed, participating in a webinar, signing into another application, registering in a mobile app, or any other activity you want to attribute to a person.

These actions are shown as a timeline when viewing a lead in the DailyStory.

To get the activities for a Lead, you must have the Lead Id

  1. /API/Lead/Activity/{Lead Id}

Sample response body

Returns 200 OK. The Response contains an 'activity' array of Lead Activities.

{
    "Status": true,
    "Message": "",
    "Code": 200,
    "Response": {
    	"activity": "[{ ... }]"
    }
}

Add an Activity to a Lead

A Lead Activity enables you to capture an action taken by a lead. Examples include: emails sent, pages viewed, participating in a webinar, signing into another application, registering in a mobile app, or any other activity you want to attribute to a person.

These actions are shown as a timeline when viewing a lead in the DailyStory.

To add an Activity for a Lead or to retrieve a Lead's Activities, you must have the Lead Id

  1. /API/Lead/Activity/{Lead Id}

Sample request body

The body of the POST must include a JSON representation of the Activty. For example, to create a new activity for a Lead with the Id of 117604:

HTTP POST /Lead/Activity/117604

{
    name = "My First Activity",
    description = "This is a description for my first activity"
}

When creating a Lead Activity you call also include an ActivityType. The Activity Type is used by DailyStory to perform special rules and formatting. For example, if you integrate with GoTo Webinar and want to submit an activity to DailyStory when someone registers for your webinar:

HTTP POST /Lead/Activity/117604

{
	activityType = 500,
    name = "My First Activity",
    description = "This is a description for my first activity"
}

To see the full list of numeric codes for various activity types, send a GET request to /api/Lead/ActivityTypes

Request body fields

Field Description Format Required
name Name of the activity. string Yes
description A description of the activity. string Yes
activityType A specific type of activity, otherwise defaults to the Notification activity type number No
data Json data used when an activity type is specified. string No
data Json data used when an activity type is specified. string No

Sample response body

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

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