question

Super Admin avatar image
Super Admin asked Super Admin answered

App stops after SMS API Call

I am having an interesting issue when sending an SMS message. I am currently using the C# SDK and testing through the sandbox.

I'm not sure if it's because of the size of the message or what. If I just have the "Hello from C#", it sends the message, but if I try to add my own message, it will call the SMS endpoint and then my program stops. Not in an error stop way, but it shuts off the debugger.

For the message, I have kept it under 160 characters, including the "watermark" text you all add to the front while sending in sandbox. I have the call in a try/catch and it's odd that if the call is erroring out, it would have been caught in the catch block.

Code Example:

 var parameters = new CreateSMSMessage
                {
                    from = new MessageStoreCallerInfoRequest { phoneNumber = fromNumber },
                    to = new MessageStoreCallerInfoRequest[] { new MessageStoreCallerInfoRequest { phoneNumber = phone} },
                    text = $"To see your results use access key - Access Key: {accessKey} - https://bit.ly/whatever"
                };
try
{
    //This is the call that after it executes, it will stop Visual Studio debugging
    //It shows as a success in analytics, but doesn't send a message
    var resp = await ringCentral.Restapi().Account().Extension().Sms().Post(parameters);
    var msgStatus = resp.messageStatus;
}
catch(Exception ex)
{
   //Handling the exception
}

UPDATE: It is also doing it when I use the "Hello from C#" as the text parameter. It's probably not a text message size issue, but nothing is throwing an error.

rest api
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Super Admin avatar image
Super Admin answered

I got it working. The request client was being passed into a method and apparently that is not allowed. Weird it wouldn't throw an error though.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered Phong Vu commented

I believe that your message failed because or the shortened link bit.ly. Try with a full domain link or test https://google.com/whatever.

4 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Super Admin avatar image Super Admin commented ·

It's still doing it without any link added to it. I put in "Hello from C#" in the text parameter and the same thing happened

0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ Super Admin commented ·

Then the problem is with the content from the accessKey. You should print out the message id and then read the message to see its status.

var endpoint = '/restapi/v1.0/account/~/extension/~/message-store/[messageId]'
0 Likes 0 ·
Super Admin avatar image Super Admin Phong Vu ♦♦ commented ·

I can't read the message status or the Id, because it fails at this line:

var resp = await ringCentral.Restapi().Account().Extension().Sms().Post(parameters);

It doesn't throw an exception. It just stops VS 2019 debugging. It doesn't even go to the next break point, nor does it hit the break point in the catch block.

How is it the problem with the accesskey when it won't even send when I put it like this:

var parameters = new CreateSMSMessage
                {
                    from = new MessageStoreCallerInfoRequest { phoneNumber = fromNumber },
                    to = new MessageStoreCallerInfoRequest[] { new MessageStoreCallerInfoRequest { phoneNumber = phone} },
                    text = "Hi"
                };
0 Likes 0 ·
Show more comments

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys