<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">Blog posts by nahid-bs23</title><link href="http://world.optimizely.com" /><updated>2024-08-27T12:05:58.0000000Z</updated><id>https://world.optimizely.com/blogs/nahid-bs23/</id> <generator uri="http://world.optimizely.com" version="2.0">Optimizely World</generator> <entry><title>Integrate Chat (Tidio) Functionality in Episerver CMS</title><link href="https://world.optimizely.com/blogs/nahid-bs23/dates/2024/8/integrate-chat-tidio-functionality-in-episerver-cms/" /><id>&lt;p&gt;It is quite fundamental for every website owner in today&amp;rsquo;s world to place a live chat option on his/her site since customers can ask questions in real time and concerns can be received promptly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Tidio&lt;/strong&gt;, a live chat system, stands out because it is simple to operate, has a good array of abilities, and is easy to incorporate. In this blog post, we&amp;rsquo;ll integrate Tidio chat into your Episerver CMS website.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Step 1: Create an Account in Tidio&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The incorporation of Tidio into the Espreserver CMS is quite simple however before proceeding to do so a user must sign up for an account.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to the Webpage of Tidio: Navigate to https://www.tidio.com/, and on the top right, click on &amp;lsquo;Get Started&amp;rsquo;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;img src=&quot;/link/d309f463ab53484ba4d0ae7fab055cd0.aspx&quot; width=&quot;865&quot; alt=&quot;Tidio &quot; height=&quot;326&quot; style=&quot;display: block; margin-left: auto; margin-right: auto;&quot; /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create your account: To create your account, adhere to the on-screen directions. For a quicker setup, social logins are another option. If you&amp;rsquo;re a developer and you don&amp;rsquo;t have a published website then just give a dummy website URL and create an account&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;img src=&quot;/link/a4290106bbbe49f585be53aca598d72f.aspx&quot; width=&quot;861&quot; alt=&quot;Tidio Account&quot; height=&quot;461&quot; style=&quot;display: block; margin-left: auto; margin-right: auto;&quot; /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Personalize your Tidio widget: After you have set up an account, you will be required to customize a chat widget for your website. Tailor it to suit your site&#39;s blogs and layout.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Step 2: Copy the JavaScript Code of Tidio&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As soon as your Tidio account has been established, and the installation of your chat widget has been completed, the subsequent thing to do is to get the javascript code snippet that is to be inserted into the Episerver CMS.&lt;/p&gt;
&lt;p&gt;To access the installation code, Click on the &amp;ldquo;&lt;strong&gt;Settings&lt;/strong&gt;&amp;rdquo; tab in your Tidio dashboard. Next, find and click on &amp;ldquo;&lt;strong&gt;Live chat&lt;/strong&gt;&amp;rdquo; option and then go to &amp;ldquo;&lt;strong&gt;Installation&lt;/strong&gt;&amp;rdquo;. In there, you&amp;rsquo;ll find the &amp;ldquo;&lt;strong&gt;Manual Install&lt;/strong&gt;&amp;rdquo; tab. Click on this and you will find the javascript code snippet. Copy the code which we&amp;rsquo;ll use later in the Episerver cms site footer section&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img src=&quot;/link/a1871354a7f04000bc79eb211ec8094b.aspx&quot; width=&quot;893&quot; alt=&quot;Tidio Setup&quot; height=&quot;524&quot; style=&quot;display: block; margin-left: auto; margin-right: auto;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Integrate Tidio with Episerver CMS&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Now that you have the Tidio JavaScript code, it&amp;rsquo;s time to integrate it into your Episerver CMS website.&lt;/p&gt;
&lt;p&gt;Find the main layout file of your website. This is usually where you want to add third-party scripts, as it ensures the script is loaded on all pages. For simplicity, I&amp;rsquo;m using the Alloy theme and adding it in the &lt;strong&gt;Root.cshtml&lt;/strong&gt; file. Note that This placement is recommended to ensure that the script loads after all other content, reducing the risk of blocking page rendering.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/b80420e4a9164ae993078b99be37f7cb.aspx&quot; width=&quot;653&quot; alt=&quot;&quot; height=&quot;365&quot; style=&quot;display: block; margin-left: auto; margin-right: auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 4: Test the Integration&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;After updating the changes, it&amp;rsquo;s essential to test if the Tidio chat widget is working correctly&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/3662decb1e324020b5a5db01d30c5ac9.aspx&quot; width=&quot;817&quot; alt=&quot;&quot; height=&quot;413&quot; style=&quot;display: block; margin-left: auto; margin-right: auto;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Customize the Chat Widget (Optional)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You can further customize the Tidio chat widget to match your website&amp;rsquo;s design and branding.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Integrating Tidio with your Episerver CMS site is a straightforward process that can significantly enhance your user interaction and customer service capabilities. With just a few steps, you can have a fully functional live chat widget that helps you engage with your visitors in real-time.&lt;/p&gt;
&lt;p&gt;By leveraging Tidio&#39;s features, you can offer quick support, improve customer satisfaction, and ultimately drive more conversions. Happy chatting!&lt;/p&gt;</id><updated>2024-08-27T12:05:58.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>Creating Custom Feed Options for Optimizely Forms Selection Elements</title><link href="https://world.optimizely.com/blogs/nahid-bs23/dates/2024/8/creating-custom-feed-options-for-optimizely-forms-selection-elements/" /><id>&lt;p&gt;Optimizely Forms is a versatile tool for building forms used in registrations, job applications, surveys, and much more. These forms can include a variety of elements like text boxes, selection lists, date pickers, and range sliders, and so on. Regarding selection elements, Optimizely provides a built-in manual choice option where you can manually insert choices, also known as feeds.&lt;/p&gt;
&lt;p&gt;However, there are scenarios where you might want to populate these choices dynamically. This could be from a hardcoded list or via an API, rather than manually inputting each option. In this blog post, we&amp;rsquo;ll explore how to create a custom feed option for selection elements in Optimizely Forms, allowing you to dynamically generate choice items tailored to your specific needs.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;First, to create a custom feed option for a selection element in Optimizely Forms, we need to implement a feed class that adheres to the &lt;strong&gt;IFeed&lt;/strong&gt; and &lt;strong&gt;IUEntityInEditView&lt;/strong&gt; interfaces. This custom feed class will be responsible for dynamically generating the choice items displayed in the selection element.&lt;/p&gt;
&lt;p&gt;In this implementation, the &lt;strong&gt;LoadItems&lt;/strong&gt; method will be responsible for providing the list items. For simplicity, we will use a static list containing a set of companies. However, you can easily replace this with an API call or any other data source that suits your needs.&lt;/p&gt;
&lt;p&gt;Here, The &lt;strong&gt;Id&lt;/strong&gt; property in the feed class acts as the unique identifier for the feed, and the &lt;strong&gt;Description&lt;/strong&gt; property, which you should set in the field, will appear as the display name for this feed in the Optimizely Forms UI.&lt;/p&gt;
&lt;p&gt;To ensure that your custom feed is recognized by Optimizely Forms, you need to register it as a feed service type using the &lt;strong&gt;ServiceConfiguration&lt;/strong&gt; attribute in the class definition.&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;[ServiceConfiguration(ServiceType = typeof(IFeed))]
public class CompanyFeed : IFeed, IUIEntityInEditView
{
    // Unique identifier for the feed
    public string ID =&amp;gt; &quot;13b098f3-f960-4465-9cfd-77db88486921&quot;;

