Twilio.rest.api.v2010.account.messageresource не работает для меня
i want use whatsapp in my prouject but I came across an error,that I don't know what it's for:
"Newtonsoft.Json.JsonSerializationException: Error converting value 451 to type 'Twilio.Exceptions.RestException'. Path '', line 1, position 3. ---> System.ArgumentException: Could not cast or convert from System.Int64 to Twilio.Exceptions.RestException.\r\n at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)\r\n at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)\r\n --- End of inner exception stack trace ---\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)\r\n at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)\r\n at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)\r\n at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)\r\n at Twilio.Clients.TwilioRestClient.ProcessResponse(Response response)\r\n at Twilio.Clients.TwilioRestClient.Request(Request request)\r\n at Twilio.Rest.Api.V2010.Account.MessageResource.Create(CreateMessageOptions options, ITwilioRestClient client)\r\n at Twilio.Rest.Api.V2010.Account.MessageResource.Create(PhoneNumber to, String pathAccountSid, PhoneNumber from, String messagingServiceSid, String body, List`1 mediaUrl, Uri statusCallback, String applicationSid, Nullable`1 maxPrice, Nullable`1 provideFeedback, Nullable`1 attempt, Nullable`1 validityPeriod, Nullable`1 forceDelivery, ContentRetentionEnum contentRetention, AddressRetentionEnum addressRetention, Nullable`1 smartEncoded, List`1 persistentAction, ITwilioRestClient client)\r\n at try_for_send_inf_to_WhatsApp2.Form1.button1_Click(Object sender, EventArgs e) in D:\\Projects\\Test2\\try_for_send_inf_to_WhatsApp2\\try_for_send_inf_to_WhatsApp2\\Form1.cs:line 34"
private void button1_Click(object sender, EventArgs e) { TwilioClient.Init( Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"), Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN") ); try { var message = Twilio.Rest.Api.V2010.Account.MessageResource.Create( from: new PhoneNumber("+14155238886"), to:new PhoneNumber("+989351091287"), body: "salam rezaei", mediaUrl: new List<Uri> { new Uri("https://c1.staticflickr.com/3/2899/14341091933_1e92e62d12_b.jpg") } //mediaUrl: new List<Uri> { new Uri("https://www.demo.twilio.com/owl.png") } ); MessageBox.Show("message id:" + message.Sid); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
Что я уже пробовал:
Я уже использовал wart раньше, но не смог сгенерировать пароль, я слышал от некоторых, что wart больше не поддерживается, поэтому я решил использовать twilio
Я уже давно пытаюсь, пожалуйста, помогите мне получить результаты раньше