Example #1
0
        public async Task <string> MarkAsSuccessful(string goalID, string visitorID)
        {
            string uri     = string.Format("goals/{0}/mark_as_successful", HttpUtility.UrlEncode(goalID));
            string content = string.Format("visitor_id={0}", HttpUtility.UrlEncode(visitorID));

            return(await Api.Post(uri, content));
        }
Example #2
0
        public async Task <string> StartChat(string visitorID, string licenseID, string welcomeMessage, Dictionary <string, string> parameters = null)
        {
            string uri     = string.Format("visitors/{0}/chat/start", HttpUtility.UrlEncode(visitorID));
            string content = string.Format("licence_id={0}&welcome_message={1}", HttpUtility.UrlEncode(licenseID), HttpUtility.UrlEncode(welcomeMessage));

            if (parameters != null && parameters.Count > 0)
            {
                foreach (var keyValuePair in parameters)
                {
                    content += string.Format("&{0}={1}", keyValuePair.Key, HttpUtility.UrlEncode(keyValuePair.Value));
                }
            }

            return(await Api.Post(uri, content));
        }
Example #3
0
        public async Task <string> SendTranscript(string chatID, string email)
        {
            string uri     = string.Format("chats/{0}/send_transcript", HttpUtility.UrlEncode(chatID));
            string content = string.Format("to={0}", HttpUtility.UrlEncode(email));

            return(await Api.Post(uri, content));
        }
Example #4
0
        public async Task <string> Add(string author, string tag, string groupID)
        {
            string uri     = "tags";
            string content = string.Format("tag={0}&author={1}&group={2}", HttpUtility.UrlEncode(tag), HttpUtility.UrlEncode(author), HttpUtility.UrlEncode(groupID));

            return(await Api.Post(uri, content));
        }
Example #5
0
        public async Task <string> Add(Dictionary <string, string> props)
        {
            string uri     = "agents";
            string content = "";

            if (props != null && props.Count > 0)
            {
                foreach (var keyValuePair in props)
                {
                    if (content.Length > 0)
                    {
                        content += "&";
                    }
                    content += string.Format("{0}={1}", keyValuePair.Key, HttpUtility.UrlEncode(keyValuePair.Value));
                }
            }

            return(await Api.Post(uri, content));
        }
Example #6
0
        public async Task <string> Add(string message, string requesterMail, Dictionary <string, string> parameters = null)
        {
            string uri     = "tickets";
            string content = string.Format("message={0}&requester[mail]={1}", HttpUtility.UrlEncode(message), HttpUtility.UrlEncode(requesterMail));

            if (parameters != null && parameters.Count > 0)
            {
                foreach (var keyValuePair in parameters)
                {
                    content += string.Format("&{0}={1}", keyValuePair.Key, HttpUtility.UrlEncode(keyValuePair.Value));
                }
            }

            return(await Api.Post(uri, content));
        }
Example #7
0
        public async Task <string> Add(string eventType, string[] dataTypes, string url)
        {
            string uri     = "webhooks";
            string content = string.Format("event_type={0}&url={1}", HttpUtility.UrlEncode(eventType), HttpUtility.UrlEncode(url));

            if (dataTypes != null && dataTypes.Count() > 0)
            {
                foreach (var type in dataTypes)
                {
                    content += string.Format("&data_types[]={0}", HttpUtility.UrlEncode(type));
                }
            }

            return(await Api.Post(uri, content));
        }
        public async Task <string> Add(string text, string[] tags, string groupID = "")
        {
            string uri     = string.Format("canned_responses");
            string content = string.Format("text={0}", HttpUtility.UrlEncode(text));

            if (tags != null && tags.Count() > 0)
            {
                foreach (var tag in tags)
                {
                    content += string.Format("&tags[]={0}", HttpUtility.UrlEncode(tag));
                }
            }
            if (groupID.Length > 0)
            {
                content += string.Format("&group={0}", HttpUtility.UrlEncode(text));
            }

            return(await Api.Post(uri, content));
        }
Example #9
0
        public async Task <string> Add(string name, Dictionary <string, string>[] rules, Dictionary <string, string>[] funnelRules, string groupID = "")
        {
            string uri     = "greetings";
            string content = string.Format("name={0}", HttpUtility.UrlEncode(name));
            int    i       = 0;

            if (rules != null && rules.Count() > 0)
            {
                foreach (var rule in rules)
                {
                    foreach (var keyValuePair in rule)
                    {
                        content += string.Format("&rules[{0}][{1}]={2}", i, keyValuePair.Key, HttpUtility.UrlEncode(keyValuePair.Value));
                    }
                    i++;
                }
            }
            if (funnelRules != null && funnelRules.Count() > 0)
            {
                foreach (var rule in funnelRules)
                {
                    if (rule.Count > 0)
                    {
                        int j = 0;
                        content += string.Format("&rules[{0}][type]=url_funnel", i);
                        foreach (var keyValuePair in rule)
                        {
                            content += string.Format("&rules[{0}][urls][{1}][url]={2}", i, j, HttpUtility.UrlEncode(keyValuePair.Key));
                            content += string.Format("&rules[{0}][urls][{1}][operator]={2}", i, j, HttpUtility.UrlEncode(keyValuePair.Value));
                            j++;
                        }
                        i++;
                    }
                }
            }
            if (groupID.Length > 0)
            {
                content += string.Format("&group={0}", HttpUtility.UrlEncode(groupID));
            }

            return(await Api.Post(uri, content));
        }
Example #10
0
        public async Task <string> Add(string name, string[] agents, string language = "")
        {
            string uri     = "groups";
            string content = string.Format("name={0}", HttpUtility.UrlEncode(name));

            if (agents != null && agents.Count() > 0)
            {
                int i = 0;
                foreach (var agent in agents)
                {
                    content += string.Format("&agents[{0}]={1}", i, HttpUtility.UrlEncode(agent));
                }
            }
            if (language.Length > 0)
            {
                content += string.Format("&language={0}", HttpUtility.UrlEncode(language));
            }

            return(await Api.Post(uri, content));
        }
Example #11
0
        public async Task <string> AddCustomDetails(string visitorID, string licenseID, string token, string id, Dictionary <string, string> fields, string icon = "")
        {
            string uri     = string.Format("visitors/{0}/details", HttpUtility.UrlEncode(visitorID));
            string content = string.Format("license_id={0}&token={1}&id={2}", HttpUtility.UrlEncode(licenseID), HttpUtility.UrlEncode(token), HttpUtility.UrlEncode(id));

            if (fields != null && fields.Count > 0)
            {
                int i = 0;
                foreach (var keyValuePair in fields)
                {
                    content += string.Format("&fields[{0}][name]={1}&fields[{0}][value]={2}", i, HttpUtility.UrlEncode(keyValuePair.Key), HttpUtility.UrlEncode(keyValuePair.Value));
                    i++;
                }
            }
            if (icon.Length > 0)
            {
                content += string.Format("&icon={0}", icon);
            }

            return(await Api.Post(uri, content));
        }