Portal Community

Example 1: Two-Factor Authentication SMS

Scenario: Send a 6-digit OTP via SMS for transaction authorisation.

{
  "credential_id": "twilio-main-account",
  "operation": "sendSms",
  "to_number": "{{ vars.user_phone }}",
  "from_number": "{{ env.TWILIO_SENDER_NUMBER }}",
  "message": "{{ env.COMPANY_NAME }} verification code: {{ vars.otp_code }}\n\nExpires in 10 minutes. Do not share this code."
}
Expected outcome: OTP delivered via SMS within seconds. The OTP was generated by an upstream CodeExecute node and stored in vars.otp_code.

Example 2: Appointment Reminder SMS

Scenario: Send a personalised appointment reminder 24 hours before the scheduled time.

{
  "credential_id": "twilio-main-account",
  "operation": "sendSms",
  "to_number": "{{ vars.patient_phone }}",
  "from_number": "{{ env.TWILIO_SENDER_NUMBER }}",
  "message": "Reminder: You have an appointment with {{ vars.doctor_name }} tomorrow {{ vars.appointment_date }} at {{ vars.appointment_time }} at {{ vars.clinic_name }}.\n\nReply CONFIRM to confirm or call {{ vars.clinic_phone }} to reschedule."
}
Expected outcome: Patient receives a clear reminder SMS with a reply-based confirmation option. Inbound CONFIRM replies are handled by a separate Twilio webhook trigger workflow that updates the appointment status.

Example 3: Emergency Staff Broadcast

Scenario: Rapidly notify all on-call staff via SMS during an emergency. A Loop node iterates over the oncall_staff array.

{
  "credential_id": "twilio-main-account",
  "operation": "sendSms",
  "to_number": "{{ vars.staff_member.phone }}",
  "from_number": "{{ env.TWILIO_EMERGENCY_NUMBER }}",
  "message": "URGENT — {{ vars.incident_type }} at {{ vars.location }}. Report to {{ vars.assembly_point }} immediately. Call {{ vars.incident_commander }} for details. Do not use elevators.",
  "status_callback": "{{ env.BIZFIRST_WEBHOOK_BASE }}/twilio/sms-status"
}
Expected outcome: All oncall staff receive the emergency SMS simultaneously (via parallel Loop execution). Delivery status callbacks update a tracking variable for accountability reporting.

Example 4: Automated Outbound Voice Survey

Scenario: Call a customer after service completion to collect a 1-5 satisfaction rating via DTMF input.

{
  "credential_id": "twilio-main-account",
  "operation": "makeCall",
  "to_number": "{{ vars.customer_phone }}",
  "from_number": "{{ env.TWILIO_CALLER_NUMBER }}",
  "twiml_url": "{{ env.BIZFIRST_WEBHOOK_BASE }}/twiml/satisfaction-survey?order={{ vars.order_number }}&customer={{ vars.customer_id }}",
  "timeout": 30,
  "record": true,
  "machine_detection": "Enable"
}
Expected outcome: Customer is called and presented with a satisfaction survey. DTMF responses are captured by the TwiML handler. The call_sid is stored for recording/transcription retrieval. Machine detection prevents voicemail surveys.

Example 5: Retrieve Call Transcription for Compliance

Scenario: After a recorded compliance call completes, retrieve the transcription and store it in the document management system.

{
  "credential_id": "twilio-main-account",
  "operation": "getTranscription",
  "recording_sid": "{{ vars.recording_sid }}"
}
Transcription generation takes 1–5 minutes after call completion. Use a Delay node followed by a retry loop (Loop + IfCondition checking status == "completed") before attempting retrieval. Store the transcription_text to a MongoDB document or S3 file for audit purposes.