Typeform Connector

เชื่อมต่อ Typeform กับ Brevo ผ่าน Tajo เพื่อซิงค์ผลตอบแบบฟอร์มโดยอัตโนมัติ จับ leads จากฟอร์มแบบสนทนา และทริกเกอร์ระบบอัตโนมัติทางการตลาดตามการส่งแบบสำรวจและผลลัพธ์ quiz

ภาพรวม

คุณสมบัติค่า
แพลตฟอร์มTypeform
หมวดหมู่Forms & Surveys (แบบกำหนดเอง)
ความซับซ้อนในการตั้งค่าง่าย
การผสานรวมอย่างเป็นทางการไม่
ข้อมูลที่ซิงค์ผลตอบ ผู้ติดต่อ เหตุการณ์ แบบฟอร์ม
วิธีการยืนยันตัวตนOAuth 2.0 / Personal Access Token

ฟีเจอร์

  • การซิงค์ผลตอบแบบเรียลไทม์ - จับการส่งฟอร์มโดยอัตโนมัติผ่าน webhooks
  • การสร้างผู้ติดต่อ - สร้างหรืออัปเดตผู้ติดต่อ Brevo จากผลตอบฟอร์ม
  • Lead scoring - ใช้คะแนน quiz และข้อมูลฟอร์มสำหรับการคัดเลือก lead
  • Hidden Fields - ส่งข้อมูลลูกค้าผ่าน Hidden Fields สำหรับฟอร์มที่เป็นส่วนตัว
  • การแมปแบบมีเงื่อนไข - แมปฟิลด์ฟอร์มที่แตกต่างกันตาม response logic
  • รองรับหลายฟอร์ม - เชื่อมต่อหลาย typeforms กับรายการ Brevo ที่แตกต่างกัน

ข้อกำหนดเบื้องต้น

ก่อนเริ่มต้น ตรวจสอบให้แน่ใจว่าคุณมี:

  1. บัญชี Typeform (แผน Basic หรือสูงกว่าสำหรับ webhooks)
  2. Personal Access Token จาก Typeform Account Settings
  3. บัญชี Brevo ที่มีสิทธิ์เข้าถึง API
  4. บัญชี Tajo ที่มีสิทธิ์ connector

การยืนยันตัวตน

Personal Access Token

Terminal window
# Generate a token at https://admin.typeform.com/account#/section/tokens
export TYPEFORM_ACCESS_TOKEN=tfp_your_personal_access_token
export TAJO_API_KEY=your_tajo_api_key
export BREVO_API_KEY=your_brevo_api_key

OAuth 2.0

// OAuth 2.0 Authorization Flow
const authUrl = 'https://api.typeform.com/oauth/authorize?' +
new URLSearchParams({
client_id: process.env.TYPEFORM_CLIENT_ID,
redirect_uri: 'https://your-app.com/callback',
scope: 'forms:read responses:read webhooks:write accounts:read',
state: generateState()
});
// Exchange authorization code for access token
const tokenResponse = await fetch('https://api.typeform.com/oauth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
grant_type: 'authorization_code',
code: authorizationCode,
client_id: process.env.TYPEFORM_CLIENT_ID,
client_secret: process.env.TYPEFORM_CLIENT_SECRET,
redirect_uri: 'https://your-app.com/callback'
})
});

การกำหนดค่า

การตั้งค่าพื้นฐาน

connectors:
typeform:
enabled: true
access_token: "${TYPEFORM_ACCESS_TOKEN}"
forms:
- form_id: "abc123"
list_id: 5
mapping:
email_field: "email"
name_field: "full_name"
- form_id: "xyz789"
list_id: 6
mapping:
email_field: "work_email"
sync:
responses: true
contacts: true
events: true
webhook:
enabled: true
secret: "${TYPEFORM_WEBHOOK_SECRET}"

การแมปฟิลด์

field_mapping:
# Map Typeform field references to Brevo attributes
email: email
name: FIRSTNAME
company: COMPANY
phone: SMS
score: LEAD_SCORE
quiz_result: QUIZ_SCORE
nps_rating: NPS_SCORE
feedback: LAST_FEEDBACK

API Endpoints

Endpointเมธอดคำอธิบาย
https://api.typeform.com/formsGETแสดงรายการฟอร์มทั้งหมด
https://api.typeform.com/forms/{form_id}GETดึงฟอร์ม
https://api.typeform.com/formsPOSTสร้างฟอร์ม
https://api.typeform.com/forms/{form_id}PUTอัปเดตฟอร์ม
https://api.typeform.com/forms/{form_id}/responsesGETดึงผลตอบ
https://api.typeform.com/forms/{form_id}/responsesDELETEลบผลตอบ
https://api.typeform.com/forms/{form_id}/webhooks/{tag}PUTสร้าง/อัปเดต webhook
https://api.typeform.com/forms/{form_id}/webhooks/{tag}GETดู webhook
https://api.typeform.com/forms/{form_id}/webhooksGETแสดงรายการ webhooks

ตัวอย่างโค้ด

เริ่มต้น Connector

import { TajoClient } from '@tajo/sdk';
const tajo = new TajoClient({
apiKey: process.env.TAJO_API_KEY,
brevoApiKey: process.env.BREVO_API_KEY
});
await tajo.connectors.connect('typeform', {
accessToken: process.env.TYPEFORM_ACCESS_TOKEN,
forms: ['abc123', 'xyz789']
});

