<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Celal Akyüz on Medium]]></title>
        <description><![CDATA[Stories by Celal Akyüz on Medium]]></description>
        <link>https://medium.com/@celalakyuz?source=rss-e94db299866e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZcpDd9MhGHtDhQsWAWjYug.jpeg</url>
            <title>Stories by Celal Akyüz on Medium</title>
            <link>https://medium.com/@celalakyuz?source=rss-e94db299866e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 18:59:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@celalakyuz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[WhatsApp Business API’ye Geçişi Kolaylaştıran Çözüm:Embedded Signup]]></title>
            <link>https://medium.com/teknasyon-engineering/whatsapp-business-apiye-ge%C3%A7i%C5%9Fi-kolayla%C5%9Ft%C4%B1ran-%C3%A7%C3%B6z%C3%BCm-embedded-signup-89f25de8aa40?source=rss-e94db299866e------2</link>
            <guid isPermaLink="false">https://medium.com/p/89f25de8aa40</guid>
            <category><![CDATA[whatsapp-business]]></category>
            <category><![CDATA[desk360]]></category>
            <category><![CDATA[whatsapp]]></category>
            <category><![CDATA[whatsapp-business-api]]></category>
            <category><![CDATA[embedded-signup]]></category>
            <dc:creator><![CDATA[Celal Akyüz]]></dc:creator>
            <pubDate>Fri, 14 Mar 2025 14:13:56 GMT</pubDate>
            <atom:updated>2025-03-14T14:13:56.658Z</atom:updated>
            <content:encoded><![CDATA[<p>WhatsApp Business API, işletmelerin müşterileriyle güvenli ve etkili bir şekilde iletişim kurmasını sağlayan kurumsal bir çözümdür. Bu API, otomatik mesajlar, sipariş takibi ve pazarlama amaçlı bildirimler gibi çeşitli özellikler sunarak müşteri deneyiminin iyileştirilmesine yardımcı olur. WhatsApp Business uygulamasının aksine, özellikle büyük ölçekli firmalar için tasarlanmış olup CRM sistemleriyle entegrasyon ve çok kullanıcılı erişim imkânı sunar. WhatsApp Business API’ye erişim, Meta tarafından yetkilendirilmiş Business Solution Provider (BSP) aracılığıyla sağlanmaktadır.</p><p>WhatsApp Embedded Signup, işletmelerin WhatsApp Business Platform’a, BSP’lere ait bir web sitesinden veya uygulamadan hızlıca kaydolmasını sağlayan bir özelliktir. Geleneksel API başvuru sürecinden farklı olarak, kullanıcılar doğrudan bir işletme hesabı oluşturabilir ve gerekli izinleri BSP’ye vererek entegrasyonu sorunsuz ve güvenli bir şekilde tamamlayabilir.</p><p>WhatsApp Embedded Signup, işletmelerin API kullanımını kolaylaştıran bir araçtır. Hızlı kurulum imkânı sunarak işletmelerin WhatsApp Business API’ye dakikalar içinde kaydolmasını sağlar. Kullanıcı dostu arayüzü sayesinde manuel veya geleneksel API entegrasyonu gereksinimini ortadan kaldırır. Ayrıca, WhatsApp numarası ve işletme doğrulama süreci doğrudan Meta tarafından onaylandığı için süreç daha hızlı ilerler. Üçüncü taraf hizmetlerle kolayca entegre edilebilmesi, özellikle CRM veya müşteri destek araçlarıyla çalışan işletmeler için büyük bir avantaj sağlar. BSP desteği sayesinde teknik süreçler profesyonel olarak yönetilir ve işletmeler ek geliştirme yapmak zorunda kalmaz. Tüm bu adımları Desk360 üzerinden kolayca gerçekleştirebilirsiniz.</p><p>Bu makalede, Embedded Signup ile WhatsApp Business API entegrasyonunun Desk360 üzerinden nasıl gerçekleştirileceğini, yalın bir şekilde ve bazı kod örnekleriyle bahsedeceğim.</p><p>WhatsApp Embedded Signup entegrasyonuna geçmeden önce;</p><ul><li>Bir <a href="https://business.facebook.com/">Facebook işletme hesabına</a> sahip olmanız ve işletmenizin Facebook tarafından onaylanmış olması gerekmektedir.</li><li>BSP olmanız, Facebook işletme hesabınıza bağlı bir <a href="https://developers.facebook.com/">geliştirici hesabına</a> ve bir <a href="https://developers.facebook.com/apps">uygulamaya</a> sahip olmanız gerekmektedir.</li></ul><h4>İzin Verilen Alan Adlarını Ekleme</h4><p><a href="https://developers.facebook.com/apps">Facebook uygulamaları</a> panelinden <strong>Facebook Login for Business</strong> → <strong>Settings</strong> → <strong>Client OAuth Settings</strong> bölümünü açın. <strong>Allowed Domains for the JavaScript SDK</strong> kısmına web sitenizin adresini girmeniz ve aşağıdaki ayarları etkinleştirmeniz gerekmektedir.</p><ul><li>Client OAuth login</li><li>Web OAuth login</li><li>Enforce HTTPS</li><li>Embedded Browser OAuth Login</li><li>use Strict Mode for redirect URIs</li><li>Login with the JavaScript SDK</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*waalz9C4AZ0JSgSdUi1A_A.png" /></figure><h4>İşletmeler İçin Facebook Girişi Yapılandırması Oluşturma</h4><p>İşletmeler için Facebook girişi yapılandırması, Embedded Signup’a erişen işletme müşterilerinden hangi izinlerin talep edileceğini ve ek bilgilerin alınacağını belirler. <strong>Facebook Login for Business</strong> → <strong>Configurations</strong> sayfasına gidin ve yapılandırma akışını başlatmak için <strong>+ Create Configuration</strong> butonuna tıklayın.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TDmtMdnkDf1VoPh4OgwiCg.png" /></figure><p>Yapılandırmaya bir isim girdikten sonra <strong>Embedded Signup</strong> oturum açma varyasyonunu seçin. Ardından, gerekli izinleri (<strong>whatsapp_business_management</strong> ve <strong>whatsapp_business_messaging</strong>) ayarladığınızdan emin olun. Bu adımları tamamladıktan sonra yapılandırma işlemi tamamlanmış olacaktır.</p><h4>İşletmeler için Facebook Girişi URL’si Oluşturma</h4><p>Embedded Signup, işletmeler için Facebook girişi ürününü ve Facebook JavaScript SDK’sını kullanır. Gerekli yapılandırmaları yaptıktan sonra, akışı başlatan bir bağlantıyı veya butonu web sitenize ekleyebilirsiniz.</p><pre>&lt;div&gt;<br>    &lt;button onclick=&quot;embeddedSignup()&quot;<br>            style=&quot;background-color: #1877f2; border: 0; border-radius: 4px; color: #fff; cursor: pointer; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; height: 40px; padding: 0 24px;&quot;&gt;<br>        Login with Facebook<br>    &lt;/button&gt;<br>&lt;/div&gt;</pre><pre>&lt;!-- WhatsApp Embedded Sing Up Flow --&gt;<br>&lt;script&gt;<br>    window.fbAsyncInit = function () {<br>        // JavaScript SDK configuration and setup<br>        FB.init({<br>            appId: &#39;&lt;FACEBOOK_APP_ID&gt;&#39;, // Facebook App ID<br>            cookie: true, // enable cookies<br>            xfbml: true, // parse social plugins on this page<br>            version: &#39;&lt;GRAPH_API_VERSION&gt;&#39; //Graph API version<br>        });<br>    };<br>    // Load the JavaScript SDK asynchronously<br>    (function (d, s, id) {<br>        var js, fjs = d.getElementsByTagName(s)[0];<br>        if (d.getElementById(id)) return;<br>        js = d.createElement(s);<br>        js.id = id;<br>        js.src = &quot;https://connect.facebook.net/en_US/sdk.js&quot;;<br>        fjs.parentNode.insertBefore(js, fjs);<br>    }(document, &#39;script&#39;, &#39;facebook-jssdk&#39;));<br>    // Facebook Login with JavaScript SDK<br>    function embeddedSignup() {<br>        // Conversion tracking code<br>        fbq &amp;&amp; fbq(&#39;trackCustom&#39;, &#39;WhatsAppOnboardingStart&#39;, {<br>            appId: &#39;&lt;FACEBOOK_APP_ID&gt;&#39;,<br>            feature: &#39;whatsapp_embedded_signup&#39;<br>        });<br>        // Launch Facebook login<br>        FB.login(function (response) {<br>            if (response.authResponse) {<br>                const code = response.authResponse.code;<br>                // The returned code must be transmitted to your backend,<br>                // which will perform a server-to-server call from there to our servers for an access token<br>                console.log(code);<br>            } else {<br>                console.log(&#39;User cancelled login or did not fully authorize.&#39;);<br>            }<br>        }, {<br>            // scope: &#39;business_management,whatsapp_business_management,whatsapp_business_messaging&#39;,<br>            config_id: &#39;&lt;FACEBOOK_CONFIGURATION_ID&gt;&#39;, // configuration ID goes here<br>            response_type: &#39;code&#39;, // must be set to &#39;code&#39; for System User access token<br>            override_default_response_type: true, // when true, any response types passed in the &quot;response_type&quot; will take precedence over the default types<br>            extras: {<br>                feature: &#39;whatsapp_embedded_signup&#39;,<br>                featureType: &quot;only_waba_sharing&quot;, // Bypass phone number selection<br>                version: 2,<br>            }<br>        });<br>    }<br>&lt;/script&gt;<br>&lt;!-- WhatsApp Embedded Sing Up Flow end --&gt;<br>&lt;script&gt;<br>    !function (f, b, e, v, n, t, s) {<br>        if (f.fbq) return;<br>        n = f.fbq = function () {<br>            n.callMethod ?<br>                n.callMethod.apply(n, arguments) : n.queue.push(arguments)<br>        };<br>        if (!f._fbq) f._fbq = n;<br>        n.push = n;<br>        n.loaded = !0;<br>        n.version = &#39;2.0&#39;;<br>        n.queue = [];<br>        t = b.createElement(e);<br>        t.async = !0;<br>        t.src = v;<br>        s = b.getElementsByTagName(e)[0];<br>        s.parentNode.insertBefore(t, s)<br>    }(window, document, &#39;script&#39;,<br>        &#39;https://connect.facebook.net/en_US/fbevents.js&#39;);<br>    fbq(&#39;init&#39;, &#39;271384734102214&#39;);<br>    fbq(&#39;track&#39;, &#39;PageView&#39;);<br>&lt;/script&gt;</pre><p>Bağlantıya veya butona tıkladıktan sonra açılan pencerede Facebook hesabınıza giriş yapmadıysanız giriş ekranı açılır. Diğer adımlardaki bilgiler doldurulduktan sonra en son açılan ekranda “Finish” butonuna tıklanılarak Embedded Signup işlemi tamamlanmış olur. Telefon numarası ekleme ve doğrulama adımları BSP’nizin seçimine göre Embedded Signup içerisinde yapılabilir veya Desk360&#39;ta olduğu gibi BSP’ye ait olan web sitesi veya uygulama üzerinden de yapılabilir.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F63lDTqOlr0I%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D63lDTqOlr0I&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F63lDTqOlr0I%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9618ce3f5cdd0010da77a3b2d51c5f88/href">https://medium.com/media/9618ce3f5cdd0010da77a3b2d51c5f88/href</a></iframe><p>Embedded Signup ekranı kapandıktan sonra BSP’niz tarafından WhatsApp Business hesabınızın sisteme dahil edilmesi gerekmektedir. Desk360 olarak bu adımları sırasıyla gerçekleştirmekteyiz. Hadi gelin şimdi bu adımları birlikte inceleyelim.</p><h4>Business Token Oluşturma</h4><p>Embedded Signup işlemi sonucunda elde ettiğimiz code’u business token oluşturmak için kullanıyoruz. Bu oluşturulan business token WhatsApp Business hesabını sisteme dahil etmek için kullanılmaktadır.</p><pre># Request<br>curl --get &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/oauth/access_token&#39; \<br>-d &#39;client_id=&lt;APP_ID&gt;&#39; \<br>-d &#39;client_secret=&lt;APP_SECRET&gt;&#39; \<br>-d &#39;code=&lt;CODE&gt;&#39;<br># Response<br>{<br>  &lt;BUSINESS_TOKEN&gt;<br>}</pre><h4>WhatsApp Business Hesap Bilgilerini Alma</h4><p>Bir önceki adımda oluşturulan business token ile WhatsApp Business hesabına ait bilgileri almaktayız. Bu bilgileri WhatsApp Business hesabını sisteme dahil etmek için kullanmaktayız.</p><pre># Request<br>curl \<br>&#39;https://graph.facebook.com/&lt;API_VERSION&gt;/debug_token?input_token=&lt;BUSINESS_TOKEN&gt;&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39;<br># Response<br>{<br>  &quot;data&quot; : {<br>    &quot;app_id&quot; : &quot;670843887433847&quot;,<br>    &quot;application&quot; : &quot;CommerceBird&quot;,<br>    &quot;data_access_expires_at&quot; : 1672092840,<br>    &quot;expires_at&quot; : 1665090000,<br>    &quot;granular_scopes&quot; : [<br>      {<br>        &quot;scope&quot; : &quot;whatsapp_business_management&quot;,<br>        &quot;target_ids&quot; : [<br>          &quot;102289599326934&quot;, // WABA ID<br>          &quot;101569239400667&quot;<br>        ]<br>      },<br>      {<br>        &quot;scope&quot; : &quot;whatsapp_business_messaging&quot;,<br>        &quot;target_ids&quot; : [<br>          &quot;102289599326934&quot;, // WABA ID<br>          &quot;101569239400667&quot;<br>        ]<br>      }<br>    ],<br>    &quot;is_valid&quot; : true,<br>    &quot;scopes&quot; : [<br>       &quot;whatsapp_business_management&quot;,<br>       &quot;whatsapp_business_messaging&quot;,<br>       &quot;public_profile&quot;<br>    ],<br>    &quot;type&quot; : &quot;USER&quot;,<br>    &quot;user_id&quot; : &quot;10222270944537964&quot;<br>  }<br>}</pre><h4>Sistem Kullanıcısını WhatsApp Business Hesabına Ekleme</h4><p>WhatsApp hesabınızın BSP tarafından verilen izinler doğrultusunda yönetmesine olanak sağlar. BSP’ler aracılığıyla telefon numarası ekleme veya şablon mesaj oluşturma gibi işlemler yapabilirsiniz.</p><pre># Request<br>curl -i -X POST &quot;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WABA_ID&gt;/assigned_users<br>  ?user=&lt;SYSTEM_USER_ID&gt;<br>  &amp;tasks=[&#39;MANAGE|DEVELOP&#39;]<br>  &amp;access_token=&lt;SYSTEM_USER_TOKEN&gt;&quot;<br># Response<br>{<br>  &quot;success&quot;: true<br>}</pre><h4>Kredi Limitlerini Paylaşma</h4><p>BSP’lerin kendilerine ait olan kredi tutarlarını WhatsApp Business hesaplarının mesajlaşma giderleri için kullanılması sağlanır.</p><pre># Request<br>curl -X POST &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;EXTENDED_CREDIT_LINE_ID&gt;/whatsapp_credit_sharing_and_attach?waba_currency=&lt;CURRENCY_CODE&gt;&amp;waba_id=&lt;WABA_ID&gt;&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39;<br># Response<br>{<br>  &quot;allocation_config_id&quot;: &quot;&lt;ALLOCATION_CONFIGURATION_ID&gt;&quot;,<br>  &quot;waba_id&quot;: &quot;&lt;WABA_ID&gt;&quot;<br>}</pre><h4>Webhook Aboneliği Başlatma</h4><p>WhatsApp Business Hesapları (WABA’lar) ve varlıkları, Facebook Graph API’deki nesnelerdir. Bu nesnelerden birinde bir değişiklik olduğunda, BSP’ye ait olan Facebook uygulamasının ayarlarında belirtilen webhook URL’sine bir bildirim gönderir.<br>Bu bildirimler genel olarak WABA’larınızdaki, telefon numaralarınızdaki, şablon mesajlarınızdaki ve telefon numaralarınıza gönderilen mesajlardaki değişikliklerle ilgili bildirimlerdir. Bu bildirimleri sizin yerinize BSP’niz yönetir ve size bildirir.</p><pre># Request<br>curl -X POST &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WABA_ID&gt;/subscribed_apps&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39;<br># Response<br>{<br>  &quot;success&quot;: true<br>}</pre><h4>Telefon Numarası Ekleme</h4><p>WABA’nın mesajlaşmak için kullanacağı telefon numarası eklenir. Bir işletmenin WhatsApp Messenger veya Business uygulamasında aktif olarak kayıtlı bir numarası varsa aynı telefon numarasını kullanamazlar.</p><pre># Request<br>curl &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WABA_ID&gt;/phone_numbers&#39; \<br>-H &#39;Content-Type: application/json&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39; \<br>-d &#39;{<br>    &quot;cc&quot;: &lt;COUNTRY_CODE&gt;,<br>    &quot;phone_number&quot;: &lt;PHONE_NUMBER&gt;,<br>    &quot;verified_name&quot;: &lt;DISPLAY_NAME&gt;<br>}&#39;<br># Response<br>{<br>  &quot;id&quot;: &lt;WHATSAPP_BUSINESS_PHONE_NUMBER_ID&gt;<br>}</pre><h4>Doğrulama Kodu Gönderme</h4><p>Önceki adımda eklediğimiz telefon numarasını WhatsApp Business API’de kullanabilmek için doğrulama yapılması gerekmektedir. İstek başarılı olduğunda istekte belirtilen doğrulama yöntemi ve dili kullanılarak telefon numarasına bir doğrulama kodu gönderilecektir.</p><pre># Request<br>curl -X POST &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WHATSAPP_BUSINESS_PHONE_NUMBER_ID&gt;/request_code?code_method=&lt;SMS|VOICE&gt;&amp;language=&lt;LANGUAGE&gt;&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39;<br># Response<br>{<br>  &quot;success&quot;: true<br>}</pre><h4>Telefon Numarasını Doğrulama</h4><p>Telefon numarasını doğrulamak için numaraya iletilen SMS veya sesli mesajda yer alan doğrulama kodunu kullanarak doğrulama işlemini gerçekleştirmeyiz.</p><pre># Request<br>curl -X POST &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WHATSAPP_BUSINESS_PHONE_NUMBER_ID&gt;/verify_code?code=&lt;CODE&gt;&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39;<br># Response<br>{<br>  &quot;success&quot;: true<br>}</pre><h4>Telefon Numarasını Kaydetme</h4><p>Doğrulamasını yaptığımız telefon numarasını Cloud API’de kullanabilmek için kayıt etmemiz gerekir. Böylelikle bireysel mesajlaşma ve şablon mesaj göndermek için kullanılabilir duruma gelmiş olur.</p><pre># Request<br>curl &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WHATSAPP_BUSINESS_PHONE_NUMBER_ID&gt;/register&#39; \<br>-H &#39;Content-Type: application/json&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39; \<br>-d &#39;<br>{<br>  &quot;messaging_product&quot;: &quot;whatsapp&quot;,<br>  &quot;pin&quot;: &lt;PIN_CODE&gt;<br>}&#39;<br># Response<br>{<br>  &quot;success&quot;: true<br>}</pre><h4>Sonuç Olarak</h4><p>WhatsApp Embedded Signup, müşteri hizmetlerini geliştirmek isteyen işletmeler için hızlı ve pratik bir çözümdür. Teknik bilgi gereksinimini azaltarak entegrasyon sürecini kolaylaştırır. Desk360 olarak, bu süreci sorunsuz bir şekilde yürütmek için işletmelere kesintisiz destek sağlamaktayız.</p><p><a href="https://www.linkedin.com/in/celal-akyuz">Celal Akyüz</a></p><h4>Kaynaklar</h4><ul><li><a href="https://developers.facebook.com/docs/whatsapp/embedded-signup">https://developers.facebook.com/docs/whatsapp/embedded-signup</a></li><li><a href="https://medium.com/@fathahka/end-to-end-whatsapp-business-api-integration-tutorial-b680c8427ff7">https://medium.com/@fathahka/end-to-end-whatsapp-business-api-integration-tutorial-b680c8427ff7</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89f25de8aa40" width="1" height="1" alt=""><hr><p><a href="https://medium.com/teknasyon-engineering/whatsapp-business-apiye-ge%C3%A7i%C5%9Fi-kolayla%C5%9Ft%C4%B1ran-%C3%A7%C3%B6z%C3%BCm-embedded-signup-89f25de8aa40">WhatsApp Business API’ye Geçişi Kolaylaştıran Çözüm:Embedded Signup</a> was originally published in <a href="https://medium.com/teknasyon-engineering">Teknasyon Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Embedded Signup: A Solution to Streamline Transition to WhatsApp Business API]]></title>
            <link>https://medium.com/teknasyon-engineering/embedded-signup-a-solution-to-streamline-transition-to-whatsapp-business-api-cdf57783a2d4?source=rss-e94db299866e------2</link>
            <guid isPermaLink="false">https://medium.com/p/cdf57783a2d4</guid>
            <category><![CDATA[whatsapp]]></category>
            <category><![CDATA[whatsapp-business]]></category>
            <category><![CDATA[desk360]]></category>
            <category><![CDATA[embedded-signup]]></category>
            <category><![CDATA[whatsapp-business-api]]></category>
            <dc:creator><![CDATA[Celal Akyüz]]></dc:creator>
            <pubDate>Fri, 14 Mar 2025 14:13:47 GMT</pubDate>
            <atom:updated>2025-03-14T14:13:47.336Z</atom:updated>
            <content:encoded><![CDATA[<p>WhatsApp Business API is an enterprise solution that enables businesses to communicate securely and effectively with their customers. This API helps improve the customer experience by offering a variety of features such as automated messages, order tracking, and marketing notifications. Unlike WhatsApp Business, it is designed specifically for large enterprises and offers integration with CRM systems and multi-user access. Access to the WhatsApp Business API is provided through a Business Solution Provider (BSP) authorized by Meta.</p><p>WhatsApp Embedded Signup is a feature that enables businesses to quickly sign up for WhatsApp Business Platform from a BSP’s website or app. Unlike the traditional API application process, users can directly create a business account and grant the necessary permissions to the BSP to complete the integration seamlessly and securely.</p><p>WhatsApp Embedded Signup is a tool that makes it easy for businesses to use the API. It offers quick setup, enabling businesses to sign up for the WhatsApp Business API in minutes. Its user-friendly interface eliminates the need for manual or traditional API integration. In addition, the WhatsApp number and business verification process is approved directly by Meta, making the process faster. The ability to easily integrate with third-party services is a huge advantage, especially for businesses working with CRM, or customer support tools. Thanks to BSP support, technical processes are professionally managed, and businesses do not have to make additional development. You can easily realize all these steps through Desk360.</p><p>In this article, I will explain how to integrate Embedded Signup with WhatsApp Business API via Desk360 in a simple way and with some code examples.</p><p>Before moving on to WhatsApp Embedded Signup integration;</p><ul><li>You must have a <a href="https://business.facebook.com/business/loginpage/?next=https://business.facebook.com/?nav_ref=biz_unified_f3_login_page_to_mbs&amp;login_options%255B0%255D=FB&amp;login_options%255B1%255D=IG&amp;login_options%255B2%255D=SSO&amp;config_ref=biz_login_tool_flavor_mbs">Facebook business account</a> and your business must be approved by Facebook.</li><li>You must be a BSP, have a <a href="https://developers.facebook.com/">developer account</a> and an <a href="https://business.facebook.com/business/loginpage/?next=https://developers.facebook.com/apps">app</a> linked to your Facebook business account.</li></ul><h4><strong>Adding Allowed Domains</strong></h4><p>On the <a href="https://business.facebook.com/business/loginpage/?next=https://developers.facebook.com/apps">Facebook applications panel</a>, open <strong>Facebook Login for Business</strong> → <strong>Settings</strong> → <strong>Client OAuth Settings</strong>. In <strong>Allowed Domains for the JavaScript SDK</strong>, you need to enter your website address and enable the following settings.</p><ul><li>Client OAuth login</li><li>Web OAuth login</li><li>Enforce HTTPS</li><li>Embedded Browser OAuth Login</li><li>use Strict Mode for redirect URIs</li><li>Login with the JavaScript SDK</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nSau4CNasF9S_eGVjMPqDg.png" /></figure><h4><strong>Creating Facebook Login Configuration for Businesses</strong></h4><p>Facebook login for business configuration determines which permissions will be requested and additional information collected from business customers accessing Embedded Signup. Go to <strong>Facebook Login for Business → Configurations</strong> and click on + <strong>Create Configuration</strong> to initiate the configuration flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*js5B-FSo3dfJcyE10dbj1g.png" /></figure><p>After entering a name for the configuration, select the <strong>Embedded Signup</strong> sign-in variation. Next, make sure to set the required permissions (<strong>whatsapp_business_management</strong> and <strong>whatsapp_business_messaging</strong>). After completing these steps, the configuration process will be complete.</p><h4><strong>Creating a Facebook Login URL for Businesses</strong></h4><p>Embedded Signup uses Facebook login for business product and the Facebook JavaScript SDK. Once you have made the necessary configurations, you can embed a link or button on your website that initiates the flow.</p><pre>&lt;div&gt;<br>    &lt;button onclick=&quot;embeddedSignup()&quot;<br>            style=&quot;background-color: #1877f2; border: 0; border-radius: 4px; color: #fff; cursor: pointer; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; height: 40px; padding: 0 24px;&quot;&gt;<br>        Login with Facebook<br>    &lt;/button&gt;<br>&lt;/div&gt;</pre><pre>&lt;!-- WhatsApp Embedded Sing Up Flow --&gt;<br>&lt;script&gt;<br>    window.fbAsyncInit = function () {<br>        // JavaScript SDK configuration and setup<br>        FB.init({<br>            appId: &#39;&lt;FACEBOOK_APP_ID&gt;&#39;, // Facebook App ID<br>            cookie: true, // enable cookies<br>            xfbml: true, // parse social plugins on this page<br>            version: &#39;&lt;GRAPH_API_VERSION&gt;&#39; //Graph API version<br>        });<br>    };<br>    // Load the JavaScript SDK asynchronously<br>    (function (d, s, id) {<br>        var js, fjs = d.getElementsByTagName(s)[0];<br>        if (d.getElementById(id)) return;<br>        js = d.createElement(s);<br>        js.id = id;<br>        js.src = &quot;https://connect.facebook.net/en_US/sdk.js&quot;;<br>        fjs.parentNode.insertBefore(js, fjs);<br>    }(document, &#39;script&#39;, &#39;facebook-jssdk&#39;));<br>    // Facebook Login with JavaScript SDK<br>    function embeddedSignup() {<br>        // Conversion tracking code<br>        fbq &amp;&amp; fbq(&#39;trackCustom&#39;, &#39;WhatsAppOnboardingStart&#39;, {<br>            appId: &#39;&lt;FACEBOOK_APP_ID&gt;&#39;,<br>            feature: &#39;whatsapp_embedded_signup&#39;<br>        });<br>        // Launch Facebook login<br>        FB.login(function (response) {<br>            if (response.authResponse) {<br>                const code = response.authResponse.code;<br>                // The returned code must be transmitted to your backend,<br>                // which will perform a server-to-server call from there to our servers for an access token<br>                console.log(code);<br>            } else {<br>                console.log(&#39;User cancelled login or did not fully authorize.&#39;);<br>            }<br>        }, {<br>            // scope: &#39;business_management,whatsapp_business_management,whatsapp_business_messaging&#39;,<br>            config_id: &#39;&lt;FACEBOOK_CONFIGURATION_ID&gt;&#39;, // configuration ID goes here<br>            response_type: &#39;code&#39;, // must be set to &#39;code&#39; for System User access token<br>            override_default_response_type: true, // when true, any response types passed in the &quot;response_type&quot; will take precedence over the default types<br>            extras: {<br>                feature: &#39;whatsapp_embedded_signup&#39;,<br>                featureType: &quot;only_waba_sharing&quot;, // Bypass phone number selection<br>                version: 2,<br>            }<br>        });<br>    }<br>&lt;/script&gt;<br>&lt;!-- WhatsApp Embedded Sing Up Flow end --&gt;<br>&lt;script&gt;<br>    !function (f, b, e, v, n, t, s) {<br>        if (f.fbq) return;<br>        n = f.fbq = function () {<br>            n.callMethod ?<br>                n.callMethod.apply(n, arguments) : n.queue.push(arguments)<br>        };<br>        if (!f._fbq) f._fbq = n;<br>        n.push = n;<br>        n.loaded = !0;<br>        n.version = &#39;2.0&#39;;<br>        n.queue = [];<br>        t = b.createElement(e);<br>        t.async = !0;<br>        t.src = v;<br>        s = b.getElementsByTagName(e)[0];<br>        s.parentNode.insertBefore(t, s)<br>    }(window, document, &#39;script&#39;,<br>        &#39;https://connect.facebook.net/en_US/fbevents.js&#39;);<br>    fbq(&#39;init&#39;, &#39;271384734102214&#39;);<br>    fbq(&#39;track&#39;, &#39;PageView&#39;);<br>&lt;/script&gt;</pre><p>After clicking on the link or button, a login screen will be displayed if you are not logged in to your Facebook account. After filling in the information in the other steps, the Embedded Signup process is completed by clicking on the “Finish” button on the last screen. Depending on your BSP’s choice, phone number adding and verification steps can be done in Embedded Signup or can be done through the BSP’s website or application as in Desk360.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F63lDTqOlr0I%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D63lDTqOlr0I&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F63lDTqOlr0I%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9618ce3f5cdd0010da77a3b2d51c5f88/href">https://medium.com/media/9618ce3f5cdd0010da77a3b2d51c5f88/href</a></iframe><p>After the Embedded Signup screen is closed, your WhatsApp Business account needs to be added to the system by your BSP. At Desk360, we perform these steps in order. Let’s examine these steps together now.</p><h4><strong>Creating Business Token</strong></h4><p>We use the code we get as a result of the Embedded Signup process to create a business token. This created business token is used to add the WhatsApp Business account to the system.</p><pre># Request<br>curl --get &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/oauth/access_token&#39; \<br>-d &#39;client_id=&lt;APP_ID&gt;&#39; \<br>-d &#39;client_secret=&lt;APP_SECRET&gt;&#39; \<br>-d &#39;code=&lt;CODE&gt;&#39;<br># Response<br>{<br>  &lt;BUSINESS_TOKEN&gt;<br>}</pre><h4><strong>Retrieving WhatsApp Business Account Information</strong></h4><p>With the business token created in the previous step, we receive information about the WhatsApp Business account. We use this information to add the WhatsApp Business account to the system.</p><pre># Request<br>curl \<br>&#39;https://graph.facebook.com/&lt;API_VERSION&gt;/debug_token?input_token=&lt;BUSINESS_TOKEN&gt;&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39;<br># Response<br>{<br>  &quot;data&quot; : {<br>    &quot;app_id&quot; : &quot;670843887433847&quot;,<br>    &quot;application&quot; : &quot;CommerceBird&quot;,<br>    &quot;data_access_expires_at&quot; : 1672092840,<br>    &quot;expires_at&quot; : 1665090000,<br>    &quot;granular_scopes&quot; : [<br>      {<br>        &quot;scope&quot; : &quot;whatsapp_business_management&quot;,<br>        &quot;target_ids&quot; : [<br>          &quot;102289599326934&quot;, // WABA ID<br>          &quot;101569239400667&quot;<br>        ]<br>      },<br>      {<br>        &quot;scope&quot; : &quot;whatsapp_business_messaging&quot;,<br>        &quot;target_ids&quot; : [<br>          &quot;102289599326934&quot;, // WABA ID<br>          &quot;101569239400667&quot;<br>        ]<br>      }<br>    ],<br>    &quot;is_valid&quot; : true,<br>    &quot;scopes&quot; : [<br>       &quot;whatsapp_business_management&quot;,<br>       &quot;whatsapp_business_messaging&quot;,<br>       &quot;public_profile&quot;<br>    ],<br>    &quot;type&quot; : &quot;USER&quot;,<br>    &quot;user_id&quot; : &quot;10222270944537964&quot;<br>  }<br>}</pre><h4><strong>Adding System User to WhatsApp Business Account</strong></h4><p>It allows your WhatsApp account to be managed in accordance with the permissions granted by the BSP. Through BSPs, you can perform tasks such as adding phone numbers or creating template messages.</p><pre># Request<br>curl -i -X POST &quot;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WABA_ID&gt;/assigned_users<br>  ?user=&lt;SYSTEM_USER_ID&gt;<br>  &amp;tasks=[&#39;MANAGE|DEVELOP&#39;]<br>  &amp;access_token=&lt;SYSTEM_USER_TOKEN&gt;&quot;<br># Response<br>{<br>  &quot;success&quot;: true<br>}</pre><h4><strong>Sharing Credit Limits</strong></h4><p>BSPs are allowed to use their own credit amounts for messaging expenses of WhatsApp Business accounts.</p><pre># Request<br>curl -X POST &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;EXTENDED_CREDIT_LINE_ID&gt;/whatsapp_credit_sharing_and_attach?waba_currency=&lt;CURRENCY_CODE&gt;&amp;waba_id=&lt;WABA_ID&gt;&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39;<br># Response<br>{<br>  &quot;allocation_config_id&quot;: &quot;&lt;ALLOCATION_CONFIGURATION_ID&gt;&quot;,<br>  &quot;waba_id&quot;: &quot;&lt;WABA_ID&gt;&quot;<br>}</pre><h4><strong>Starting Webhook Subscription</strong></h4><p>WhatsApp Business Accounts (WABAs) and their entities are objects in the Facebook Graph API. When there is a change to one of these objects, it sends a notification to the webhook URL specified in the settings of the Facebook app owned by the BSP.<br>These notifications are typically notifications about changes to your WABAs, phone numbers, template messages, and messages sent to your phone numbers. Your BSP manages these notifications for you and notifies you.</p><pre># Request<br>curl -X POST &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WABA_ID&gt;/subscribed_apps&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39;<br># Response<br>{<br>  &quot;success&quot;: true<br>}</pre><h4><strong>Adding Phone Number</strong></h4><p>The phone number that WABA will use for messaging is added. If a business has a number actively registered in WhatsApp Messenger or the Business app, they cannot use the same phone number.</p><pre># Request<br>curl &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WABA_ID&gt;/phone_numbers&#39; \<br>-H &#39;Content-Type: application/json&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39; \<br>-d &#39;{<br>    &quot;cc&quot;: &lt;COUNTRY_CODE&gt;,<br>    &quot;phone_number&quot;: &lt;PHONE_NUMBER&gt;,<br>    &quot;verified_name&quot;: &lt;DISPLAY_NAME&gt;<br>}&#39;<br># Response<br>{<br>  &quot;id&quot;: &lt;WHATSAPP_BUSINESS_PHONE_NUMBER_ID&gt;<br>}</pre><h4><strong>Sending Verification Code</strong></h4><p>In order to use the phone number we added in the previous step in the WhatsApp Business API, verification is required. When the request is successful, a verification code will be sent to the phone number using the verification method and language specified in the request.</p><pre># Request<br>curl -X POST &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WHATSAPP_BUSINESS_PHONE_NUMBER_ID&gt;/request_code?code_method=&lt;SMS|VOICE&gt;&amp;language=&lt;LANGUAGE&gt;&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39;<br># Response<br>{<br>  &quot;success&quot;: true<br>}</pre><h4><strong>Verifying Phone Number</strong></h4><p>To verify the phone number, we do not perform the verification process using the verification code in the SMS or voice message sent to the number.</p><pre># Request<br>curl -X POST &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WHATSAPP_BUSINESS_PHONE_NUMBER_ID&gt;/verify_code?code=&lt;CODE&gt;&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39;<br># Response<br>{<br>  &quot;success&quot;: true<br>}</pre><h4><strong>Saving Phone Number</strong></h4><p>We need to register the phone number we have verified in order to use it in the Cloud API. This way, it will be available for personal messaging and sending template messages.</p><pre># Request<br>curl &#39;https://graph.facebook.com/&lt;API_VERSION&gt;/&lt;WHATSAPP_BUSINESS_PHONE_NUMBER_ID&gt;/register&#39; \<br>-H &#39;Content-Type: application/json&#39; \<br>-H &#39;Authorization: Bearer &lt;SYSTEM_USER_TOKEN&gt;&#39; \<br>-d &#39;<br>{<br>  &quot;messaging_product&quot;: &quot;whatsapp&quot;,<br>  &quot;pin&quot;: &lt;PIN_CODE&gt;<br>}&#39;<br># Response<br>{<br>  &quot;success&quot;: true<br>}</pre><h4><strong>In Conclusion</strong></h4><p>WhatsApp Embedded Signup is a fast and practical solution for businesses looking to improve their customer service. It simplifies the integration process by reducing the need for technical knowledge. At Desk360, we provide uninterrupted support to businesses to run this process smoothly.</p><p><a href="https://www.linkedin.com/in/celal-akyuz">Celal Akyüz</a></p><h4><strong>Sources</strong></h4><ul><li><a href="https://developers.facebook.com/docs/whatsapp/embedded-signup">https://developers.facebook.com/docs/whatsapp/embedded-signup</a></li><li><a href="https://medium.com/@fathahka/end-to-end-whatsapp-business-api-integration-tutorial-b680c8427ff7">https://medium.com/@fathahka/end-to-end-whatsapp-business-api-integration-tutorial-b680c8427ff7</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdf57783a2d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/teknasyon-engineering/embedded-signup-a-solution-to-streamline-transition-to-whatsapp-business-api-cdf57783a2d4">Embedded Signup: A Solution to Streamline Transition to WhatsApp Business API</a> was originally published in <a href="https://medium.com/teknasyon-engineering">Teknasyon Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel Pipeline Nedir/Nasıl Kullanılır?]]></title>
            <link>https://medium.com/teknasyon-engineering/laravel-pipeline-nedir-nas%C4%B1l-kullan%C4%B1l%C4%B1r-be8e949ec3db?source=rss-e94db299866e------2</link>
            <guid isPermaLink="false">https://medium.com/p/be8e949ec3db</guid>
            <category><![CDATA[laravel-pipeline]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Celal Akyüz]]></dc:creator>
            <pubDate>Tue, 13 Dec 2022 11:18:35 GMT</pubDate>
            <atom:updated>2022-12-13T11:18:35.840Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*R4yRxMPnDTFQzdxAXe5c3w.jpeg" /><figcaption>Laravel Pipeline</figcaption></figure><p>Merhabalar, bu yazımda laravel framework’ün <em>“core”</em> (çekirdek) tasarım desenlerinden biri olan “Pipeline” tasarım desenini anlatacağım.</p><h4>Pipeline tasarım deseni nedir?</h4><p>Pipeline tasarım deseni, karmaşık bir yapıda olan herhangi bir işlemi gerçekleştirmek için nesneyi birkaç sınıf arasında daha küçük görevler halinde kademeli bir şekilde geçirerek nesnenin geri döndürüldüğü bir tasarım desenidir.</p><p>İşlem sırasındaki her görev, aynı türde verileri almalı ve geri döndürmelidir. Böylelikle, diğer görevleri bozmadan görevlerin işlem sırasına eklenmesine, kaldırılmasına veya değiştirilmesine izin verir.</p><h4>Pipeline tasarım deseninin bir takım avantajları vardır:</h4><p><strong>·</strong> İlk olarak, karmaşık yapıdaki işlemleri bireysel görevlere ayrılabilir. Bu, her görevi ayrı ayrı test etmeyi kolaylaştırır.</p><p><strong>·</strong> Görevler, kod tekrarı yapmadan farklı işlemler için yeniden kullanılabilir. Bu bir iş kuralı uyguluyorsanız kod tekrarı olmayacağından kullanışlıdır.</p><p><strong>·</strong> Çalıştığımız uygulamalar sürekli olarak gelişmektedir ve bu nedenle kodunuzun zaman içinde değişmesi muhtemeldir. Mevcut akışı bozmadan karmaşık bir sürecin görevlerine ekleme yapmak, kaldırmak veya değiştirmek çok kolaydır.</p><h4>Laravel Pipeline</h4><p>Laravelde Pipeline’ların nasıl çalıştığına dair en iyi örnek, framework’ün en çok kullanılan bileşenlerinden biri olan “middleware” (ara katman) bileşenleridir. Yazımın başlangıcında pipeline için <em>“core”</em> (çekirdek) tasarım desenlerinden biridir diye belirtmemin sebebi de budur. “<em>Illuminate\Foundation\Http\Kernel”</em> sınıfına göz atarsanız, Pipeline sınıfının yeni bir örneğini kullanarak middleware’lerin (ara katmanların) nasıl çalıştırıldığını görebilirsiniz:</p><pre>/**<br> * Send the given request through the middleware / router.<br> *<br> * @param  \Illuminate\Http\Request  $request<br> * @return \Illuminate\Http\Response<br> */<br>protected function sendRequestThroughRouter($request)<br>{<br>    $this-&gt;app-&gt;instance(&#39;request&#39;, $request);<br><br>    Facade::clearResolvedInstance(&#39;request&#39;);<br><br>    $this-&gt;bootstrap();<br><br>    return (new Pipeline($this-&gt;app))<br>                -&gt;send($request)<br>                -&gt;through($this-&gt;app-&gt;shouldSkipMiddleware() ? [] : $this-&gt;middleware)<br>                -&gt;then($this-&gt;dispatchToRouter());<br>}</pre><p>Laravel pipeline kullanarak, herhangi bir görevi gerçekleştirmek için bir nesneyi birkaç sınıf arasında akıcı bir şekilde geçirebilir ve son olarak tüm görevler çalıştırıldıktan sonra sonucu döndürebilirsiniz. Basit yapıdaki pipeline kullanımını aşağıda görebilirsiniz:</p><pre>use Illuminate\Pipeline\Pipeline;<br><br>app(Pipeline::class)<br>    -&gt;send($content) // -&gt; like request<br>    -&gt;through($pipes) // -&gt; like filter class<br>    -&gt;then(function ($content) {<br>        return Model::create($content); // -&gt; create record<br>    });</pre><p>Pipeline’nın birçok kullanım alanı vardır, ancak daha iyi anlamak için pipeline’ı ve laravel’i kullanarak bir filtreleme işlemi gerçekleştirelim.</p><h4>Örnek</h4><p>Birden fazla kanaldan gelen müşteri destek taleplerini yönettiğimiz bir uygulamamız olduğunu varsayalım. Bu destek taleplerinin hangi kanaldan geldiğini, talep durumlarını filtreleyip, taleplerin gelme tarihine göre artan veya azalan şekilde olacak şekilde sıralayıp, talepleri listelediğimizi varsayalım.</p><p><strong>Pipeline Kullanmadan Önce:</strong></p><p>TicketController’un Index metod’unda filtreleme ve sıralama işlemlerimizi gerçekleştiriyoruz.</p><p><strong>TicketController Class</strong></p><pre>namespace App\Http\Controllers;<br><br>use App\Models\Ticket;<br>use Illuminate\Http\Request;<br><br>class TicketController extends Controller<br>{<br>    /**<br>     * @param Request $request<br>     * @return \Illuminate\Http\JsonResponse<br>     */<br>    public function index(Request $request)<br>    {<br>        $query = Ticket::query();<br><br>        if ($request-&gt;has(&#39;status&#39;)) {<br>            $query-&gt;where(&#39;status&#39;, $request-&gt;status);<br>        }<br><br>        if ($request-&gt;has(&#39;channel&#39;)) {<br>            $query-&gt;where(&#39;channel&#39;, $request-&gt;channel);<br>        }<br><br>        if ($request-&gt;has(&#39;sort&#39;)) {<br>            $query-&gt;orderBy(&#39;created_at&#39;, $request-&gt;sort);<br>        }<br><br>        $tickets = $query-&gt;paginate(20);<br><br>        return response()-&gt;json([<br>            &#39;meta&#39; =&gt; [<br>                &#39;success&#39; =&gt; true,<br>                &#39;message&#39; =&gt; &#39;Success&#39;<br>            ],<br>            &#39;data&#39; =&gt; $tickets<br>        ]);<br>    }<br>}</pre><p><strong>Bu karmaşıklığı ortadan kaldırmak için Pipeline kullanalım.</strong></p><p>Index metod’u yeniden düzenleyerek gelen isteği Pipeline’dan geçirerek filtreleme ve sıralama işlemlerimizi gerçekleştiriyoruz.</p><p><strong>TicketController Class</strong></p><pre>namespace App\Http\Controllers;<br><br>use App\Filters\Channel;<br>use App\Filters\Sort;<br>use App\Filters\Status;<br>use App\Models\Ticket;<br>use Illuminate\Http\Request;<br>use Illuminate\Pipeline\Pipeline;<br><br>class TicketController extends Controller<br>{<br>    /**<br>     * @param Request $request<br>     * @return \Illuminate\Http\JsonResponse<br>     */<br>    public function index(Request $request)<br>    {<br>        $tickets = app(Pipeline::class)<br>            -&gt;send(Ticket::query())<br>            -&gt;through([<br>                Status::class,<br>                Channel::class,<br>                Sort::class,<br>            ])<br>            -&gt;thenReturn()<br>            -&gt;paginate(20);<br><br>        return response()-&gt;json([<br>            &#39;meta&#39; =&gt; [<br>                &#39;success&#39; =&gt; true,<br>                &#39;message&#39; =&gt; &#39;Success&#39;<br>            ],<br>            &#39;data&#39; =&gt; $tickets<br>        ]);<br>    }<br>}</pre><ul><li>Pipeline’dan geçirilecek model <strong>send()</strong> fonksiyonu ile gönderilir.</li><li>Pipline’dan geçirilecek modelin hangi sınıflardan geçirileceği <strong>through()</strong> fonksiyonu ile gönderilir. Basit bir ifadeyle, filtreme sınıflarının listesidir.</li><li><strong>thenReturn()</strong> fonksiyonu, Pipeline’dan geçirilen modeli döndürür.</li></ul><p>Filtreleme işlemlerini gerçekliştiren, diğer sınıflar tarafından kalıtım alınan soyut sınıf ve filtreleme yöntemlerini belirten sınıfları oluşturuyoruz.</p><p><strong>Filter Abstract Class</strong></p><pre>namespace App\Filters;<br><br>use Closure;<br>use Illuminate\Database\Eloquent\Builder;<br>use Illuminate\Http\Request;<br>use Illuminate\Support\Str;<br><br>abstract class Filter<br>{<br>    /**<br>     * @param Request $request<br>     * @param Closure $next<br>     * @return mixed<br>     */<br>    public function handle($request, Closure $next)<br>    {<br>        if (!request()-&gt;has($this-&gt;filterName())) {<br>            return $next($request);<br>        }<br><br>        $builder = $next($request);<br><br>        return $this-&gt;apply($builder);<br>    }<br>    <br>    /**<br>     * @param Builder $builder<br>     * @return mixed<br>     */<br>    abstract protected function apply($builder);<br><br>    /**<br>     * @return string<br>     */<br>    protected function filterName(): string<br>    {<br>        return Str::snake(class_basename($this));<br>    }<br>}</pre><p><strong>Channel Class</strong></p><pre>namespace App\Filters;<br><br>use Illuminate\Database\Eloquent\Builder;<br><br>class Channel extends Filter<br>{<br>    /**<br>     * @param Builder $builder<br>     * @return mixed<br>     */<br>    protected function apply($builder)<br>    {<br>        return $builder-&gt;where(&#39;channel&#39;, request($this-&gt;filterName()));<br>    }<br>}</pre><p><strong>Status Class</strong></p><pre>namespace App\Filters;<br><br>use Illuminate\Database\Eloquent\Builder;<br><br>class Status extends Filter<br>{<br>    /**<br>     * @param Builder $builder<br>     * @return mixed<br>     */<br>    protected function apply($builder)<br>    {<br>        return $builder-&gt;where(&#39;status&#39;, request($this-&gt;filterName()));<br>    }<br>}</pre><p><strong>Sort Class</strong></p><pre>namespace App\Filters;<br><br>use Illuminate\Database\Eloquent\Builder;<br><br>class Sort extends Filter<br>{<br>    /**<br>     * @param Builder $builder<br>     * @return mixed<br>     */<br>    protected function apply($builder)<br>    {<br>        return $builder-&gt;orderBy(&#39;created_at&#39;, request($this-&gt;filterName()));<br>    }<br>}</pre><p>Artık başka bir filtre eklemek istersek, <strong>through()</strong> fonksiyonunda gönderilen filtre sınıflara yeni bir sınıf eklemeli ve bu sınıfta filtre mantığını uygulamalıyız.</p><p><strong>Sonuç Olarak</strong></p><p>Pipeline’ı az sayıdaki filtre için uygulamak gereksiz ve yorucu gelebilir, ancak çok sayıda filtre veya diğer karmaşık uygulamalar için çok temiz ve yararlı olacaktır.</p><p><a href="https://www.linkedin.com/in/celal-akyuz/"><strong>Celal Akyüz</strong></a></p><p>Umarım yazımı beğenmiş ve yararlı bulmuşsunuzdur. Bana ulaşmak için yorum yazabilir veya <a href="https://www.linkedin.com/in/celal-akyuz/"><strong>“Linkedin”</strong></a> adresim üzerinden mesaj atabilirsiniz. Yazımı okuduğunuz için teşekkür ederim.</p><h4><strong>Kaynaklar</strong></h4><ul><li><a href="https://jeffochoa.me/understanding-laravel-pipelines">https://jeffochoa.me/understanding-laravel-pipelines</a></li><li><a href="https://blog.toothpickapp.com/pipeline-in-laravel-2/">https://blog.toothpickapp.com/pipeline-in-laravel-2</a></li><li><a href="https://agoalofalife.medium.com/pipeline-and-php-d9bb0a6370ca">https://agoalofalife.medium.com/pipeline-and-php-d9bb0a6370ca</a></li><li><a href="https://www.codecheef.org/article/laravel-pipeline-interpretation-with-example">https://www.codecheef.org/article/laravel-pipeline-interpretation-with-example</a></li><li><a href="https://dev.to/abrardev99/pipeline-pattern-in-laravel-278p">https://dev.to/abrardev99/pipeline-pattern-in-laravel-278p</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be8e949ec3db" width="1" height="1" alt=""><hr><p><a href="https://medium.com/teknasyon-engineering/laravel-pipeline-nedir-nas%C4%B1l-kullan%C4%B1l%C4%B1r-be8e949ec3db">Laravel Pipeline Nedir/Nasıl Kullanılır?</a> was originally published in <a href="https://medium.com/teknasyon-engineering">Teknasyon Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel 9 ile Gelen Yeni Özellikler]]></title>
            <link>https://medium.com/teknasyon-engineering/laravel-9-ile-gelen-yeni-%C3%B6zellikler-bcfa2b68552f?source=rss-e94db299866e------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcfa2b68552f</guid>
            <category><![CDATA[laravel9]]></category>
            <category><![CDATA[php-frameworks]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <category><![CDATA[php-8]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Celal Akyüz]]></dc:creator>
            <pubDate>Thu, 03 Mar 2022 06:30:57 GMT</pubDate>
            <atom:updated>2022-03-03T06:30:57.474Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pwclEu7Gvke90-tVRnrX0Q.jpeg" /></figure><p>Bu yazımda sizlere Laravel’in son versiyonu ile gelen yeni özellikleri özetleyerek anlatmaya çalışacağım.</p><p>Laravel 9 ile gelen yeni özelliklere örnek olarak; Symfony 6.0 bileşenleri, Symfony Mailer, geliştirilmiş route:list çıktısı, Laravel Scout veritabanı sürücüsü, yeni Eloquent accessor / mutator kullanımı, Enums aracılığıyla route binding yapılması gibi özellikleri sıralayabiliriz.</p><h4>Laravel 9’da Minimum PHP Versiyonu 8.0</h4><p>Laravel 9, Symfony 6.0 bileşenlerine sahip olduğundan ve Symfony 6.0’ın da minimum PHP 8.0 gerektirdiğinden, bu da Laravel 9&#39;un minimum PHP’nin 8.0 versiyonunda çalışabilmesine neden olmuştur.</p><h4>Symfony Mailer</h4><p>Laravel 9&#39;daki en büyük değişikliklerden biri, Aralık 2021&#39;den itibaren artık bakımı ve geliştirmesi yapılmayan SwiftMailer’den Symfony Mailer’a geçilmesidir. Laravel 8&#39;den Laravel 9&#39;a geçişte Symfony Mailer kullanabilmek için; Eğer kurulu ise “Wildbit/swiftmailer-postmark” composer paketi uygulamadan kaldırılmalıdır. Bunun yerine, uygulamaya “symfony/postmark-mailer” ve “symfony/http-client” composer paketleri eklenmelidir.<br>Önceki sürümlerde “Illuminate\Mail\Message” sınıfı eksik metotları “Swift_Message” sınıfı aracılığıyla gerçekleştirilmekteyken Laravel 9 ile “Symfony\Component\Mime\Email” sınıfı ile gerçekleştirilmektedir. Bu nedenle, SwiftMailer’e dayanan herhangi bir kod, karşılık gelen Symfony Mailer karşılıklarıyla güncellenmelidir.<br><em>Bkz: </em><a href="https://laravel.com/docs/9.x/upgrade#symfony-mailer"><em>https://laravel.com/docs/9.x/upgrade#symfony-mailer</em></a></p><pre>// Laravel 8.x...<br>$message<br>    -&gt;setFrom(&#39;johndoe@mailer.com&#39;)<br>    -&gt;setTo(&#39;example@example.org&#39;)<br>    -&gt;setSubject(&#39;Subject&#39;)<br>    -&gt;setBody(&#39;&lt;h1&gt;HTML&lt;/h1&gt;&#39;, &#39;text/html&#39;)<br>    -&gt;addPart(&#39;Plain Text&#39;, &#39;text/plain&#39;);<br><br>// Laravel 9.x...<br>$message<br>    -&gt;from(&#39;johndoe@mailer.com&#39;)<br>    -&gt;to(&#39;example@example.org&#39;)<br>    -&gt;subject(&#39;Test Subject&#39;)<br>    -&gt;html(&#39;&lt;h1&gt;HTML&lt;/h1&gt;&#39;)<br>    -&gt;text(&#39;Plain Text&#39;);</pre><h4>“Route:list” İçin Yeni Görünüm</h4><p>Laravel’in önceki sürümlerinde de olan bu komutun çıktısı büyük projelerde veya çok uzun olan route tanımlarında karmaşık olabiliyordu. Bu yeni görüntüsü ile route listesi daha okunabilir bir hal almıştır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hQAgcTdFQkbT58gSOrd3EA.png" /></figure><h4>Controller Route Grup</h4><p>Bu özellik Laravel 8.80 ile gelmiş olmasına rağmen, kod tekrarını engelleyebilmek için iyi bir yöntem olduğundan bu özelliğe de yer vermek istedim. Ortak controller kullanan route’ları “Route::controller” şeklinde tanımlayarak controller adını tekrar etmekten kurtulabiliriz . Tanımlama sırasında route-&gt;controller_method tanımı yeterlidir:</p><pre>use App\Http\Controllers\TicketController;</pre><pre>Route::controller(TicketController::class)-&gt;group(function () {<br>    Route::prefix(&#39;tickets&#39;)-&gt;group(function () {<br>        Route::get(&#39;/&#39;, &#39;index&#39;);<br>        Route::get(&#39;/{ticket}&#39;, &#39;show&#39;);<br>        Route::post(&#39;/&#39;, &#39;store&#39;);<br>    });<br>});</pre><h4>Anonymous Migrations</h4><p>Laravel 8.37 ile bu özellik gelmiş olsa da gözden kaçmaması için tekrar hatırlatmak için yer vermek istedim. Laravel 9&#39;da da kullanımı benzer şekildedir. Uzun ve karmaşık migration class isimleri yerine isimsiz (anonim) migration class yapısı kullanımına geçildi. Ayrıca migration dosyaları için taslak dosyalar da (Stubs) oluşturulabilir.</p><pre>use App\Models\User;</pre><pre>return new class extends Migration<br>{<br>    <em>/**<br>     * Run the migrations.<br>     *<br>     * </em><strong><em>@return </em></strong><em>void<br>     */<br>    </em>public function up()<br>    {<br>        Schema::create(&#39;tickets&#39;, function (Blueprint $table) {<br>            $table-&gt;id();<br>            $table-&gt;foreignIdFor(User::class)-&gt;constrained();<br>            $table-&gt;string(&#39;title&#39;);<br>            $table-&gt;text(&#39;description&#39;)-&gt;fullText();<br>            $table-&gt;string(&#39;status&#39;)-&gt;default(&#39;unresolved&#39;);<br>            $table-&gt;timestamps();<br>        });<br>    }<br><br>    <em>/**<br>     * Reverse the migrations.<br>     *<br>     * </em><strong><em>@return </em></strong><em>void<br>     */<br>    </em>public function down()<br>    {<br>        Schema::dropIfExists(&#39;tickets&#39;);<br>    }<br>};</pre><p><em>Bkz:</em> <a href="https://laravel-news.com/laravel-anonymous-migrations">https://laravel-news.com/laravel-anonymous-migrations</a></p><h4>Yeni Yardımcı Fonksiyonlar</h4><p>Laravel 9’a iki yeni, kullanışlı yardımcı fonksiyon eklendi.</p><p>‘str’ fonksiyonu, verilen metinsel ifade için yeni bir ‘Illuminate\Support\Stringable’ örneği döndürür. Bu fonksiyon, ‘Str::of’ kullanımıyla aynıdır:</p><pre>return str(&#39;Laravel&#39;)-&gt;append(&#39; Framework&#39;);<br>// &#39;Laravel Framework&#39;</pre><pre>return str()-&gt;snake(&#39;LaravelFramework&#39;);<br>// &#39;laravel_framework&#39;</pre><p>Not: ‘str’ fonksiyonuna herhangi bir parametre gönderilmez ise, fonksiyon bir ‘Illuminate\Support\Str’ return eder.</p><p>“to_route” fonksiyonu, isimlendirilmiş route için bir yeniden yönlendirme HTTP yanıtı oluşturarak, route’larınızdan ve controller’larınızdan isimlendirilmiş route’lara yeniden yönlendirmek için kullanılır:</p><pre>return to_route(&#39;tickets.show&#39;, [&#39;ticket&#39; =&gt; 1]);</pre><h4>Satır İçi Blade Şablonları Oluşturma</h4><p>Laravel 8.80 ile gelen bu özellik ile metinlerde Blade şablonlarını kullanmak iyi bir yöntem olduğu için hatırlatmak istedim. Laravel 9&#39;da da kullanımı benzer şekildedir. Blade şablon metinlerinin HTML çıktısını Blade Facade’ın render fonksiyonu ile alınabilir. Bu render fonksiyonu blade şablon metni ve isteğe bağlı kullanılacak bir veri dizisi ile çalıştırılabilir.</p><pre>use Illuminate\Support\Facades\Blade;</pre><pre>return Blade::render(&#39;Hello, {{ $name }}&#39;, [&#39;name&#39; =&gt; &#39;World&#39;]);</pre><h4>Scoped Bindings</h4><p>Laravel’in önceki sürümlerinde, bir route tanımında ikinci modelin, önceki modelin alt öğesi olacak şekilde kapsamasını istediğinizde ikinci modele özellik tanımlaması yapmak gerekiyordu.</p><pre>use App\Models\Ticket;<br>use App\Models\User;</pre><pre>Route::get(&#39;users/{user}/tickets/{ticket:id}&#39;, <br>    function (User $user, Ticket $ticket) {<br>        return $ticket;<br>});</pre><p>Ancak, Laravel 9 ile ikinci modele özellik tanımlaması yapılmadan ikinci modeli de kapsayacak şekilde yapabilirsiniz.</p><pre>use App\Models\Ticket;<br>use App\Models\User;</pre><pre>Route::get(&#39;users/{user}/tickets/{ticket}&#39;, <br>    function (User $user, Ticket $ticket) {<br>       return $ticket;<br>})-&gt;scopeBindings();</pre><h4>Laravel Scout Database Engine</h4><p>Uygulamanız küçük veya orta ölçekli veritabanlarıyla çalışıyorsa veya yüksek trafiğe sahip değilse, artık “Algolia” veya “MeiliSerach” gibi özel bir arama servisleri yerine Scout’ın veritabanı motorunu kullanabilirsiniz. Veritabanı motoru, sorgunuz için uygun arama sonuçlarını belirlemek için mevcut veritabanınızdan sonuçları filtrelerken “where like” ifadelerini ve tam metin dizinlerini kullanır.</p><h4>Full Text Indexes</h4><p>Laravel 8.79 ile bu özellik gelmiş olsa da arama sorgularında daha hızlı sonuç alındığından, kullanımı da Laravel 9&#39;da benzer olduğundan eklemek istedim. MySQL veya PostgreSQL kullanırken, tam metin index’leri oluşturmak için, migration dosyalarında sütun tanımlarken fullText() metodu eklenebilir.</p><pre>Schema::create(&#39;tickets&#39;, function (Blueprint $table) {<br>    $table-&gt;text(&#39;description&#39;)-&gt;fullText();<br>});</pre><p>Tam metin index’i olan sütunlarda sorgulama yapmak için “whereFullText” ve “orWhereFullText” yöntemlerini kullanılabilir.</p><pre>use App\Models\Ticket;</pre><pre>return Ticket::<em>whereFullText</em>(&#39;description&#39;, &#39;Hello&#39;)-&gt;get();</pre><h4>Route Bindings With Enums</h4><p>PHP’nin 8.1 versiyonu ile Enumlar deskteklenebilir hale gelmiştir. Laravel 9 ile route tanımınıza bir Enum bağlayabilirsiniz. Laravel, route path’ine karşılık gelen url geçerli bir Enum değeriyse route’ı çağırır, aksi halde otomatik olarak HTTP 404 yanıtı döndürecektir. Yalnızca {status} route path’i geçerli bir Enum değeriyse çağrılacak bir route tanımlayabilirsiniz.</p><pre>use App\Enums\TicketStatus;</pre><pre>Route::get(&#39;/tickets/statuses/{status}&#39;, function (TicketStatus $status) {<br>    return $status-&gt;value;<br>});</pre><h4>Enum Eloquent Model Attribute Casting</h4><p>Laravel 9 ile, modele ait öznitelikleri Enum’lara dönüştürebilirsiniz. Bunu yapabilmeniz için modele ait “$casts” özellik dizisine Enum’a dönüştürmek istediğiniz özelliği ve Enum değerini belirtebilirsiniz.</p><pre>use App\Enums\TicketStatus;</pre><pre>class Ticket extends Model<br>{<br>    use HasFactory;<br><br>    protected $casts = [<br>        &#39;status&#39; =&gt; TicketStatus::class,<br>    ];<br>}</pre><h4>Gelişmiş Eloquent Accessors / Mutators</h4><p>Laravel’in önceki sürümlerinde, erişimcileri ve mutatörleri tanımlamanın tek yolu, modelinizde ön ekli ve camel case biçimde yazılan fonksiyonlar tanımlamaktı.</p><pre>class Ticket extends Model<br>{<br>    use HasFactory;<br><br>    public function getStatusAttribute($value)<br>    {<br>        return ucfirst($value);<br>    }<br><br>    public function setStatusAttribute($value)<br>    {<br>        $this-&gt;attributes[&#39;status&#39;] = $value;<br>    }<br>}</pre><p>Laravel 9 ile tek, ön eksiz ve dönüş türü “Illuminate\Database\Eloquent\Casts\Attribute” olan bir fonksiyon ile erişimci ve mutatör tanımlayabilirsiniz.</p><pre>class Ticket extends Model<br>{<br>    use HasFactory;<br><br>    public function status(): Attribute<br>    {<br>        return new Attribute(<br>            get: fn ($value) =&gt; ucfirst($value),<br>            set: fn ($value) =&gt; $value<br>        );<br>    }<br>}</pre><p><a href="https://www.linkedin.com/in/celal-akyuz/"><strong>Celal Akyüz</strong></a></p><p>Umarım bu yazımı beğenmiş ve yararlı bulmuşsunuzdur. Bana ulaşmak için yorum yazabilir ve ya <a href="https://www.linkedin.com/in/celal-akyuz/"><strong>“Linkedin”</strong></a> adresim üzerinden mesaj atabilirsiniz. Yazımı okuduğunuz için teşekkür ederim.</p><h4>Kaynaklar</h4><p><a href="https://laravel.com/docs/9.x/releases">https://laravel.com/docs/9.x/releases<br></a><a href="https://laracasts.com/series/whats-new-in-laravel-9">https://laracasts.com/series/whats-new-in-laravel-9</a><br><a href="https://kinsta.com/blog/laravel-9/">https://kinsta.com/blog/laravel-9</a><br><a href="https://medium.com/techvblogs/whats-new-in-laravel-9-new-features-of-laravel-9-aaf6d3249aed">https://medium.com/techvblogs/whats-new-in-laravel-9-new-features-of-laravel-9-aaf6d3249aed</a><br><a href="https://symfony.com/doc/current/mailer.html#creating-sending-messages">https://symfony.com/doc/current/mailer.html#creating-sending-messages</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcfa2b68552f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/teknasyon-engineering/laravel-9-ile-gelen-yeni-%C3%B6zellikler-bcfa2b68552f">Laravel 9 ile Gelen Yeni Özellikler</a> was originally published in <a href="https://medium.com/teknasyon-engineering">Teknasyon Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>