In my app's controller once a record is created I want to automatically open the client's whatsapp, sms or email app (depending of the type of the new record).
My create action looks like this:
def create
session[:return_to] ||= request.referer
@token = SecureRandom.uuid
@new_token = Token.new(:token_value => @token, :sender_id => current_user.id, :card_id => params[:card_id], :type => params[:type])
respond_to do |format|
format.html { redirect_to session.delete(:return_to), notice: "Token " + @new_token.token_value + " was successfully created." }
end
if @new_token.type == "sms"
#open client's sms app and autofill sms body with @new_token.token_value
elsif @new_token.type == "email"
#open client's email app and autofill subject + body with @new_token.token_value
elsif @new_token.type == "whatsapp"
#open client's whatsapp and autofill body with @new_token.token_value
end
end
How can I achieve that?