# Twilio schema ERD

Table and field reference for the Fivetran Twilio connector.

## Table & Field Reference

### role_permission

| Column | Type | Keys |
| --- | --- | --- |
| permission | String | PK |
| role_id | String | PK, FK |

### outgoing_caller_id

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| created_at | Instant |  |
| friendly_name | String |  |
| phone_number | String |  |
| updated_at | Instant |  |

### messaging_service

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| area_code_geomatch | Boolean |  |
| created_at | Instant |  |
| fallback_method | String |  |
| fallback_to_long_code | Boolean |  |
| fallback_url | String |  |
| friendly_name | String |  |
| inbound_method | String |  |
| inbound_request_url | String |  |
| mms_converter | Boolean |  |
| scan_message_content | String |  |
| smart_encoding | Boolean |  |
| status_callback | String |  |
| sticky_sender | Boolean |  |
| synchronous_validation | Boolean |  |
| updated_at | Instant |  |
| us_app_to_person_registered | Boolean |  |
| use_inbound_webhook_on_number | Boolean |  |
| usecase | String |  |
| validity_period | Int |  |

### flow_history

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| updated_at | Instant | PK |
| account_id | String | FK |
| created_at | Instant |  |
| friendly_name | String |  |
| status | String |  |
| version | Long |  |

### account_history

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| updated_at | Instant | PK |
| owner_account_id | String | FK |
| created_at | Instant |  |
| friendly_name | String |  |
| status | String |  |
| type | String |  |

### conversation_message_media

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| message_id | String | PK, FK |
| content_type | String |  |
| filename | String |  |
| size | Long |  |

### participant

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| chat_service_id | String | FK |
| conversation_id | String | FK |
| role_id | String | FK |
| attributes | String |  |
| created_at | Instant |  |
| last_read_message_index | Int |  |
| last_read_timestamp | Instant |  |
| participant_identity | String |  |
| updated_at | Instant |  |

### recording

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| call_id | String | FK |
| conference_id | String | FK |
| api_version | String |  |
| channels | Int |  |
| created_at | Instant |  |
| duration | String |  |
| error_code | Int |  |
| price | String |  |
| price_unit | String |  |
| source | String |  |
| start_time | Instant |  |
| status | String |  |
| updated_at | Instant |  |

### trunk

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| auth_type | String |  |
| auth_type_set | Json |  |
| cnam_lookup_enabled | Boolean |  |
| created_at | Instant |  |
| domain_name | String |  |
| friendly_name | String |  |
| recording | Json |  |
| secure | Boolean |  |
| updated_at | Instant |  |

### verification_attempt

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| service_id | String | FK |
| channel | String |  |
| conversion_status | String |  |
| created_at | Instant |  |
| price_currency | String |  |
| price_value | BigDecimal |  |
| updated_at | Instant |  |
| verification_id | String |  |
| channel_** |  |  |

### execution

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| flow_id | String | FK |
| contact_channel_address | String |  |
| context | Json |  |
| created_at | Instant |  |
| status | String |  |
| updated_at | Instant |  |

### execution_step

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| execution_id | String | FK |
| context | Json |  |
| created_at | Instant |  |
| name | String |  |
| transitioned_from | String |  |
| transitioned_to | String |  |
| updated_at | Instant |  |

### service

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| created_at | Instant |  |
| friendly_name | String |  |
| updated_at | Instant |  |

### usage_record

| Column | Type | Keys |
| --- | --- | --- |
| category | String | PK |
| end_date | LocalDate | PK |
| start_date | LocalDate | PK |
| account_id | String | PK, FK |
| as_of | Instant |  |
| count | String |  |
| count_unit | String |  |
| description | String |  |
| price | String |  |
| price_unit | String |  |
| usage | String |  |
| usage_unit | String |  |

