Oktopost
Advocacy

Advocates

Get, list, invite, update, and delete advocates, and list a board's custom fields.

Advocates are employees or other individuals who promote your company on their personal social media channels. In Oktopost, advocates are system users who are members of an advocacy board. Use these endpoints to retrieve advocates, add new members to boards, update advocate roles and custom fields, and manage advocate participation in your advocacy program.

Advocates need an Oktopost user account to access the advocacy board. Before you add advocates, make sure they have been invited to the platform.

Get Advocate

Retrieve a single advocate by user ID.

GET /v2/advocate/:advocateId

Parameters

Prop

Type

Example Request

curl -X GET "https://api.oktopost.com/v2/advocate/00A000000000001?boardId=brd000000000001" \
  -u ACCOUNT_ID:API_KEY

Example Response

{
  	"Result": true,
  	"Advocate": {
		"Id": "00A000000000001",
		"Created": "2012-03-25 18:48:32",
		"Modified": "2018-09-26 13:27:55",
		"Status": "active",
		"Name": "Jane Smith",
		"FirstName": "Jane",
		"LastName": "Smith",
		"Email": "jane@example.com",
		"PictureUrl": null,
		"LastBoardLogin": "2018-09-12 17:18:42",
		"Profiles": [
			{
				"Id": "003-001000000000001-10795428XXXXXXXXX",
				"Created": "2015-10-26 21:02:30",
				"Name": "Oktopost's Twitter",
				"Status": "valid",
				"Network": "Twitter",
				"ImageLink": "valid",
				"NetworkUsername": "oktopost"
			}
		],
		"BoardIds": [
			"brd000000000001"
		],
		"Topics": [
			"tpc000000000001"
		],
		"LatestShares": [
			{
				"Id": "004000000000001",
				"Created": "2018-09-12 18:29:42",
				"CreatedBy": "00A000000000001",
				"Network": "Twitter",
				"CredentialId": "003-001000000000001-10795428XXXXXXXXX",
				"CredentialImage": "...",
				"Message": "Good Vs. Bad #SocialMedia Management Platforms: 5 Capabilities You Need to Build a Data-Driven #B2BMarketing Team",
				"ImageUrl": "",
				"LinkUrl": "",
				"LinkTitle": "",
				"Description": "",
				"Picture": null,
				"Type": "status-update",
				"Media": null,
				"StartDateTime": "2018-09-12 18:29:38",
				"EndDateTime": "2019-03-13 03:59:59",
				"Status": "complete",
				"Source": "Board",
				"TargetGeo": ""
			}
		],
		"CustomFields": [
			{
				"FieldId": "0CF000000000001",
				"FieldName": "Department",
				"IsRequired": true,
				"Options": [
					{ "ID": "0CO000000000001", "Value": "Marketing" }
				]
			}
		]
	}
}

List Advocates

Retrieve the advocates in the account, optionally filtered by board, activity, role, or custom field.

GET /v2/advocate

Without boardId, only q, email, _order, _page, and _count apply. The board filters role, customFields, leaderboard, lastSeen, notSeen, neverSeen, sharesPeriod, and shareAmountOperator require boardId, and sending one without it returns 400. You can send only one of lastSeen, notSeen, and neverSeen per request. See the error conditions under Example Error.

See Pagination for shared behavior.

Parameters

Prop

Type

Filters accept IDs and day counts only. Role names, custom field names, option values, and preset periods such as last_7_days or last_90_days are rejected.

Example Request

curl -X GET "https://api.oktopost.com/v2/advocate?boardId=brd000000000001&q=jane&lastSeen=30&_order=shares,0" \
  -u ACCOUNT_ID:API_KEY

Example Error

The request returns 400 when:

  • boardId is not a valid board ID, or the board doesn't exist or isn't accessible to you.
  • A board filter (role, customFields, leaderboard, lastSeen, notSeen, neverSeen, sharesPeriod, or shareAmountOperator) is sent without boardId.
  • lastSeen, notSeen, or sharesPeriod is not an integer from 1 to 365.
  • More than one of lastSeen, notSeen, and neverSeen=true is sent. These filters are mutually exclusive.
  • A role, custom field, custom field option, or leaderboard ID is unknown, or an option ID doesn't belong to its custom field.
  • shareAmountOperator is not one of the listed operators.
  • q is longer than 1000 characters.
  • _page, _count, or shareAmountValue is not a number.

A board filter sent without boardId:

{
	"Result": false,
	"Errors": {
		"Advocacy": {
			"boardId": "boardId is required"
		}
	}
}

Invite Advocates

Invite a new advocate by email, or re-invite an existing board advocate by userId.

POST /v2/advocate

Provide either email or userId, not both.

Invalid input returns 400. When a new invite fails validation, the error key is the field that failed: email, name, role, or the custom field ID. Exceeding the board advocate seat limit returns an Advocacy RateLimit error.

Parameters

Prop

Type

Example Request

New invite:

curl -X POST "https://api.oktopost.com/v2/advocate" \
  -u ACCOUNT_ID:API_KEY \
  -d boardId="brd000000000001" \
  -d firstName="John" \
  -d lastName="Doe" \
  -d email="john.doe@example.com" \
  -d role="contributor" \
  -d "customFields[0CF000000000001]=0CO000000000001" \
  -d "customFields[0CF000000000002]=0CO000000000005" \
  -d message="Welcome to the advocacy board"

Re-invite:

curl -X POST "https://api.oktopost.com/v2/advocate" \
  -u ACCOUNT_ID:API_KEY \
  -d boardId="brd000000000001" \
  -d userId="00A000000000001" \
  -d message="Reminder to join the board"

Example Response

{
	"Result": true,
	"Users": [
		{
			"Id": "00A000000000001",
			"Name": "Jane Smith",
			"Email": "jane@example.com"
        }
	]
}

Example Error

A custom field value that matches no option of that field:

{
	"Result": false,
	"Errors": {
		"Advocacy": {
			"0CF000000000002": "Unknown custom field option"
		}
	}
}

Bulk Invite Advocates

Invite or re-invite up to 100 advocates in one request.

POST /v2/advocate/bulk

Valid entries are processed, and invalid entries are returned in Errors without failing the whole request.

/v2/advocate/bulk accepts POST only, and other methods return 405. To update advocates in bulk, use /v2/advocate/bulk-update. Requests with more than 100 entries return 400. Exceeding the board seat limit returns an Advocacy RateLimit error for the whole request.

Parameters

Prop

Type

Each users[] entry must include either email or userId, not both:

Prop

Type

Example Request

curl -X POST "https://api.oktopost.com/v2/advocate/bulk" \
  -u ACCOUNT_ID:API_KEY \
  -d boardId="brd000000000001" \
  -d message="Welcome to the advocacy board" \
  -d "users[0][userId]=00A000000000001" \
  -d "users[1][email]=john.doe@example.com" \
  -d "users[1][firstName]=John" \
  -d "users[1][lastName]=Doe" \
  -d "users[1][customFields][0CF000000000001]=0CO000000000002" \
  -d "users[2][email]=bad-email" \
  -d "users[2][firstName]=Bad" \
  -d "users[2][lastName]=Email"

Example Response

{
	"Result": true,
	"Users": [
		{
			"Id": "00A000000000001",
			"Name": "Jane Smith",
			"Email": "jane@example.com"
		},
		{
			"Id": "00A000000000002",
			"Name": "John Doe",
			"Email": "john.doe@example.com"
		}
	],
	"Errors": [
		{
			"Id": 3,
			"Data": {
				"email": "bad-email",
				"firstName": "Bad",
				"lastName": "Email"
			},
			"ErrorField": "email",
			"ErrorMessage": "Invalid email address"
		}
	]
}

Each error Id is the 1-based index of the entry in users. Successful invites and re-invites appear in Users (Id, Name, Email).

Update Advocate

Update an existing board advocate's role, custom field values, or both.

POST /v2/advocate/:advocateId

Send at least one of role or customFields. Custom fields you don't send keep their current value.

The advocate must be an active advocate on the board. Invalid input returns 400. The error key is the field that failed: userId, role, customFields, or the custom field ID. The value is the validation message, for example Invalid role, Unknown custom field. Use the custom field ID as the key, Unknown custom field option ID, or User is not an advocate on this board.

Parameters

Prop

Type

Example Request

curl -X POST "https://api.oktopost.com/v2/advocate/00A000000000001" \
  -u ACCOUNT_ID:API_KEY \
  -d boardId="brd000000000001" \
  -d role="contributor" \
  -d "customFields[0CF000000000001]=0CO000000000002" \
  -d "customFields[0CF000000000002]="

Example Response

Returns the updated advocate in the same format as Get Advocate with boardId.

