Receiving SMS in C# with RingCentral - c#

I am able to send SMS using C#. But my problem is I don't know to receive those SMS.
I looked into following documentation with WebHook and C# here:
https://developers.ringcentral.com/guide/notifications/quick-start/webhook/c-sharp
But not sure how to do it exactly.
Can I get any help to know how I can receive the SMS. Any sample will be great.

There are 3 ways to receive SMS:
PubNub Subscription
WebHook Subscription
API Request
Here are some details:
Using PubNub, you can receive SMS.
Check it out here: https://github.com/ringcentral/ringcentral-csharp-client/blob/master/RingCentral.Test/SubscripotionTest.cs#L31
Since this is used by PubNub, so you don't need ngrok
If you want WebHook, you need to subscribe for push notification check the reference demo: https://github.com/ringcentral/ringcentral-csharp-client/blob/master/RingCentral.Test/WebHookTest.cs
The direct API of RingCentral APIs to receive SMS content in your C#, by calling this API inside your SDK is: /restapi/v1.0/account/~/extension/~/message-store/{messageId}/content/{attachmentId}. Here you need to put the message id and the attachment id to retrieve message content from message-store
Hope this help.

Related

Where should I configure webhook url to get the latest user send message from bot added telegram group

I have read some documents to understand the webhook configuration for getting the latest user send messages from bot added telegram group the documents and the links are this , this, this , telegram api doc and telegram bot doc
I understand the concept but I'm getting the confusion on configuration of webhook url to get the latest messages and where should I configure this webhook url.
Note :- Should configure this webhook url in our server(www.example.com)?
Example webhook url is :
https://api.telegram.org/bot{my_bot_token}/setWebhook?url={url_to_send_updates_to}
Suggest me how to work with telegram webhook. And get the latest user send messages.
You need to set Webhook on your own static web address, for instance:
https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/setWebhook?url=https://www.example.com
There should be POST-handler on this route, that way Telegram's updates can be received.
You must set your webhook manually.
You've got a bot_token and you know which url will receive the POST updates webhook_url
You run this link in your browser with your configuration:
https://api.telegram.org/bot{bot_token}/setWebhook?url={webhook_url}
After that any update will be send to your webhook url as a JSON
If you got an error 429: Too Many Requests, you must handle this in your code.
It comes because you are sending to many requests to the Bot API, and every bot has a limit 30 request/second.
So try to minimize requests as much as possible in your code and do some Thead.Wait() if needed

Azure Notifications hub format tags payload REST API