### message

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| messaging_service_sid | String | FK |
| body | String |  |
| created_at | Instant |  |
| date_sent | Instant |  |
| direction | String |  |
| error_code | String |  |
| error_message | String |  |
| from | String |  |
| num_media | String |  |
| num_segments | String |  |
| price | String |  |
| price_unit | String |  |
| status | String |  |
| to | String |  |
| updated_at | Instant |  |

### conference_participant_extended

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| call_id | String | FK |
| conference_id | String | FK |
| call_type | String |  |
| end_conference_on_exit | Boolean |  |
| is_coach | Boolean |  |
| is_moderator | Boolean |  |
| label | String |  |
| participant_region | String |  |
| start_conference_on_enter | Boolean |  |

### incoming_phone_number

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| address_id | String | FK |
| emergency_address_id | String | FK |
| trunk_id | String | FK |
| address_requirements | String |  |
| beta | Boolean |  |
| capabilities_mms | Boolean |  |
| capabilities_sms | Boolean |  |
| capabilities_voice | Boolean |  |
| created_at | Instant |  |
| emergency_status | String |  |
| friendly_name | String |  |
| origin | String |  |
| phone_number | String |  |
| updated_at | Instant |  |
| voice_caller_id_lookup | Boolean |  |
| voice_url | String |  |

### conversation_user

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| chat_service_id | String | FK |
| role_id | String | FK |
| attributes | String |  |
| created_at | Instant |  |
| friendly_name | String |  |
| is_notifiable | Boolean |  |
| is_online | Boolean |  |
| updated_at | Instant |  |
| url | String |  |
| user_identity | String |  |

### role

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| chat_service_id | String | FK |
| created_at | Instant |  |
| friendly_name | String |  |
| type | String |  |
| updated_at | Instant |  |

### coached_call

| Column | Type | Keys |
| --- | --- | --- |
| call_id | String | PK, FK |
| coach_id | String | PK, FK |

### call

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| outgoing_caller_id | String | FK |
| parent_call_id | String | FK |
| trunk_id | String | FK |
| annotation | String |  |
| answered_by | String |  |
| caller_name | String |  |
| created_at | Instant |  |
| direction | String |  |
| duration | String |  |
| end_time | Instant |  |
| forwarded_from | String |  |
| from | String |  |
| from_formatted | String |  |
| group_id | String |  |
| price | String |  |
| price_unit | String |  |
| queue_time | String |  |
| start_time | Instant |  |
| status | String |  |
| to | String |  |
| to_formatted | String |  |
| updated_at | Instant |  |

### receipt

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| conversation_id | String | FK |
| message_id | String | FK |
| participant_id | String | FK |
| service_id | String | FK |
| channel_message_id | String |  |
| created_at | Instant |  |
| error_code | Int |  |
| status | String |  |
| updated_at | Instant |  |

### conference_participant

| Column | Type | Keys |
| --- | --- | --- |
| call_id | String | PK, FK |
| conference_id | String | PK, FK |
| call_id_to_coach | String | FK |
| coaching | Boolean |  |
| created_at | Instant |  |
| end_conference_on_exit | Boolean |  |
| hold | Boolean |  |
| muted | Boolean |  |
| start_conference_on_enter | Boolean |  |
| status | String |  |
| updated_at | Instant |  |

### verification_service

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| code_length | Int |  |
| created_at | Instant |  |
| custom_code_enabled | Boolean |  |
| default_template_sid | String |  |
| do_not_share_warning_enabled | Boolean |  |
| dtmf_input_required | Boolean |  |
| friendly_name | String |  |
| lookup_enabled | Boolean |  |
| mailer_sid | String |  |
| psd_2_enabled | Boolean |  |
| push_apn_credential_sid | String |  |
| push_fcm_credential_sid | String |  |
| push_include_date | Boolean |  |
| skip_sms_to_landlines | Boolean |  |
| tts_name | String |  |
| updated_at | Instant |  |
| verify_event_subscription_enabled | Boolean |  |
| totp_** |  |  |

