# Test receiving a webhook event
curl --location 'https://your-server.com/webhook' \
--header 'Content-Type: application/json' \
--data '{
"type": "Course/Published",
"occuredAt": 1508225229,
"body": {
"course": {
"id": 123,
"name": "Advanced JavaScript Course",
"annotation": "Learn advanced JavaScript concepts",
"isDraft": false,
"createdAt": 1507807711,
"updatedAt": 1507808372,
"publishedAt": 1508225229
}
}
}'

# Retrieve last webhook event
curl --location 'https://YOURSITE.konstant.ly/openapi/v1/webhook/course.published/last' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
Webhooks allow you to receive real-time notifications about events happening in your Konstantly platform. Each webhook event contains detailed information about what happened and the relevant resources.

Event Types

Course Events

Course/Published
event
Triggered when a course is published
Course/Unpublished
event
Triggered when a course is unpublished
Course/Assigned
event
Triggered when a course is assigned to a user
Course/Started
event
Triggered when a user starts a course
Course/Progress
event
Triggered when a user makes progress in a course
Course/Finished
event
Triggered when a user completes a course

User Events

User/Created
event
Triggered when a new user is created
User/Edited
event
Triggered when user information is updated

Group Events

Group/User/Created
event
Triggered when a user is added to a group

Common Properties

All webhook events share these common properties:
occuredAt
integer
required
Timestamp when the event occurred
type
string
required
Event type identifier
body
object
required
Event-specific payload data

Best Practices

  1. Webhook Handling:
  • Implement proper error handling
  • Use retry logic for failed deliveries
  • Process webhooks asynchronously
  • Validate webhook signatures
  • Respond quickly (2xx status)
  1. Security:
  • Use HTTPS endpoints
  • Validate event data
  • Keep endpoint URLs secret
  • Monitor for unusual patterns
  1. Implementation Tips:
  • Store raw webhook data
  • Process events idempotently
  • Set reasonable timeouts
  • Log webhook failures

Testing Webhooks

  1. Event History:
  • Use GET /webhook/:event/last to fetch recent events
  • Test handling with real event data
  • Verify payload processing
  1. Development:
  • Set up test environment endpoints
  • Use event simulator when available
  • Test all event types
  • Verify error handling
# Test receiving a webhook event
curl --location 'https://your-server.com/webhook' \
--header 'Content-Type: application/json' \
--data '{
"type": "Course/Published",
"occuredAt": 1508225229,
"body": {
"course": {
"id": 123,
"name": "Advanced JavaScript Course",
"annotation": "Learn advanced JavaScript concepts",
"isDraft": false,
"createdAt": 1507807711,
"updatedAt": 1507808372,
"publishedAt": 1508225229
}
}
}'

# Retrieve last webhook event
curl --location 'https://YOURSITE.konstant.ly/openapi/v1/webhook/course.published/last' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'