Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8722421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:24:55+00:00 2026-06-13T07:24:55+00:00

I am trying to integrate my Rails app with a 3rd party API (Twilio).

  • 0

I am trying to integrate my Rails app with a 3rd party API (Twilio). The user initiates a call by pressing a button on their browser, they follow the call logic on the telephone, and then when the call terminates, I want the browser to be redirected to a different page.
However, I am having difficulty dealing with responses for the two different user agents (the browser and the Twilio API).

The call is initiated using the following controller action (and as the request comes from the browser, the render action works without a problem):

def set_up
@client = Twilio::REST::Client.new ACCOUNT_SID, AUTH_TOKEN
data = {
  from:   FROM,
  to:   params[:number],
  url:  candidate_begin_url(@candidate),
  method: 'get',
  timeout: 10
}
@client.account.calls.create data
render 'candidates/interview_in_progress'
end

At the end of the call, once the user is ready to terminate, the Twilio API makes a GET request to the following controller. The intention is for two things to happen:

  1. The controller should respond to the Twilio API with XML instructions to
    hang up the call
  2. The controller should redirect the user’s browser to a
    new url

    def finalize_call      
     response = Twilio::TwiML::Response.new do |r|
      r.Hangup
     end.text
     respond_to do |format|
      format.html { redirect_to candidate_complete_voice_interview_path(@candidate) }
      format.xml {  render xml: response }
     end
    end
    

However it seems that because the request comes from the Twilio API user agent, I am unable to perform any actions with the browser. So while in the log I see the new page has been rendered with status 200 OK, there is no change in the browser.

My question is, how can I instruct the browser to redirect following a request from a different user agent, in this case the API?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:24:57+00:00Added an answer on June 13, 2026 at 7:24 am

    When a user visits your site, your site creates a session for that user. When Twilio sends a request directly to your site, a separate session is created. These two sessions are completely independent. So when Twilio sends a GET request to your server, your server responds by rendering the requested page and sending it back to Twilio.

    Your server cannot send push updates, it has to receive a request and send a response. So any website you see that appears to auto update is generally doing some sort of javascript polling, where the browser sends a periodic request (ajax) to the server to check if there are any changes.

    Before diving down that path though, I would ask if you can’t just have some sort of notice on your site that says “When you finish your call, please click here”. Otherwise you will have to store the response from Twilio in the db (or somewhere), and then have the user’s browser send an ajax request ever x seconds to see if a response has arrived.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to integrate a simple Rails app with a BPEL process but it's
I'm trying to integrate backbone.js as the frontend framework for my rails app. I
I am trying to integrate refinerycms with my existing rails app and i want
I'm trying to integrate a designer's html and css files into a rails app.
Hi I'm trying to integrate MySpace with my Android app. As I'm new to
Hi I'm trying to integrate an LDAP search functionality into my app similar to
I'm newbie to ember.js. I'm trying to integrate ember.js with Rails using ember-rails gem.
I'm trying to integrate the solution listed here into my rails (3.1) application. I
I am trying to integrate spree into a fresh install of a rails application.
So I am somewhat new to Rails 3, and I am trying to integrate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.