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.
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.
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
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]'
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" };
You said it worked when you sent "Hello from C#" and did not work with the access key and bit.ly link. And now you said it does not work with "Hi".
You code or environment got corrupted some how. This works fine for me. It just failed sending if the link is a bit.ly shortened link, but no crash or whatsoever.
var parameters = new CreateSMSMessage(); parameters.from = new MessageStoreCallerInfoRequest { phoneNumber = fromNumber }; parameters.to = new MessageStoreCallerInfoRequest[] { new MessageStoreCallerInfoRequest { phoneNumber = RECIPIENT } }; var access_key = "p-fc6844699aa82f6d4e1c23bb2-2"; parameters.text = $"To see your results use access key - Access Key: {access_key} - https://google.com/whatever"; var resp = await rcsdk.Restapi().Account().Extension().Sms().Post(parameters); Console.WriteLine("SMS sent. Message status: " + resp.messageStatus); Console.WriteLine("SMS sent. Message id: " + resp.id);
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