Quick overview
This workflow receives Stripe payment webhooks, looks up the customer’s order in Google Sheets, generates personalized HTML content with OpenAI, converts it to a PDF using PDFShift, then queues the request for human approval and delivers the final document via Gmail with Slack notifications.
How it works
- Receives a Stripe payment notification via a webhook endpoint.
- Extracts payment details (event type, payment ID, customer email, amount, currency) and stops the main flow if the email is missing.
- Pulls order rows from Google Sheets and matches the order to the payer’s email.
- Sends the combined payment and order data to the OpenAI Chat Completions API to generate structured personalized content, then renders it into an HTML document.
- Converts the HTML to a PDF with PDFShift and sends the customer an acknowledgement email via Gmail.
- Appends the request to a Google Sheets “ReviewQueue” and notifies staff in Slack with instructions to approve via a separate webhook.
- When an approval webhook is received and marked approved, emails the final message to the customer via Gmail and updates the “ReviewQueue” status in Google Sheets.
Setup
- Create and configure two webhook URLs in Stripe and your internal approval process using the workflow’s webhook paths (upwork-stripe-pdf-order and upwork-pdf-approve).
- Connect Google Sheets OAuth credentials and set the correct spreadsheet ID and sheet names for reading “Orders” and writing to “ReviewQueue.”
- Add an OpenAI API credential and confirm the model/endpoint settings used for Chat Completions.
- Add PDFShift HTTP Basic Auth credentials and set sandbox/production settings as needed.
- Connect Gmail OAuth2 credentials for acknowledgement and final delivery emails, and set up Slack OAuth2 credentials plus the target channel for staff notifications.