twilio / twilio-ruby

A Ruby gem for communicating with the Twilio API and generating TwiML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating a Flex Web Channel returns 404.

josh08h opened this issue · comments

Issue Summary

Creating a Flex Web Channel returns 404.

Steps to Reproduce

  1. Create a web_channel via the Ruby SDK
  2. See below code snippet

Code Snippet

client.flex_api.web_channel.create(
  flex_flow_sid: 'FOxxxxxxxxxxxxxx',
  identity: 'QgS4UHiBukm6TYrVjUf6uU',
  customer_friendly_name: 'Mrs Test User',
  chat_friendly_name: 'Flex WebChat'
)

Exception/Log

twilio-ruby-5.57.0/lib/twilio-ruby/framework/rest/version.rb:146:in `create': [HTTP 404] 20404 : Unable to create record (Twilio::REST::RestError)
The requested resource /WebChannels was not found
https://www.twilio.com/docs/errors/20404

Technical details:

  • twilio-ruby version: 5.57.0
  • ruby version: 2.7.4

Hi @josh08h!
It looks like you are missing the version in your code snippet. It should be client.flex_api.v1.web_channel.create with the v1 between flex_api and web_channel. It should look similar to the syntax used on this line of the integration test.

Ah yes! Thanks a lot @JenniferMah

No problem! Please feel free open a new issue if you run into another problem in the twilio-ruby library.

Hi @JenniferMah .. I have just tried your solution & am still seeing the following error:

::Twilio::REST::Client.new(ENV["TWILIO_ACCOUNT_SID"], ENV["TWILIO_AUTH_TOKEN"])
  .flex_api
  .v1
  .web_channel
  .create(
    flex_flow_sid: "FO8a6d3b526d9e97a3fdae2e38e50ef843",
    identity: "23423423423",
    chat_friendly_name: "Test Chat",
    customer_friendly_name: "Barry Tree"
  )

Twilio::REST::RestError: [HTTP 404] 20404 : Unable to create record
The requested resource /WebChannels was not found
https://www.twilio.com/docs/errors/20404


from /Users/joshhale/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/twilio-ruby-5.57.1/lib/twilio-ruby/framework/rest/version.rb:146:in `create'

Please could you confirm that my code snippet above looks correct?

@josh08h have you tried curl-ing the request and see if it goes through ok?

@shwetha-manvinkurke ah.. I see the same error with curl (httpie) too:

http -a AC1b0e45327716d4beccd48d02e473d99b:$(bpass next passwords/twilio/auth_token) --form POST https://flex-api.twilio.com/v1/WebChannels FlexFlowSid="FO8a6d3b526d9e97a3fdae2e38e50ef843" ChatFriendlyName="Flex Test" CustomerFriendlyName="Josh Test" Identity=$(openssl rand -hex 12)
HTTP/1.1 404 Not Found
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Accept, Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since
Access-Control-Allow-Methods: GET, POST, DELETE, OPTIONS
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag
Connection: keep-alive
Content-Length: 151
Content-Type: application/json
Date: Thu, 05 Aug 2021 09:05:30 GMT
Strict-Transport-Security: max-age=31536000
Twilio-Request-Duration: 0.033
Twilio-Request-Id: RQ012592277d1bf0977a300615f5e3fc61
X-API-Domain: flex-api.twilio.com
X-Home-Region: us1
X-Powered-By: AT-5000
X-Shenanigans: none

{
    "code": 20404,
    "message": "The requested resource /WebChannels was not found",
    "more_info": "https://www.twilio.com/docs/errors/20404",
    "status": 404
}

Should I raise this with Twilio support instead?

@josh08h This points to an error in your flex setup. I recommend you reach out to support or read our docs for more info.