I have an ordinary C# MVC website that is connected to a database were I'm storing my phone apps Push IDs.
I take these push IDs and want to send a push to it.
I can do this manually with the send test push function on Microsoft Azure website by inserting the value into the tag field there.
But now I want to do it with the REST API from my website.
I followed this for the .NET example
https://github.com/Azure/azure-notificationhubs-samples
The payload for Android looks like this:
{\"data\":{\"message\":\"" + message + "\"}}
I tried adding the tags to the payload by doing this:
{\"data\":{\"message\":\"" + message + "\"}, \"tags\":{\"DeviceToken\":\"the push ID here\"}}
But it didn't work. The push got sent to everyone.
How do you use or format the tags in the REST API?
Solution:
headers.Add("ServiceBusNotification-Tags", recipient);
recipient in my case is the installationID
According to your description, I checked the REST API Send a GCM Native Notification and followed azure-notificationhubs-samples to test this issue. In order to add tags to your payload, you could specify ServiceBusNotification-Tags header. I sent a GCM native notification to a set of tags (game, news), you could refer to it:
Additionally, you could leverage Microsoft.Azure.NotificationHubs for sending push notifications. For more details, you could refer to this official document.

Twilio with c# asp.net webapi

I am implementing simple Twilio service for sending sms using c#.
I want to receive the status of the message sent to any number, so I created Asp.Net WebAPI HTTP post method (status call back) and exposed to Twilio like below. But every time I send message, this http post method is not receiving any and my Twilio trial account logging the below message
You are receiving this email because your Twilio account has
encountered an error or warning and the On 1st error every day Alert
Trigger has fired. The most recent alert was:
"11200 - HTTP retrieval failure"
The URL I used for the status call back is public domain and https.
Am I doing something wrong here ? Please help me.
Code
var message = twilio.SendMessage(
"+14439173365",
"+1xxxxxxxx",
"Sample Twilio message",
"https://www2.xxxx.com/webservices/Reminder/V1/WebAPI/Reminder/TwilioAPI/MessageStatusCallBack");
Megan from Twilio here.
Can you check the full list of possible causes and solutions for your error here?
You can also see a non-trivial example of using the StatusCallback in this tutorial found here using C#:
https://www.twilio.com/docs/tutorials/walkthrough/eta-notifications/csharp/mvc#4
It can sometimes help to get these examples working and then make changes according to your application.
Hope this helps.

Twilio SMS sandbox using C#

How do you use the Twilio sandbox mode with C#? I have a ashx.cs file that I am using to write my code. Would I put it there? If so, what does that look like?
There is no real great examples on their website on how to do this except for CURL and Ruby.
We are using TwiML to general an XML file tha t parses our data to send back and forth to the Twilio service. We don't want to be charged every time we send a test text message.
How would we set the Sandbox up so we could do some testing.
I found the Test auth Token and account Sid, but how do I use those?
We don't have them in our current application and we are specifying our .ashx page in Twilio to process our code.
Thanks in advance.
Twilio evangelist here.
So if you just want to test that your ASHX handler is generating the right results the easiest way to do this is to just fake a POST or a GET request to that handler. This lets you simulate the GET or POST request that Twilio will make to your app when it gets a text message.
You can see the parameters that Twilio will pass to your app when it receives a text message here:
http://www.twilio.com/docs/api/twiml/sms/twilio_request#synchronous
There are a whole bunch of ways to simulate these requests. cURL is one of them. If your ASHX is expecting query string values, you can also just load the ASHX directly in the browser and append those values in the URL. If the handler is expecting a POST request, I used a chrome plugin called Simple REST Client to make these.
Of course you can also Fiddler to make just about any HTTP request.
The Test Credentials really are more for simulating the use of the REST API (programatically sending SMS messages). I just wrote a blog post that shows how to use the test credentials to create integration tests:
http://www.twilio.com/blog/2013/05/automating-twilio-integration-tests-with-test-credentials.html
Hope that helps.
Devin

How to send MMS with C#

I need to send MMS thought a C# application. I have already found 2 interesting components:
http://www.winwap.com
http://www.nowsms.com
Does anyone have experience with other third party components?
Could someone explain what kind of server I need to send those MMS? Is it a classic SMTP Server?
Typically I have always done this using a 3rd party aggregator. The messages are compiled into SMIL, which is the description language for the MMS messages. These are then sent on to the aggregator who will then send them through the MMS gateway of the Network Operator. They are typically charged on a per message basis and the aggregators will buy the messages in a block from the operators.
If you are trying to send an MMS message without getting charged then I am not sure how to do this, or if it is possible.
You could do it yourself. Some MMS companies just have a SOAP API that you can call. All you need to do is construct the XML and send it off via a URL. I have done this once before, but can't remember the name of the company I used.
This post earlier discussed different approaches for SMS and might be helpful for you.
You could use Twilio to accomplish this. You can dive into the docs for specific implementation details but using the C# helper library the code to send an MMS would look like this:
// Send a new outgoing MMS by POSTing to the Messages resource */
client.SendMessage(
"YYY-YYY-YYYY", // From number, must be an SMS-enabled Twilio number
person.Key, // To number, if using Sandbox see note above
// message content
string.Format("Hey {0}, Monkey Party at 6PM. Bring Bananas!", person.Value),
// media url of the image
new string[] {"https://demo.twilio.com/owl.png" }
);
Disclaimer: I work for Twilio.

Categories

Resources