<% value = @encrypted_config.value || {} %>
<% sms_enabled = Sms.enabled?(current_account) %>
<% sms_live = Sms.enabled_for?(current_account) %>
<%
provider_labels = {
'bulkvs' => 'BulkVS',
'twilio' => 'Twilio',
'voipms' => 'VoIP.ms',
'signalwire' => 'SignalWire'
}
sending_number = case value['provider'].to_s
when 'twilio' then value['twilio_from']
when 'voipms' then value['voipms_did']
when 'signalwire' then value['signalwire_from']
else value['from_number']
end
selected_provider = value['provider'].presence || 'bulkvs'
%>
<% if sms_live %>
<% end %>
<%= form_for @encrypted_config, url: settings_sms_path, method: :post,
html: { autocomplete: 'off', class: 'space-y-4', id: 'sms_settings_form' },
data: { turbo_frame: :_top } do |f| %>
<%= f.fields_for :value do |ff| %>
<%= ff.label :provider, 'Provider', class: 'label' %>
<%= ff.select :provider,
Sms::SUPPORTED_PROVIDERS.map { |p| [provider_labels[p] || p, p] },
{ selected: selected_provider },
class: 'base-select',
id: 'sms_provider_select' %>
<%= ff.label :basic_auth_token, 'BulkVS Basic Auth Token', class: 'label' %>
<%= ff.password_field :basic_auth_token, value: '', class: 'base-input', placeholder: value['basic_auth_token'].present? ? '*************' : 'Paste from BulkVS portal' %>
<% if value['basic_auth_token'].present? %>
Leave blank to keep the saved token.
<% else %>
In the BulkVS portal, open the API tab and copy the pre-encoded Basic Auth header value (do not include "Basic ").
<% end %>
<%= ff.label :from_number, 'From Number', class: 'label' %>
<%= ff.text_field :from_number, value: value['from_number'], class: 'base-input', placeholder: '15551234567' %>
E.164 format (digits only, country code first; e.g. 15551234567).
<%= ff.label :delivery_webhook_url, 'Delivery Status Webhook (optional)', class: 'label' %>
<%= ff.url_field :delivery_webhook_url, value: value['delivery_webhook_url'], class: 'base-input', placeholder: 'https://your-app.example/webhooks/sms' %>
If set, BulkVS will POST delivery-status events here for each message.
<%= ff.label :twilio_account_sid, 'Twilio Account SID', class: 'label' %>
<%= ff.text_field :twilio_account_sid, value: value['twilio_account_sid'], class: 'base-input', placeholder: 'AC...' %>
From your Twilio Console "Account Info" panel.
<%= ff.label :twilio_auth_token, 'Twilio Auth Token', class: 'label' %>
<%= ff.password_field :twilio_auth_token, value: '', class: 'base-input', placeholder: value['twilio_auth_token'].present? ? '*************' : 'Click "show" in the Console to reveal' %>
<% if value['twilio_auth_token'].present? %>
Leave blank to keep the saved token.
<% else %>
Found next to the Account SID in the Twilio Console.
<% end %>
<%= ff.label :twilio_from, 'From Number', class: 'label' %>
<%= ff.text_field :twilio_from, value: value['twilio_from'], class: 'base-input', placeholder: '+15551234567' %>
Twilio number purchased in Phone Numbers → Manage. Use full E.164 with leading +.
<%= ff.label :voipms_api_username, 'API Username', class: 'label' %>
<%= ff.text_field :voipms_api_username, value: value['voipms_api_username'], class: 'base-input', placeholder: 'your-account@example.com' %>
Your VoIP.ms portal login email.
<%= ff.label :voipms_did, 'DID (Sending Number)', class: 'label' %>
<%= ff.text_field :voipms_did, value: value['voipms_did'], class: 'base-input', placeholder: '5551234567' %>
An SMS-enabled DID from Manage DIDs. Digits only, no +. The DID must have the SMS feature enabled.
<%= ff.label :signalwire_space_url, 'Space URL', class: 'label' %>
<%= ff.text_field :signalwire_space_url, value: value['signalwire_space_url'], class: 'base-input', placeholder: 'yourname.signalwire.com' %>
From Dashboard → API. Omit https://.
<%= ff.label :signalwire_project_id, 'Project ID', class: 'label' %>
<%= ff.text_field :signalwire_project_id, value: value['signalwire_project_id'], class: 'base-input', placeholder: '00000000-0000-0000-0000-000000000000' %>
The UUID labelled "Your Project ID" on the API tab.
<%= ff.label :signalwire_api_token, 'API Token', class: 'label' %>
<%= ff.password_field :signalwire_api_token, value: '', class: 'base-input', placeholder: value['signalwire_api_token'].present? ? '*************' : 'PT...' %>
<% if value['signalwire_api_token'].present? %>
Leave blank to keep the saved token.
<% else %>
Generate on the API tab. The token must have the Messaging scope enabled or sends return 401.
<% end %>
<%= ff.label :signalwire_from, 'From Number', class: 'label' %>
<%= ff.text_field :signalwire_from, value: value['signalwire_from'], class: 'base-input', placeholder: '+15551234567' %>
A SignalWire number from Phone Numbers. Full E.164 with leading +.
<%= f.button button_title(title: t('save'), disabled_with: t('saving')), class: 'base-button' %>