Oktopost

Webhooks

Subscribe to real-time events in your Oktopost account and receive instant notifications via HTTP callbacks.

Webhooks enable you to build integrations that subscribe to events happening in your Oktopost account. When an event occurs, Oktopost sends an HTTP POST request to the URL you specify, allowing you to trigger automated workflows, sync data to external systems, or build custom notifications.

How Webhooks Work

  1. Create a webhook - Specify which event to monitor and where to send notifications
  2. Event occurs - When the subscribed event happens in Oktopost, a webhook is triggered
  3. Receive notification - Oktopost sends an HTTP POST request to your endpoint with event details
  4. Process the event - Your application receives and processes the webhook payload

Webhooks are sent in real-time as events occur. For event history and debugging, use the Webhook Log endpoint to review past webhook executions.

Supported Events

You can subscribe to the following event types when creating or updating webhooks:

Advocacy Events

Event TypeDescription
newAdvocacyMessageTriggers when a new message is added to the advocacy board
newAdvocacyStoryTriggers when a new story is added to the advocacy board
newAdvocacyTopicTriggers when a new topic is added to the advocacy board

Publishing Events

Event TypeDescription
postCreatedTriggers when a user creates a new post
postModifiedTriggers when a user updates a scheduled post
postDeletedTriggers when a user deletes a scheduled post
postSentTriggers when a post is published to social media

Engagement Events

Event TypeDescription
newConversationTriggers when a new conversation appears in your inbox
conversationUpdatedTriggers when new comments or replies are added to an existing conversation
conversationStatusUpdatedTriggers when a conversation status changes
newNoteOnConversationTriggers when a note is added to a conversation
newAssignmentTriggers when a conversation is assigned to a user

Lead & Conversion Events

Event TypeDescription
newLeadTriggers when a new lead is captured
newLeadActivityTriggers when new social activity is detected for a lead
newConversionTriggers when a social conversion is captured

Workflow Events

Event TypeDescription
newApprovalItemTriggers when posts or messages are sent to approval
approvalItemApprovedTriggers when posts or messages are approved
approvalItemRejectedTriggers when posts or messages are rejected

Other Events

Event TypeDescription
newCampaignTriggers when a new campaign is created

List Webhooks

Retrieve all webhooks configured in your account with optional filtering and pagination.

Parameters

ParameterTypeRequiredDescription
eventStringNoFilter by event type. See supported events above.
nameStringNoSearch webhooks by name
_orderStringNoSort order. Options: name, description, lastExecutionDate, isEnabled, created, modified. Default: name
_pageIntegerNoPage number for pagination. Default: 0
_countIntegerNoItems per page. Options: 20, 25, 50, 100. Default: 20

Request

curl -u ACCOUNT_ID:API_KEY \
  "https://api.oktopost.com/v2/webhook"

Response

{
	"Result": true,
	"Items": [
		{
			"Id": "0WA000000000001",
			"Name": "My Webhook",
			"Description": "Send new assignment to Slack",
			"Event": "newAssignment",
			"Url": "https://hooks.slack.com/services/...",
			"LastExecutionDate": "2024-01-15 10:30:00",
			"IsEnabled": 1,
			"Created": "2017-05-23 14:07:18",
			"Modified": "2017-05-23 14:07:18"
		}
	],
	"Total": 1
}

Get Webhook

Retrieve details for a specific webhook by ID.

Request

curl -u ACCOUNT_ID:API_KEY \
  https://api.oktopost.com/v2/webhook/0WA000000000001

Response

{
	"Result": true,
	"Webhook": {
		"Id": "0WA000000000001",
		"Name": "My Webhook",
		"Description": "Send new assignment to Slack",
		"Event": "newAssignment",
		"Url": "https://hooks.slack.com/services/...",
		"LastExecutionDate": "2024-01-15 10:30:00",
		"IsEnabled": 1,
		"Created": "2017-05-23 14:07:18",
		"Modified": "2017-05-23 14:07:18"
	}
}

Create Webhook

Create a new webhook to subscribe to a specific event type.

Parameters

ParameterTypeRequiredDescription
eventStringYesThe event type to subscribe to. See supported events above.
nameStringYesA descriptive name for this webhook
urlStringYesThe endpoint URL where webhook payloads will be sent
descriptionStringNoAdditional details about this webhook's purpose
isEnabledIntegerNoEnable or disable the webhook. 1 = enabled, 0 = disabled. Default: 1

Request

curl -u ACCOUNT_ID:API_KEY \
  https://api.oktopost.com/v2/webhook -X POST \
  -d event="newAssignment" \
  -d name="Slack Assignment Notification" \
  -d description="Send assignment notifications to Slack" \
  -d url="https://hooks.slack.com/services/..." \
  -d isEnabled=1

Response

{
	"Result": true,
	"Webhook": {
		"Id": "0WA000000000001",
		"Name": "Slack Assignment Notification",
		"Description": "Send assignment notifications to Slack",
		"Event": "newAssignment",
		"Url": "https://hooks.slack.com/services/...",
		"LastExecutionDate": "-",
		"IsEnabled": 1,
		"Secret": "a1b2c3d4e5f6...",
		"Created": "2017-05-23 14:07:18",
		"Modified": "2017-05-23 14:07:18"
	}
}

When creating a webhook, a Secret is generated. Use this secret to verify that webhook requests are genuinely from Oktopost (see Security section below).