### conference

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| created_at | Instant |  |
| friendly_name | String |  |
| region | String |  |
| status | String |  |
| updated_at | Instant |  |

### address

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| city | String |  |
| created_at | Instant |  |
| customer_name | String |  |
| emergency_enabled | Boolean |  |
| friendly_name | String |  |
| iso_country | String |  |
| postal_code | String |  |
| region | String |  |
| street | String |  |
| updated_at | Instant |  |
| validated | Boolean |  |
| verified | Boolean |  |

### conversation

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| chat_service_id | String | FK |
| attributes | String |  |
| created_at | Instant |  |
| friendly_name | String |  |
| messaging_service_id | String |  |
| state | String |  |
| timer_date_closed | Instant |  |
| timer_date_inactive | Instant |  |
| unique_name | String |  |
| updated_at | Instant |  |
| url | String |  |

### conversation_message

| Column | Type | Keys |
| --- | --- | --- |
| id | String | PK |
| account_id | String | FK |
| conversation_id | String | FK |
| participant_id | String | FK |
| service_id | String | FK |
| attributes | String |  |
| author | String |  |
| body | String |  |
| created_at | Instant |  |
| delivery_delivered | String |  |
| delivery_failed | String |  |
| delivery_read | String |  |
| delivery_sent | String |  |
| delivery_total | Int |  |
| delivery_undelivered | String |  |
| index | String |  |
| updated_at | Instant |  |
| url | String |  |

## Relationships

- role_permission(role_id) → role(id)
- messaging_service(account_id) → account_history(id)
- flow_history(account_id) → account_history(id)
- account_history(owner_account_id) → account_history(id)
- conversation_message_media(message_id) → conversation_message(id)
- participant(account_id) → account_history(id)
- participant(chat_service_id) → service(id)
- participant(conversation_id) → conversation(id)
- participant(role_id) → role(id)
- recording(call_id) → call(id)
- recording(conference_id) → conference(id)
- trunk(account_id) → account_history(id)
- verification_attempt(account_id) → account_history(id)
- verification_attempt(service_id) → verification_service(id)
- execution(flow_id) → flow_history(id)
- execution_step(execution_id) → execution(id)
- service(account_id) → account_history(id)
- usage_record(account_id) → account_history(id)
- message(messaging_service_sid) → messaging_service(id)
- message(account_id) → account_history(id)
- conference_participant_extended(call_id) → call(id)
- conference_participant_extended(conference_id) → conference(id)
- incoming_phone_number(account_id) → account_history(id)
- incoming_phone_number(address_id) → address(id)
- incoming_phone_number(emergency_address_id) → address(id)
- incoming_phone_number(trunk_id) → trunk(id)
- conversation_user(account_id) → account_history(id)
- conversation_user(chat_service_id) → service(id)
- conversation_user(role_id) → role(id)
- role(account_id) → account_history(id)
- role(chat_service_id) → service(id)
- coached_call(call_id) → call(id)
- coached_call(coach_id) → conference_participant_extended(id)
- call(account_id) → account_history(id)
- call(parent_call_id) → call(id)
- call(outgoing_caller_id) → outgoing_caller_id(id)
- call(trunk_id) → trunk(id)
- receipt(account_id) → account_history(id)
- receipt(service_id) → service(id)
- receipt(conversation_id) → conversation(id)
- receipt(message_id) → conversation_message(id)
- receipt(participant_id) → participant(id)
- conference_participant(call_id) → call(id)
- conference_participant(call_id_to_coach) → conference_participant(call_id)
- conference_participant(conference_id) → conference(id)
- verification_service(account_id) → account_history(id)
- address(account_id) → account_history(id)
- conversation(account_id) → account_history(id)
- conversation(chat_service_id) → service(id)
- conversation_message(account_id) → account_history(id)
- conversation_message(service_id) → service(id)
- conversation_message(conversation_id) → conversation(id)
- conversation_message(participant_id) → participant(id)