{
	"Result": true,
	"Advocate": {
		"Id": "00A000000000001",
		"Name": "Jane Smith",
		"FirstName": "Jane",
		"LastName": "Smith",
		"Email": "jane@example.com",
		"BoardIds": [
			"brd000000000001"
		],
		"CustomFields": [
			{
				"FieldId": "0CF000000000001",
				"FieldName": "Department",
				"IsRequired": true,
				"Options": [
					{ "ID": "0CO000000000002", "Value": "Sales" }
				]
			}
		]
	}
}

Example Error

A custom field value that is not an option ID of that field:

{
	"Result": false,
	"Errors": {
		"Advocacy": {
			"0CF000000000001": "Unknown custom field option ID"
		}
	}
}

Bulk Update Advocates

Update the role, custom field values, or both for up to 100 board advocates in one request.

POST /v2/advocate/bulk-update

Valid entries are processed, and invalid entries are returned in Errors without failing the whole request.

/v2/advocate/bulk-update accepts POST only, and other methods return 405. Requests with more than 100 entries return 400. Each userId may appear only once per request; repeated entries are returned as Duplicate userId errors.

Parameters

Prop

Type

Each users[] entry must include userId and at least one of role or customFields:

Prop

Type

Example Request

curl -X POST "https://api.oktopost.com/v2/advocate/bulk-update" \
  -u ACCOUNT_ID:API_KEY \
  -d boardId="brd000000000001" \
  -d "users[0][userId]=00A000000000001" \
  -d "users[0][role]=contributor" \
  -d "users[1][userId]=00A000000000002" \
  -d "users[1][customFields][0CF000000000001]=0CO000000000001" \
  -d "users[2][userId]=00A000000000003" \
  -d "users[2][customFields][0CF000000000001]=0CO999999999999"

Example Response

{
	"Result": true,
	"Users": [
		{
			"Id": "00A000000000001",
			"Name": "Jane Smith",
			"Email": "jane@example.com"
		},
		{
			"Id": "00A000000000002",
			"Name": "John Doe",
			"Email": "john.doe@example.com"
		}
	],
	"Errors": [
		{
			"Id": 3,
			"Data": {
				"userId": "00A000000000003",
				"customFields": {
					"0CF000000000001": "0CO999999999999"
				}
			},
			"ErrorField": "0CF000000000001",
			"ErrorMessage": "Unknown custom field option ID"
		}
	]
}

Each error Id is the 1-based index of the entry in users. ErrorField is userId, role, customFields, or the custom field ID that failed validation. If the role is applied but saving custom fields fails, the entry is returned in Errors with Role updated, but failed to update custom fields.

Delete Advocate

Remove an advocate from a board.

DELETE /v2/advocate/:advocateId

Parameters

Prop

Type

Example Request

curl -X DELETE "https://api.oktopost.com/v2/advocate/00A000000000001?boardId=brd000000000001" \
  -u ACCOUNT_ID:API_KEY

Example Response

{
	"Result": true
}

List Advocates Custom Fields

Retrieve the custom fields defined on a board, with their allowed options.

GET /v2/advocate/custom-fields

Use the field ID and option ID values from this response for the customFields parameter when you invite or update advocates.

This endpoint accepts GET only, and other methods return 405. It requires read permission for advocacy custom fields.

Parameters

Prop

Type

Example Request

curl -X GET "https://api.oktopost.com/v2/advocate/custom-fields?boardId=brd000000000001" \
  -u ACCOUNT_ID:API_KEY

Example Response

{
	"Result": true,
	"CustomFields": [
		{
			"ID": "0CF000000000001",
			"FieldName": "Department",
			"Description": "Advocate's department",
			"IsRequired": true,
			"Options": [
				{ "ID": "0CO000000000001", "Value": "Marketing" },
				{ "ID": "0CO000000000002", "Value": "Sales" }
			]
		},
		{
			"ID": "0CF000000000002",
			"FieldName": "Region",
			"Description": "",
			"IsRequired": false,
			"Options": [
				{ "ID": "0CO000000000003", "Value": "EMEA" },
				{ "ID": "0CO000000000004", "Value": "North America" }
			]
		}
	]
}

Custom Field Values

The customFields parameter is an object keyed by custom field ID. For form-encoded requests, send each field as customFields[<fieldId>]=<value>. The rules differ between invites (Invite Advocates and Bulk Invite Advocates) and updates (Update Advocate and Bulk Update Advocates).

Prop

Type