Update Webhook

Modify an existing webhook's configuration.

Parameters

ParameterTypeRequiredDescription
eventStringNoChange the event type this webhook subscribes to
nameStringNoUpdate the webhook name
urlStringNoUpdate the destination URL
descriptionStringNoUpdate the description
isEnabledIntegerNoEnable or disable the webhook. 1 = enabled, 0 = disabled

Request

curl -u ACCOUNT_ID:API_KEY \
  https://api.oktopost.com/v2/webhook/0WA000000000001 -X POST \
  -d name="Updated Webhook Name" \
  -d description="Updated description" \
  -d isEnabled=0

Response

{
	"Result": true,
	"Webhook": {
		"Id": "0WA000000000001",
		"Name": "Updated Webhook Name",
		"Description": "Updated description",
		"Event": "newAssignment",
		"Url": "https://hooks.slack.com/services/...",
		"LastExecutionDate": "2024-01-15 10:30:00",
		"IsEnabled": 0,
		"Created": "2017-05-23 14:07:18",
		"Modified": "2024-01-16 09:15:32"
	}
}

Delete Webhook

Remove a webhook. This action cannot be undone.

Request

curl -u ACCOUNT_ID:API_KEY \
  https://api.oktopost.com/v2/webhook/0WA000000000001 -X DELETE

Response

{
	"Result": true
}

Webhook Log

View the execution history for a specific webhook, including response codes, execution times, and payloads sent.

Request

curl -u ACCOUNT_ID:API_KEY \
  https://api.oktopost.com/v2/webhook-log/0WA000000000001

Response

{
	"Result": true,
	"Items": [
		{
			"Id": "0WC000000000001",
			"WebhookPayloadId": "0WB000000000001",
			"Created": "2017-05-23 14:07:18",
			"ResponseCode": 200,
			"ExecutionTime": 0.034530,
			"Payload": {
				"event": "newAssignment",
				"data": {
					"conversationId": "123456",
					"assignedTo": "user@example.com",
					"assignedBy": "manager@example.com"
				}
			}
		}
	],
	"Total": 1
}

Response Fields

FieldDescription
ResponseCodeHTTP status code returned by your webhook endpoint
ExecutionTimeTime in seconds it took your endpoint to respond
PayloadThe complete webhook payload that was sent to your endpoint

Use webhook logs to:

  • Debug webhook delivery issues
  • Monitor webhook performance
  • Review historical event data
  • Verify payload structures

Webhook Payload Structure

When an event occurs, Oktopost sends a POST request to your webhook URL with the following structure:

{
	"event": "newAssignment",
	"timestamp": 1705315200,
	"webhookId": "0WA000000000001",
	"data": {
		// Event-specific data
	}
}

The data object contains information specific to the event type. For example:

newAssignment Event:

{
	"event": "newAssignment",
	"timestamp": 1705315200,
	"webhookId": "0WA000000000001",
	"data": {
		"conversationId": "123456",
		"assignedTo": "user@example.com",
		"assignedBy": "manager@example.com",
		"assignedAt": "2024-01-15 10:30:00"
	}
}

postSent Event:

{
	"event": "postSent",
	"timestamp": 1705315200,
	"webhookId": "0WA000000000001",
	"data": {
		"postId": "0PL000000000001",
		"network": "LinkedIn",
		"campaignId": "002000000000001",
		"sentAt": "2024-01-15 10:30:00"
	}
}

Security Best Practices

Verify Webhook Signatures

Use the webhook Secret to verify that requests are genuinely from Oktopost:

const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const expectedSignature = crypto
    .createHmac('sha256', secret)
    .update(JSON.stringify(payload))
    .digest('hex');
  
  return signature === expectedSignature;
}

Endpoint Requirements

Your webhook endpoint should:

  • Respond quickly - Return a 2xx status code within 5 seconds
  • Use HTTPS - All webhook URLs must use HTTPS
  • Handle retries - Oktopost retries failed webhooks up to 3 times
  • Be idempotent - Handle duplicate webhook deliveries gracefully
  • Validate payloads - Always verify the webhook secret before processing

Error Handling

If your endpoint returns a non-2xx status code or times out:

  • Oktopost will retry the webhook up to 3 times
  • Retries use exponential backoff (5s, 25s, 125s)
  • After 3 failed attempts, the webhook delivery is abandoned
  • Check the webhook log to diagnose delivery issues

Common Use Cases

Slack Notifications

Send real-time alerts to Slack when conversations are assigned or posts are published.

CRM Integration

Automatically create or update CRM records when new leads or conversions are captured.

Custom Analytics

Stream event data to your analytics platform for custom reporting and dashboards.

Workflow Automation

Trigger automated workflows in tools like Zapier, Make, or n8n based on Oktopost events.

Audit Logging

Maintain a complete audit trail of all activities in an external database.

Getting Started

To start using webhooks:

  1. Set up an endpoint - Create a publicly accessible HTTPS endpoint to receive webhooks
  2. Create a webhook - Use the API to create a webhook pointing to your endpoint
  3. Test the webhook - Trigger the subscribed event in Oktopost to test delivery
  4. Verify signatures - Implement signature verification for security
  5. Handle errors - Add error handling and logging to your webhook handler
  6. Monitor logs - Use the webhook log endpoint to monitor delivery and troubleshoot issues

For questions or assistance with webhook implementation, please contact our support team.