ดึงผลตอบแบบฟอร์ม

// Fetch responses using the Responses API
const response = await fetch(
'https://api.typeform.com/forms/abc123/responses?' +
new URLSearchParams({
page_size: 25,
since: '2024-01-01T00:00:00Z',
completed: 'true'
}),
{
headers: {
'Authorization': `Bearer ${process.env.TYPEFORM_ACCESS_TOKEN}`
}
}
);
const data = await response.json();
// Sync each response to Brevo
for (const item of data.items) {
const answers = item.answers;
const email = answers.find(a => a.field.ref === 'email')?.email;
if (email) {
await tajo.contacts.sync({
email,
attributes: {
FIRSTNAME: answers.find(a => a.field.ref === 'name')?.text,
LEAD_SCORE: item.calculated?.score || 0
},
listIds: [5]
});
}
}

ตั้งค่า Webhooks

// Register a webhook for real-time response notifications
await fetch(
'https://api.typeform.com/forms/abc123/webhooks/tajo-sync',
{
method: 'PUT',
headers: {
'Authorization': `Bearer ${process.env.TYPEFORM_ACCESS_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://api.tajo.io/webhooks/typeform',
enabled: true,
secret: process.env.TYPEFORM_WEBHOOK_SECRET
})
}
);

จัดการเหตุการณ์ Webhook

app.post('/webhooks/typeform', async (req, res) => {
// Verify webhook signature
const signature = req.headers['typeform-signature'];
const isValid = verifyTypeformSignature(
req.rawBody, signature, process.env.TYPEFORM_WEBHOOK_SECRET
);
if (!isValid) return res.status(401).send('Unauthorized');
const { form_response } = req.body;
await tajo.connectors.handleWebhook('typeform', {
topic: 'form_response',
payload: form_response
});
res.status(200).send('OK');
});

ขีดจำกัดอัตรา

Endpointขีดจำกัดอัตราหมายเหตุ
Create API2 คำขอ/วินาทีการสร้างและอัปเดตฟอร์ม
Responses API2 คำขอ/วินาทีการดึงผลตอบ
Webhooks API2 คำขอ/วินาทีการจัดการ webhook
ทุก endpoints120 คำขอ/นาทีขีดจำกัดอัตราทั่วโลก

การแบ่งหน้าผลตอบ

Responses API ส่งคืนสูงสุด 1,000 ผลตอบต่อคำขอ ใช้พารามิเตอร์ cursor before หรือ after สำหรับการแบ่งหน้าเมื่อดึงชุดผลตอบขนาดใหญ่

การแก้ไขปัญหา

ปัญหาสาเหตุวิธีแก้
ไม่ได้รับ webhookWebhook ถูกปิดใช้งานเปิดใช้งาน webhook ใน Typeform dashboard
ผลตอบหายไปตัวกรองถูกใช้งานตรวจสอบพารามิเตอร์ since/until และ completed
ข้อผิดพลาด auth 401Token หมดอายุสร้าง Personal Access Token ใหม่
Rate limit 429คำขอมากเกินไปใช้การจำกัดคำขอ
คำตอบว่างเปล่าฟิลด์ไม่บังคับจัดการค่า null/undefined ของคำตอบ

โหมด Debug

connectors:
typeform:
debug: true
log_level: verbose
log_webhooks: true
log_responses: true

แนวทางปฏิบัติที่ดีที่สุด

  1. ใช้ webhooks - ต้องการ webhooks มากกว่าการ polling สำหรับการจับผลตอบแบบเรียลไทม์
  2. ตรวจสอบลายเซ็น - ตรวจสอบลายเซ็น webhook เสมอเพื่อความปลอดภัย
  3. ใช้ Hidden Fields - กรอกข้อมูลลูกค้าที่ทราบอยู่แล้วล่วงหน้าในฟอร์ม
  4. แมป field references - ใช้ค่า ref ของฟิลด์ที่เสถียรแทนที่จะใช้ field IDs
  5. จัดการผลตอบบางส่วน - รับมือกับคำถามที่เป็นทางเลือกและถูกข้ามไป
  6. ตั้งค่า retry logic - ใช้การประมวลผล webhook แบบ idempotent

ความปลอดภัย

  • OAuth 2.0 - การยืนยันตัวตนแบบ scoped token
  • Webhook signatures - การตรวจสอบลายเซ็น SHA-256 HMAC
  • HTTPS เท่านั้น - API endpoints ทั้งหมดต้องการ TLS
  • Token scoping - ขอ OAuth scopes ขั้นต่ำที่จำเป็น
  • การจัดการ secret - เก็บ tokens ในตัวแปรสภาพแวดล้อมหรือ secret managers
  • ความสอดคล้องกับ GDPR - ใช้ Delete Responses API สำหรับคำขอการลบข้อมูล

แหล่งข้อมูลที่เกี่ยวข้อง

Subscribe to updates

developer-docs

Drop your email or phone number — we'll send you what matters next.

auto-detect
ผู้ช่วย AI

สวัสดี! ถามฉันเกี่ยวกับเอกสารได้เลย