.NET cannot send SMS using sinch

127 views Asked by At

I am learning xamarin, I would like to send an sms using sinch but it is not working

I have this error : Newtonsoft.Json.JsonReaderException: 'Unexpected character encountered while parsing value: <. Path '', line 0, position 0.'

Here is my code from the github in a console app:

    class Program
    {
        private static void Main()
        {
            MainAsync().GetAwaiter().GetResult();
        }

        private static async Task MainAsync()
        {
            var smsApi = SinchFactory.CreateApiFactory("xxx", "xxxx","https://clientapi.sinch.com").CreateSmsApi(); 

            var sendSmsResponse =  await smsApi.Sms("+XXXXXXNumber", "Hello world.  Sinch SMS here.").Send(); // the error happens here

            await Task.Delay(TimeSpan.FromSeconds(10)); // May take a second or two to be delivered.

            var smsMessageStatusResponse = await smsApi.GetSmsStatus(sendSmsResponse.MessageId);
            Console.WriteLine(smsMessageStatusResponse.Status);
            Console.ReadLine();
        }
    }
}

if there is a way to use sinch I ll take

Thanks in advance

0

There are 0 answers