News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
SMS IN SANDBOX NOT WORKING PYTHON
Tags: getting started
Jun 30, 2020 at 9:37am   •   5 replies  •  0 likes
Daniel Lopez

Good day, im starting to test a really simple SMS app, i tried to test the default python sms code, but no SMS gets sent neither internal o real numbres, i dont get any errors, simply nothing gets sent. heres the code im using


from ringcentral import SDK

RECIPIENT = '+15622916474'

RINGCENTRAL_CLIENTID = 'XXXXXXXXX'

RINGCENTRAL_CLIENTSECRET = 'XXXXXXXXXXX'

RINGCENTRAL_SERVER = 'https://platform.devtest.ringcentral.com'

RINGCENTRAL_USERNAME = '+12107291286'

RINGCENTRAL_PASSWORD = 'XXXXXX'

RINGCENTRAL_EXTENSION = '101'

rcsdk = SDK( RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_SERVER)

platform = rcsdk.platform()

platform.login(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD)

platform.post('/restapi/v1.0/account/~/extension/~/sms',

{

'from' : { 'phoneNumber': RINGCENTRAL_USERNAME },

'to' : [ {'phoneNumber': RECIPIENT} ],

'text' : 'Hello World from Python'

})

5 Answers
answered on Jun 30, 2020 at 12:10pm  

Can you print the response as shown below

resp = platform.post('/restapi/v1.0/account/~/extension/~/sms',
              {
                  'from' : { 'phoneNumber': RINGCENTRAL_USERNAME },
                  'to'   : [ {'phoneNumber': RECIPIENT} ],
                  'text' : 'Hello World from Python'
              })

print resp.text()

 0
answered on Jun 30, 2020 at 1:32pm  

it says failed, what can be causing that, tried doing it from the console and they don't get sent, but the callout feature works.

{
"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/280008004/extension/280008004/message-store/8373199004",
"id" : 8373199004,
"to" : [ {
"phoneNumber" : "+15622916474",
"location" : "Downey, CA"
} ],
"from" : {
"phoneNumber" : "+12107291286",
"name" : "Telemarketing ."
},
"type" : "SMS",
"creationTime" : "2020-06-30T19:59:09.000Z",
"readStatus" : "Read",
"priority" : "Normal",
"attachments" : [ {
"id" : 8373199004,
"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/280008004/extension/280008004/message-store/8373199004/content/8373199004",
"type" : "Text",
"contentType" : "text/plain"
} ],
"direction" : "Outbound",
"availability" : "Alive",
"subject" : "Test SMS using a RingCentral Developer account - Hello World from Python",
"messageStatus" : "SendingFailed",
"smsSendingAttemptsCount" : 1,
"conversationId" : 4763525408982918811,
"conversation" : {
"id" : "4763525408982918811",
"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/conversation/4763525408982918811"
},
"lastModifiedTime" : "2020-06-30T19:59:10.355Z"
}



 0
answered on Jun 30, 2020 at 1:00pm  

Thanks heres the response

{
"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/280008004/extension/280008004/message-store/8373199004",
"id" : 8373199004,
"to" : [ {
"phoneNumber" : "+15622916474",
"location" : "Downey, CA"
} ],
"from" : {
"phoneNumber" : "+12107291286",
"name" : "Telemarketing ."
},
"type" : "SMS",
"creationTime" : "2020-06-30T19:59:09.000Z",
"readStatus" : "Read",
"priority" : "Normal",
"attachments" : [ {
"id" : 8373199004,
"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/280008004/extension/280008004/message-store/8373199004/content/8373199004",
"type" : "Text",
"contentType" : "text/plain"
} ],
"direction" : "Outbound",
"availability" : "Alive",
"subject" : "Test SMS using a RingCentral Developer account - Hello World from Python",
"messageStatus" : "Queued",
"smsSendingAttemptsCount" : 1,
"conversationId" : 4763525408982918811,
"conversation" : {
"id" : "4763525408982918811",
"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/conversation/4763525408982918811"
},
"lastModifiedTime" : "2020-06-30T19:59:09.628Z"
}



 0
answered on Jun 30, 2020 at 2:18pm  

the '+12107291286' , is the number they assigned us in the sandbox account, the other one is one of our regular RC numbers


tried using my mobile number and got the same.


{

"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/280008004/extension/280008004/message-store/8373371004",

"id" : 8373371004,

"to" : [ {

"phoneNumber" : "+1562572XXXX"

} ],

"from" : {

"phoneNumber" : "+12107291286",

"name" : "Telemarketing ."

},

"type" : "SMS",

"creationTime" : "2020-06-30T21:14:08.000Z",

"readStatus" : "Read",

"priority" : "Normal",

"attachments" : [ {

"id" : 8373371004,

"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/280008004/extension/280008004/message-store/8373371004/content/8373371004",

"type" : "Text",

"contentType" : "text/plain"

} ],

"direction" : "Outbound",

"availability" : "Alive",

"subject" : "Test SMS using a RingCentral Developer account - tester",

"messageStatus" : "SendingFailed",

"smsSendingAttemptsCount" : 1,

"conversationId" : 4763525412780169249,

"conversation" : {

"id" : "4763525412780169249",

"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/conversation/4763525412780169249"

},

"lastModifiedTime" : "2020-06-30T21:14:08.872Z"

}


 0
answered on Jun 30, 2020 at 1:56pm  


This is what i got

{
"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/280008004/extension/280008004/phone-number?page=1&perPage=100",
"records" : [ {
"features" : [ "CallerId", "SmsSender", "MmsSender" ],
"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/280008004/phone-number/343601004",
"id" : 343601004,
"phoneNumber" : "+12107291286",
"paymentType" : "Local",
"type" : "VoiceFax",
"usageType" : "MainCompanyNumber",
"status" : "Normal",
"country" : {
"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/country/1",
"id" : "1",
"name" : "United States"
}
} ],
"paging" : {
"page" : 1,
"totalPages" : 1,
"perPage" : 100,
"totalElements" : 1,
"pageStart" : 0,
"pageEnd" : 0
},
"navigation" : {
"firstPage" : {
"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/280008004/extension/280008004/phone-number?page=1&perPage=100"
},
"lastPage" : {
"uri" : "https://platform.devtest.ringcentral.com/restapi/v1.0/account/280008004/extension/280008004/phone-number?page=1&perPage=100"
}
}
}



 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us