Beispiel #1
0
        protected MessageRequestBody BuildBody(string phone, string sourceAddress, string messageText,
                                               ContentType contentType = ContentType.TEXT, string type = "viber", PriorityType priority = PriorityType.LOW,
                                               string smsText          = null, string smsSourceAddres  = null, string comment = null, string buttonUrl = null,
                                               string buttonCaption    = null, string imageUrl         = null, bool resendSms = true)
        {
            MessageContent content = new MessageContent()
            {
                text     = messageText,
                action   = buttonUrl,
                caption  = buttonCaption,
                imageUrl = imageUrl,
            };
            Message message = new Message()
            {
                address           = phone,
                priority          = PriorityTypes[priority],
                content           = content,
                comment           = comment,
                subject           = sourceAddress,
                contentType       = ContentTypes[contentType],
                validityPeriodSec = liveTimeMessage,
                type                 = type,
                smsText              = smsText ?? content.text,
                smsSrcAddress        = smsSourceAddres ?? sourceAddress,
                smsValidityPeriodSec = liveTimeMessage * 3,
            };
            List <Message> messages = new List <Message>()
            {
                message
            };
            MessageRequestBody body = new MessageRequestBody()
            {
                resendSms = resendSms,
                messages  = messages,
            };

            return(body);
        }
Beispiel #2
0
 public virtual SendingReplay SendMessage(MessageRequestBody body, out string resultResponse)
 {
     resultResponse = GetResponse(body, providerUrl);
     return(GetSendingReplay(resultResponse));
 }
Beispiel #3
0
 public virtual SendingReplay SendMessage(MessageRequestBody body) =>
 GetSendingReplay(GetResponse(body, providerUrl));