SMS Logs

View and filter all SMS messages across your gateways.

Filters

<%= form_with url: admin_logs_path, method: :get, local: true do |f| %>
<%= label_tag :direction, "Direction", class: "block text-sm font-medium text-gray-700 mb-1" %> <%= select_tag :direction, options_for_select([["All Directions", ""], ["Inbound", "inbound"], ["Outbound", "outbound"]], params[:direction]), class: "block w-full rounded-lg border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" %>
<%= label_tag :status, "Status", class: "block text-sm font-medium text-gray-700 mb-1" %> <%= select_tag :status, options_for_select([["All Statuses", ""], ["Pending", "pending"], ["Queued", "queued"], ["Sent", "sent"], ["Delivered", "delivered"], ["Failed", "failed"]], params[:status]), class: "block w-full rounded-lg border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" %>
<%= label_tag :phone_number, "Phone Number", class: "block text-sm font-medium text-gray-700 mb-1" %>
<%= text_field_tag :phone_number, params[:phone_number], class: "block w-full pl-10 rounded-lg border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm", placeholder: "Search phone..." %>
<%= label_tag :gateway_id, "Gateway", class: "block text-sm font-medium text-gray-700 mb-1" %> <%= select_tag :gateway_id, options_for_select([["All Gateways", ""]] + Gateway.order(:name).pluck(:name, :id), params[:gateway_id]), class: "block w-full rounded-lg border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" %>
<%= label_tag :start_date, "Start Date", class: "block text-sm font-medium text-gray-700 mb-1" %>
<%= date_field_tag :start_date, params[:start_date], class: "block w-full pl-10 rounded-lg border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" %>
<%= label_tag :end_date, "End Date", class: "block text-sm font-medium text-gray-700 mb-1" %>
<%= date_field_tag :end_date, params[:end_date], class: "block w-full pl-10 rounded-lg border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" %>
<%= submit_tag "Apply Filters", class: "inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-500 transition-all duration-200" do %> Apply Filters <% end %> <%= link_to admin_logs_path, class: "inline-flex items-center gap-2 rounded-lg bg-gray-100 px-4 py-2 text-sm font-semibold text-gray-700 hover:bg-gray-200 transition-all duration-200" do %> Clear Filters <% end %>
<% end %>
<% if @messages.any? %>

Showing <%= @messages.size %> of <%= @pagy.count %> messages

<% @messages.each do |msg| %> <% if msg.error_message.present? %> <% end %> <% end %>
Message ID Phone Number Message Direction Status Gateway Retries Created Processed
<%= msg.message_id[0..15] %>... <%= msg.phone_number %>
<%= msg.message_body %>
<% if msg.direction == "outbound" %> Outbound <% else %> Inbound <% end %> <% case msg.status %> <% when "delivered" %> Delivered <% when "sent" %> Sent <% when "failed" %> Failed <% when "pending" %> Pending <% when "queued" %> Queued <% else %> <%= msg.status.titleize %> <% end %> <%= msg.gateway&.name || "-" %> <% if msg.retry_count > 0 %> <%= msg.retry_count %> <% else %> - <% end %> <%= msg.created_at.strftime("%m/%d/%y %H:%M") %> <% if msg.delivered_at %> <%= msg.delivered_at.strftime("%m/%d/%y %H:%M") %> <% elsif msg.sent_at %> <%= msg.sent_at.strftime("%m/%d/%y %H:%M") %> <% elsif msg.failed_at %> <%= msg.failed_at.strftime("%m/%d/%y %H:%M") %> <% else %> - <% end %>
<% if @pagy.pages > 1 %>
Showing <%= @pagy.from %> to <%= @pagy.to %> of <%= @pagy.count %> results
<%= form_with url: admin_logs_path, method: :get, local: true, class: "inline-flex items-center gap-2" do |f| %> <%= select_tag :items, options_for_select([10, 25, 50, 100], params[:items] || 50), onchange: "this.form.submit()", class: "rounded-md border-gray-300 text-sm focus:border-blue-500 focus:ring-blue-500" %> <% params.except(:items, :authenticity_token).each do |key, value| %> <%= hidden_field_tag key, value %> <% end %> <% end %>
<% end %> <% else %>

No messages found

Try adjusting your filters to see more results.

<% end %>