Quick overview
This workflow receives an LMS course-completion webhook, checks a passing score from Google Sheets, generates personalised certificate text with Groq (Llama), converts a styled HTML certificate to a PDF with PDFShift, logs the issuance to Google Sheets, and emails the PDF via Gmail, with Slack alerts on workflow errors.
How it works
- Receives a POST webhook when a student completes a course, including course ID, student details, score, and completion date.
- Looks up the course’s pass threshold and certificate template details from a Google Sheets “CourseThresholds” tab.
- Compares the student’s score to the pass score and stops processing if the score does not meet the threshold.
- Sends the student and course details to Groq’s OpenAI-compatible chat completions API (Llama) to generate a short personalised certificate body.
- Builds a styled HTML certificate that includes a generated certificate ID, the course name, score, and formatted completion date.
- Converts the HTML to a PDF file using the PDFShift API and stores the result as a binary attachment.
- Appends or updates an “IssuedCertificates” registry in Google Sheets and emails the PDF certificate to the student via Gmail.
- If the workflow errors, posts an alert message to a specified Slack channel.
Setup
- Configure your LMS to send a course-completion webhook to the workflow’s webhook URL (POST /course-completion) using the expected payload fields (course_id, student_id, student_name, student_email, score, completion_date).
- Connect Google Sheets OAuth credentials and replace YOUR_SPREADSHEET_ID, then create and map the “CourseThresholds” and “IssuedCertificates” tabs with the required columns.
- Add a Groq API key and replace the Authorization header value used for the Groq chat completions request.
- Add a PDFShift API key and replace the X-API-Key header value used for PDF conversion.
- Connect Gmail OAuth credentials for sending emails with PDF attachments.
- Connect Slack OAuth credentials and set the target channel for workflow error alerts.