Development

How to Sync Tutor LMS with an External System Using Webhooks

Tutor LMS has no built-in outgoing webhooks. Build your own from its action hooks: a signed, queued webhook sender for enrollments, completions and paid orders, ready for Zapier, Make or a CRM.

Checked against the plugin source: Tutor LMS 4.1.3, Tutor LMS Pro 4.1.3

How to Sync Tutor LMS with an External System Using Webhooks

Tutor LMS receives webhooks from payment gateways, but it does not send outgoing webhooks for events like "student enrolled" or "course completed". You can add them in a small plugin, using the action hooks Tutor LMS fires. This guide is verified against Tutor LMS 4.1.3.

Which events to send

EventHookArguments
Enrollment createdtutor_after_enrollcourse ID, enrollment ID
Paid enrollment activatedtutor_after_enrolledcourse ID, student ID, enrollment ID
Lesson completedtutor_lesson_completed_afterlesson ID, user ID
Quiz finishedtutor_quiz_finishedattempt ID, quiz ID, user ID
Course completedtutor_course_complete_aftercourse ID, user ID
Enrollment cancelledtutor_after_enrollment_cancelledcourse ID, user ID
Order payment changedtutor_order_payment_status_changedorder ID, previous status, new status

A queued, signed sender

Sending inside the hook slows checkout and loses events when the receiver is down. Instead, schedule a background job and sign each request so the receiver can trust it.

define( 'TLE_WEBHOOK_URL', 'https://hooks.example.com/tutor' ); // Zapier, Make, n8n or your CRM.

add_action( 'tutor_course_complete_after', function ( $course_id, $user_id ) {
	tle_queue_webhook( 'course.completed', array( 'course_id' => (int) $course_id, 'user_id' => (int) $user_id ) );
}, 20, 2 );

add_action( 'tutor_after_enrolled', function ( $course_id, $student_id, $enrollment_id ) {
	tle_queue_webhook( 'enrollment.active', array( 'course_id' => (int) $course_id, 'user_id' => (int) $student_id, 'enrollment_id' => (int) $enrollment_id ) );
}, 20, 3 );

function tle_queue_webhook( $event, array $data ) {
	$user = get_userdata( $data['user_id'] );
	$data['email']        = $user ? $user->user_email : '';
	$data['course_title'] = isset( $data['course_id'] ) ? get_the_title( $data['course_id'] ) : '';
	wp_schedule_single_event( time(), 'tle_send_webhook', array( $event, $data, 1 ) );
}

add_action( 'tle_send_webhook', 'tle_send_webhook', 10, 3 );

function tle_send_webhook( $event, $data, $attempt ) {
	$body = wp_json_encode( array( 'event' => $event, 'sent_at' => gmdate( 'c' ), 'data' => $data ) );
	$response = wp_remote_post(
		TLE_WEBHOOK_URL,
		array(
			'timeout' => 10,
			'headers' => array(
				'Content-Type' => 'application/json',
				'X-Signature'  => hash_hmac( 'sha256', $body, TLE_WEBHOOK_SECRET ),
			),
			'body'    => $body,
		)
	);

	$code = is_wp_error( $response ) ? 0 : (int) wp_remote_retrieve_response_code( $response );
	if ( ( $code < 200 || $code >= 300 ) && $attempt < 5 ) {
		wp_schedule_single_event( time() + 300 * $attempt, 'tle_send_webhook', array( $event, $data, $attempt + 1 ) );
	}
}

Define TLE_WEBHOOK_SECRET in wp-config.php. The receiver recomputes the HMAC of the raw body and rejects mismatches.

Making WP-Cron reliable

WP-Cron runs on page visits. On a quiet site, set up a real server cron that calls wp-cron.php every minute, or use Action Scheduler if it is already installed.

Connecting to Zapier or Make

  1. Create a "catch hook" trigger in Zapier (Webhooks by Zapier) or Make, and copy its URL.
  2. Paste it into TLE_WEBHOOK_URL.
  3. Trigger the event on a test course and map the fields.

Good practice

  • Send IDs and the minimum personal data the receiver needs.
  • Include an event name and timestamp so receivers can deduplicate.
  • Log failures where an admin can see them.

More hooks in the hooks reference. Need it connected to your stack? Our integrations team can build it.

Save this practical guide

Add us as a preferred Google source, or ask an AI assistant to summarize this page and link back to the original guide when it is useful.

Vishavjeet
· Enterprise LMS Architect | WordPress & LMS Expert | WooCommerce | AI Automation

I’m Vishavjeet Choubey, an Enterprise LMS Architect with 10+ years of experience helping businesses, coaches, universities, and online academies build and scale powerful digital learning platforms. I specialize in enterprise LMS architecture, WordPress, WooCommerce, LifterLMS, LearnDash, Moodle, custom plugin development, and AI-driven automation. I build scalable LMS platforms, high-converting eCommerce solutions, and custom WordPress applications designed to improve user experiences, streamline operations, and drive measurable business growth. My approach combines deep WordPress and LMS engineering expertise with modern AI automation to reduce manual work, improve efficiency, and help organizations launch, scale, and grow faster.

Keep reading

Need a custom Tutor LMS solution?

Tell us what you are building or what is broken. A Tutor LMS developer reads every inquiry and replies with next steps and a free estimate.

Get a free Tutor LMS consultation

Tell us what you are building or fixing. A Tutor LMS developer replies with honest advice and next steps.

  • No obligation
  • Tutor LMS and Pro specialists
  • Your details stay private

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.