<?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 Nicolás Lucero on Medium]]></title>
        <description><![CDATA[Stories by Nicolás Lucero on Medium]]></description>
        <link>https://medium.com/@nico_62930?source=rss-11651cfb35ff------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*BHCSBpE59lR1s9wa</url>
            <title>Stories by Nicolás Lucero on Medium</title>
            <link>https://medium.com/@nico_62930?source=rss-11651cfb35ff------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 19:26:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nico_62930/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[API Customized behavior]]></title>
            <link>https://medium.com/devgurus/api-customized-behavior-9bccc96b91f1?source=rss-11651cfb35ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bccc96b91f1</guid>
            <category><![CDATA[extension]]></category>
            <category><![CDATA[subscription]]></category>
            <category><![CDATA[headless-commerce]]></category>
            <category><![CDATA[commercetools]]></category>
            <dc:creator><![CDATA[Nicolás Lucero]]></dc:creator>
            <pubDate>Wed, 15 Jan 2020 12:17:30 GMT</pubDate>
            <atom:updated>2020-01-15T13:37:12.326Z</atom:updated>
            <content:encoded><![CDATA[<p>How to use commercetools API Extensions and Subscriptions</p><figure><img alt="commercetools" src="https://cdn-images-1.medium.com/max/880/1*uJtDInp-898r9mibIxu5oQ.png" /><figcaption>commercetools logo</figcaption></figure><p>Headless services are becoming more and more popular. Even though no solution solves all problems, commercetools customized behavior makes many specific use cases possible. Thanks to its multitenant architecture the platform works the same for everyone… except you add custom pieces to the puzzle!</p><p>Apart from the custom objects entity, there are two important players that will allow you to customize how the platform acts and reacts to changes: API extensions and subscriptions. The easiest way to understand the difference between both is about timing, while the extension runs right before a creation/change/deletion is persisted, the subscription triggers an event after the action has been persisted in the database.</p><p>In order to show how to use them both we are going to look at two different scenarios, implementing them from scratch using Google Cloud Platform (from now referenced as GCP).</p><h3>API Extension</h3><p>The platform runs a validation over the payload of the request. If the request is valid the change is prepared and the result is sent to the extension. The logic of the extension function can return three different types of responses:</p><ul><li>OK response, confirming the version received.</li><li>OK with update actions, adding an array of actions to be applied over the version received before it gets persisted.</li><li>ERROR response, preventing the change to be persisted and returning an error to the origin of the request.</li></ul><p>If any sent update actions is not valid or the extension responds with an error the action is not persisted and the platform returns an error.</p><h4>Implementing the API Extension</h4><p>Imagine you want to check the domain of the email address provided when creating a customer, preventing the creation when is not included in a specific list. Although the platform allows Google Cloud, Azure functions and AWS Lambda functions as trigger. For our example we are going to use Google Cloud Functions (from now on referred as GFC).</p><h4>STEP 1: Creating the GCF triggered by the extension</h4><p>On the GCP console go to <strong>Functions</strong>. Click on <strong>Create function</strong> and set the name. The default trigger is the one we need (HTTP).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*aSNCQT4sOEFhpsOfJlkWVQ.png" /><figcaption>GCP Cloud Function</figcaption></figure><p>Add the following code to the <em>index.js </em>and then rename the <strong>Function to execute</strong> to match the one from the code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe93f6dc3033186ded1a3680b217c23f/href">https://medium.com/media/fe93f6dc3033186ded1a3680b217c23f/href</a></iframe><p>Copy the trigger URL for the next step.</p><h4>STEP 2: Creating the API extension on commercetools</h4><p>Go to CT’s playground (<a href="https://impex.commercetools.com/playground">Europe</a>/<a href="https://impex.commercetools.co/playground">America</a>), select <em>Extensions </em>as<em> </em>endpoint and <em>create </em>as<em> </em>command. Enter the draft for the extension:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6152237666a7adc3e08fd0a3ceb4ccf0/href">https://medium.com/media/6152237666a7adc3e08fd0a3ceb4ccf0/href</a></iframe><p>Notice that we are triggering the extension not only when a customer is created but also when it’s updated.</p><h4>STEP 3: Create a new customer</h4><p>Go to the Merchant Center (<a href="https://mc.commercetools.com/">Europe</a>/<a href="https://mc.commercetools.co/">America</a>) and try creating new customer using an invalid domain. The UI shows notification error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*fAPU4J17CnwqOxIJeSanrQ.png" /></figure><p>For more information on API extensions check the <a href="https://docs.commercetools.com/http-api-projects-api-extensions#api-extensions">documentation</a>.</p><h3>Subscription</h3><p>Let’s say you want to send a welcome e-mail when a new customer is created. The subscription <strong>will only be triggered</strong> if the creation was successful. The platform is not waiting for any response, so it will only publish to a destination. The destination can be from AWS (SNS or SQS), Azure Service Bus or Google’s Pub/Sub (the one we are going to use for the example).</p><h4>STEP 1: Creating the Google Cloud Pub/Sub’s topic</h4><p>On the GCP console go to <strong>Pub/Sub</strong>. Click on <strong>Create topic, </strong>set a topic id and create the topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HA2TgZE-MZnrnmDnMi15eg.png" /></figure><p>We need to give publisher permissions to the platform. Once the topic has been created go to the info panel on the right and click on <strong>Add Member</strong> on the <strong>permissions</strong> tab. Enter <em>subscriptions@commercetools-platform.iam.gserviceaccount.com</em> on the new members input and set role for Pub/Sub publisher.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-F0cGtgXH3Ge2tUb9yrQkQ.png" /></figure><h4>STEP 2: Creating the Google Cloud Function triggered by the Pub/Sub</h4><p>On the GCP console go to <strong>Functions</strong>. Click on <strong>Create function</strong> and set the name. Set the trigger to <strong>Pub/Sub</strong> and select the topic created previously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*PgJk3SKLvgiffGiC6qA8UA.png" /></figure><p>For our example we are going to use the email service <a href="https://sendgrid.com/">Sendgrid</a>, but of course any service would do.</p><p>We create a service to send the email using the Sendgrid client:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0786f69b8642a4d98ebf1ee5ca535943/href">https://medium.com/media/0786f69b8642a4d98ebf1ee5ca535943/href</a></iframe><p>Now we add a handler to prepare the email and send it using the service:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5350bab9a7fcc00bd0a3f620ae8c1e9/href">https://medium.com/media/c5350bab9a7fcc00bd0a3f620ae8c1e9/href</a></iframe><p>On the index.js file we join everything together:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/20766c41f7ad89c2f312bbcd9938f09e/href">https://medium.com/media/20766c41f7ad89c2f312bbcd9938f09e/href</a></iframe><p>Add the package.json with the Sendgrid dependency:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9040f2b501648919028893645c90b646/href">https://medium.com/media/9040f2b501648919028893645c90b646/href</a></iframe><p>Don’t forget to add the SENDGRID_API_KEY and SENDGRID_FROM_EMAIL environment variables.</p><h4>STEP 3: Creating the subscription on commercetools</h4><p>Go to CT’s playground (<a href="https://impex.commercetools.com/playground">Europe</a>/<a href="https://impex.commercetools.co/playground">America</a>), select <em>Subscriptions </em>as<em> </em>endpoint and <em>create </em>as<em> </em>command. Enter the draft for the subscription:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91a26731c3c82fe4c369bee9f5b1a98e/href">https://medium.com/media/91a26731c3c82fe4c369bee9f5b1a98e/href</a></iframe><h4>STEP 4: Create a new customer</h4><p>Go to the Merchant Center (<a href="https://mc.commercetools.com/">Europe</a>/<a href="https://mc.commercetools.co/">America</a>) and try creating new customer using a valid address. Create the customer and check your inbox.</p><p>For more information on subscriptions check the <a href="https://docs.commercetools.com/http-api-projects-subscriptions">documentation</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bccc96b91f1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devgurus/api-customized-behavior-9bccc96b91f1">API Customized behavior</a> was originally published in <a href="https://medium.com/devgurus">Devgurus</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Looking for the magic unicorn: Fair salary]]></title>
            <link>https://medium.com/@nico_62930/looking-for-the-magic-unicorn-fair-salary-4cff034792ea?source=rss-11651cfb35ff------2</link>
            <guid isPermaLink="false">https://medium.com/p/4cff034792ea</guid>
            <category><![CDATA[salary]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Nicolás Lucero]]></dc:creator>
            <pubDate>Fri, 04 Oct 2019 09:37:11 GMT</pubDate>
            <atom:updated>2019-10-04T09:37:11.610Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffWB5S4muVSH8IXu2PoGkA.jpeg" /><figcaption>Photo by Joshua Aragon on Unsplash</figcaption></figure><p>We usually wonder if we are getting paid fairly for what we do. It’s a common thought in our environment, as the ghost of unemployment doesn’t hit us. There are countries where the salaries within the company are of public knowledge. Spanish culture (and I think many many others) are incompatible with this idea. How do you know how much you should be making for your work? There is no easy answer.<br>You can search for job offers similar to your position on a near location but that would only give you bunch of offers with a range of salary. Recently I’ve received an offer with a range salary where the maximum was the double of the minimum. Doesn’t really help.<br>Some people try to compare themselves with their coworkers, but that it’s also a tricky strategy: most of your coworkers have different experience or are assigned to different projects (with different requirements) or have different skill sets.</p><p>Someone told me recently that you need to find out how much the company is making with you, how much your work is worth. In the best case scenario you find out the rate of your working hour paid by the client, even then it is hard to separate the cost of infrastructure as this is something that changes between companies.</p><p>Tired of searching you end up on one of those surveys that take your own information and share with you the statistics collected, only to get a number that most of the times inflated that will make you feel underpaid. Why? Because people lie on the surveys too.</p><p>“Wait? So I’ve read all this a there is no real answer?” A good friend of mine goes to any job interview that looks interesting. Goes through all the process and wait for the personalized offer. Sure, you actually get the offer depending on your experience and sometimes your skills (many interviews this days include coding tests), but then you always have to decide if you stay or if you go. And then you remember that there are other metrics on the equation: the technology you are working (or will be working) on, the work environment and the other important conditions that you have or will have (working from home, flexible hours … ).</p><p>I don’t have the answer, it’s still a unicorn to me. But you may at least have something to think about…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4cff034792ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>