resttwilioconference

Create Twilio Conference With Rest API


I'm looking to create a Twilio Conference through the rest API. And I'm not sure how to start the conference. I'd prefer to do this without the SDK.

Heres the flow that I'm looking for.

I have used rest for outbound calls but I can't figure out how to set up a conference.

For outbound calls I use the rest endpoint https://api.twilio.com/version/Accounts/account/Calls.JSON What would the endpoint be for creating a conference and adding the client?

I found https://api.twilio.com/version/Accounts/account/confrences.JSON but it seems to be geared toward get requests for pulling data about conferences not creating an outbound conference.


Solution

  • Twilio developer evangelist here.

    If you're saying that you'd like to make Twilio calls from the browser without the Twilio Client JS SDK, then I can't help you there. We don't publish the API and it's not recommended you try to write your own library.

    You can achieve the flow you want here. You can use the REST API to generate a call to your client:

    use Twilio\Rest\Client;
    
    // Your Account Sid and Auth Token from twilio.com/user/account
    $sid = "your_account_sid";
    $token = "your_auth_token";
    $client = new Client($sid, $token);
    
    $call = $client->calls->create(
        "client:CLIENT_IDENTITY", "YOUR TWILIO NUMBER",
        array("url" => "YOUR APPLICATION URL")
    );
    

    Note, you need to use client:CLIENT_IDENTITY as the to number.

    The URL you pass to this call should point to an endpoint on your server that will return the TwiML to start the conference:

    <Response>
      <Dial><Conference>Conference room name</Conference></Dial>
    <Response>
    

    During this request that you return the conference TwiML, you can also kick off a new request to start a call to the phone number you want to dial, again using the REST API.

    Does this all make sense?