We use cookies to improve your experience. Read more about how we handle your data in our GDPR policy.

    Back to Genju
    API Docsv1
    Docs

    Build a Real Integration in 30 Minutes

    Complete walkthrough: connect a website contact form to Genju, create contacts, fire automations, and handle webhooks.

    What we're building

    A Node.js + Express server that: 1. Receives form submissions from your website 2. Creates contacts in Genju 3. Fires a lead follow-up automation 4. Creates a deal in the pipeline 5. Listens for booking confirmations via webhook

    The form handler

    When someone submits your website contact form, this endpoint creates the contact and triggers a follow-up.
    javascript
    app.post('/contact-form', async (req, res) => {
      const { name, email, phone, message, service_interest } = req.body;
    
      try {
        // Step 1: Create or find the contact
        const contact = await genju.contacts.create({
          full_name: name,
          email: email,
          phone: phone,
          source: 'website-contact-form',
          tags: ['new-enquiry', service_interest].filter(Boolean),
          notes: message
        });
    
        // Step 2: Fire the lead follow-up automation
        await genju.automations.trigger('new_lead_followup', {
          contact_id: contact.id
        });
    
        // Step 3: Create a deal in the pipeline
        await genju.deals.create({
          contact_id: contact.id,
          stage: 'New Enquiry',
          title: `Enquiry: ${service_interest || 'General'}`,
        });
    
        res.json({ success: true, contact_id: contact.id });
      } catch (error) {
        console.error('Genju API error:', error.message);
        res.json({ success: true }); // Don't fail the form
      }
    });

    The webhook listener

    Listen for booking confirmations and add them to Google Calendar.
    javascript
    app.post('/genju-webhook', async (req, res) => {
      const payload = req.body;
      const sig = req.headers['x-genju-signature'];
    
      if (!verifyWebhookSignature(payload, sig, WEBHOOK_SECRET)) {
        return res.status(401).json({ error: 'Bad signature' });
      }
    
      if (payload.event === 'booking.confirmed') {
        const { contact_name, service_name, date, time } = payload.data;
        await addToGoogleCalendar({
          title: `${contact_name} — ${service_name}`,
          date, time
        });
      }
    
      res.status(200).json({ received: true });
    });