forked from websms-com/websmscom-csharp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
40 lines (33 loc) · 1.12 KB
/
Copy pathProgram.cs
File metadata and controls
40 lines (33 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Threading.Tasks;
using Websms;
namespace Example
{
class Program
{
static async Task Main(string[] args)
{
// Create the client.
SmsClient client = new SmsClient("username", "password", "https://api.websms.com/json");
// Create new message with one recipient.
TextMessage textMessage = new TextMessage(134, "Hello World!");
try
{
// If test = true, it's just a test. No real sms will be sent.
bool test = false;
// Send the message.
MessageResponse response = await client.Send(textMessage, 1, test);
// Print the response.
Console.WriteLine("Status message: " + response.statusMessage);
Console.WriteLine("Status code: " + response.statusCode);
}
catch (Exception ex)
{
// Handle exceptions.
Console.WriteLine(ex.Message);
}
Console.ReadKey();
Console.WriteLine("Hello World!");
}
}
}