    // Display name for the feed
    public string Description { get; set; } = &quot;Company List&quot;;

    // Extra configuration options (optional)
    public string ExtraConfiguration { get; }

    // Friendly title for the edit view
    public string EditViewFriendlyTitle =&amp;gt; Description;

    // Indicates if the feed is available in the edit view
    public bool AvailableInEditView =&amp;gt; true;

    // Method to load the feed items
    public IEnumerable&amp;lt;IFeedItem&amp;gt; LoadItems()
    {
        var feedItems = new List&amp;lt;IFeedItem&amp;gt;();

        // Populate the feed items using the static method GetCompanyList
        foreach (var company in GetCompanyList())
        {
            feedItems.Add(new FeedItem
            {
                Key = company.Item2,
                Value = company.Item1
            });
        }

        return feedItems;
    }

    // Static method to get the company list
    public static List&amp;lt;Tuple&amp;lt;string, string&amp;gt;&amp;gt; GetCompanyList()
    {
        return new List&amp;lt;Tuple&amp;lt;string, string&amp;gt;&amp;gt;
            {
                new(&quot;1&quot;, &quot;Company A&quot;),
                new(&quot;2&quot;, &quot;Company B&quot;),
                new(&quot;3&quot;, &quot;Company C&quot;),
            };
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, we&#39;ll create a feed provider to manage and retrieve the available feeds. The &lt;strong&gt;FormFeedProvider&lt;/strong&gt; class will be responsible for retrieving all instances of the &lt;strong&gt;IFeed&lt;/strong&gt; interface. This allows Optimizely Forms to recognize and utilize any registered feeds.&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;public class FormFeedProvider : IFeedProvider
{
    public IEnumerable&amp;lt;IFeed&amp;gt; GetFeeds() =&amp;gt; ServiceLocator.Current.GetAllInstances&amp;lt;IFeed&amp;gt;();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now that our custom feed options are ready, you can use them in the Optimizely Forms admin UI. Follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Go to the Optimizely admin UI.&lt;/li&gt;
&lt;li&gt;Create a new form or edit an existing one.&lt;/li&gt;
&lt;li&gt;Add a selection element to the form.&lt;/li&gt;
&lt;li&gt;In the choice items configuration for the selection element, you will see the custom feed option available.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;By following these steps, you will be able to dynamically populate choice items in the selection element using the custom feed.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/103038fc15394fc996e4e368984a1a6a.aspx&quot; width=&quot;1138&quot; alt=&quot;&quot; height=&quot;584&quot; /&gt;&lt;/p&gt;</id><updated>2024-08-12T07:41:30.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>Creating Custom Actors for Optimizely Forms</title><link href="https://world.optimizely.com/blogs/nahid-bs23/dates/2024/7/creating-custom-actors-for-optimizely-forms/" /><id>&lt;p&gt;Optimizely Forms is a powerful tool for creating web forms for various purposes such as registrations, job applications, surveys, etc. By default, the submitted data is stored and can be exported in different formats. Additionally, it has two other default actors: email and webhook, which are helpful for sending emails as well as webhooks.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/694facfb8fec4f438fc7fd25d3f9ecac.aspx&quot; width=&quot;747&quot; alt=&quot;default actor preview&quot; height=&quot;330&quot; style=&quot;display: block; margin-left: auto; margin-right: auto;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;However, sometimes clients want to use their own third-party development to integrate and save/post API data. This is where custom actors come into play. In this blog, we&#39;ll learn how to create custom actors and how to integrate them with APIs. Let&#39;s get started!&lt;/p&gt;
&lt;h1&gt;Custom Actor Model&lt;/h1&gt;
&lt;p&gt;To create a custom actor, we first need to create a class that inherits from IPostSubmissionActorModel and ICloneable. This class is used for the actor definition. In this example, we&#39;ll use two actor models in the dropdown list: one for Survey and another for Registration. You can use selection based on your requirements. Also, note that this model should be serializable.&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;public class CustomActorModel : IPostSubmissionActorModel, ICloneable
{
    [Display(Name = &quot;Actor Type&quot;, Order = 101)]
    [SelectOne(SelectionFactoryType = typeof(CustomActorTypeFactory))]
    public virtual string ActorType { get; set; }

    public object Clone()
    {
        return new CustomActorModel
        {
            ActorType = this.ActorType
        };
    }

    private class CustomActorTypeFactory : ISelectionFactory
    {
        public IEnumerable&amp;lt;ISelectItem&amp;gt; GetSelections(ExtendedMetadata metadata)
        {
            return new ISelectItem[]
            {
                new SelectItem() { Text = &quot;Survey API&quot;, Value = &quot;1&quot; },
                new SelectItem() { Text = &quot;Registration API&quot;, Value = &quot;2&quot; }
            };
        }
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;Editor Descriptor&lt;/h1&gt;
&lt;p&gt;After creating the custom actor model, you need to inject this into the editor descriptor, which is used to render the grid UI. For this, you need to inherit an editor descriptor class using the Dojo widget CollectionEditor to render.&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;[EditorDescriptorRegistration(TargetType = typeof(IEnumerable&amp;lt;CustomActorModel&amp;gt;), UIHint = &quot;ConfigurableActorPropertyHint&quot;)]
public class CustomActorEditorDescriptor : CollectionEditorDescriptor&amp;lt;CustomActorModel&amp;gt;
{
    public CustomActorEditorDescriptor()
    {
        ClientEditingClass = &quot;epi-forms/contentediting/editors/CollectionEditor&quot;;
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;Property Definition&lt;/h1&gt;
&lt;p&gt;After creating the editorial descriptor, you need to add a property definition for this actor model and inject the editorial hint from the editorial descriptor&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;[EditorHint(&quot;ConfigurableActorPropertyHint&quot;)]
[PropertyDefinitionTypePlugIn(DisplayName = &quot;ConfigurableActorProp&quot;)]
public class PropertyForDisplayingCustomActor : PropertyGenericList&amp;lt;CustomActorModel&amp;gt;
{
}&lt;/code&gt;&lt;/pre&gt;
&lt;h1&gt;Custom Actor&lt;/h1&gt;
&lt;p&gt;The final part involves implementing the custom actor, which inherits from PostSubmissionActorBase and implements the interface IUIPropertyCustomCollection. The PostSubmissionActorBase will override the Run method where our custom implementation will be done, and IUIPropertyCustomCollection will be used for the edit view user interface of configuring the actor model.&lt;br /&gt;&lt;br /&gt;Here, PropertyType will be our custom property type name.&lt;br /&gt;&lt;br /&gt;Below is a sample implementation of the Run method where we inject formDataRepository. We take the submitted data and find the data based on the element name. We create a custom method that will get the value based on the element name. As you can see, we can use CancelSubmit and ErrorMessage on the result response to prevent data submission as well.&lt;/p&gt;
&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;public class CustomActor : PostSubmissionActorBase, IUIPropertyCustomCollection
{
    private readonly Injected&amp;lt;IFormDataRepository&amp;gt; _formDataRepository;

    public override object Run(object input)
    {
        var result = new SubmissionActorResult { CancelSubmit = false, ErrorMessage = string.Empty };
        var configs = (Model as IEnumerable&amp;lt;CustomActorModel&amp;gt;);
        var submittedData = _formDataRepository.Service.TransformSubmissionDataWithFriendlyName(SubmissionData.Data, SubmissionFriendlyNameInfos, true).ToList();

        if (configs.Any() &amp;amp;&amp;amp; configs.Select(ap =&amp;gt; ap.ActorType).FirstOrDefault() == &quot;1&quot;) // Survey
        {
            // Get by form element name
            var nameData = GetValueByKey(submittedData, &quot;name&quot;);
            // Implement your API
            // If success, then just return result;
            // If not successful, then:
            result.CancelSubmit = true;
            result.ErrorMessage = &quot;your message&quot;;
        }
        else if (configs.Any() &amp;amp;&amp;amp; configs.Select(ap =&amp;gt; ap.ActorType).FirstOrDefault() == &quot;2&quot;) // Registration
        {
            // Follow the previous comment
        }
        else
        {
            return result; // It&#39;ll call other actors if it has any;
        }
        return result;
    }

    public virtual Type PropertyType =&amp;gt; typeof(PropertyForDisplayingCustomActor);

    private string GetValueByKey(List&amp;lt;KeyValuePair&amp;lt;string, object&amp;gt;&amp;gt; list, string key)
    {
        var item = list.FirstOrDefault(kvp =&amp;gt; kvp.Key == key);
        return item.Value?.ToString();
    }
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, if you run your project, you will see that the custom actor has been displayed in your form, and you can select any of them. Based on the selection, when you submit the form, your custom actor will be invoked.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/0b694de8a6944486800afae501c99cc5.aspx&quot; width=&quot;511&quot; alt=&quot;custom actor preview&quot; height=&quot;254&quot; style=&quot;display: block; margin-left: auto; margin-right: auto;&quot; /&gt;&lt;/p&gt;</id><updated>2024-07-16T12:40:38.0000000Z</updated><summary type="html">Blog post</summary></entry></feed>