<?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[Infobip Developers - Medium]]></title>
        <description><![CDATA[A place for Infobip Developers to share their stories, thoughts, ideas, opinions, as well as some tips and tricks on everyday challenges we are facing. - Medium]]></description>
        <link>https://medium.com/infobipdev?source=rss----97827c79af94---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Infobip Developers - Medium</title>
            <link>https://medium.com/infobipdev?source=rss----97827c79af94---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 01:21:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/infobipdev" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[In-Person Developer Conferences to Attend in 2022]]></title>
            <link>https://medium.com/infobipdev/in-person-developer-conferences-to-attend-in-2022-d5186aded1e8?source=rss----97827c79af94---4</link>
            <guid isPermaLink="false">https://medium.com/p/d5186aded1e8</guid>
            <category><![CDATA[startup-conference]]></category>
            <category><![CDATA[developer-conference]]></category>
            <category><![CDATA[conference]]></category>
            <category><![CDATA[developer-relations]]></category>
            <category><![CDATA[tech-conference]]></category>
            <dc:creator><![CDATA[Ivan Burazin]]></dc:creator>
            <pubDate>Sat, 29 Jan 2022 07:30:21 GMT</pubDate>
            <atom:updated>2022-01-29T07:30:20.939Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If you’re looking for a list of only in-person developer conferences in 2022, read on.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MdQiRscYvRlQgR9amGQ52g.jpeg" /><figcaption>Infobip Shift Developer Conference courtesy of Infobip</figcaption></figure><p>After the last two years of conference delays, migrations to virtual or flat out cancellations, thanks to a handful of successful in-person conferences last year, it seems that 2022 will finally be the year we go back to in-person events.</p><p>Of course 2022 is not without its issues, and with new variants of the pandemic appearing around the globe some organizers are still opting out to go full in-person. Which is why if you are like me, and really miss the in person experience, it’s really to find which events are actually happening.</p><p>This year we at plan to attend, speak and sponsor a lot of in-person conferences, and in the process of researching we ended up creating a list of In- person Conferences that will take place in 2022. This list is comprised of both Developer and general tech conferences that I subjectively believe are worth attending.</p><p>The conferences are listy by date and have added some tags to the to better orient if they are a fit for you.</p><h3>In-Person Developer Conferences</h3><p>Below you will find an embedded Airtable with the following; names, dates, locations and URLs of the in-person conferences.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fairtable.com%2Fembed%2FshrwvO1hs7bhXiONV&amp;display_name=Airtable&amp;url=https%3A%2F%2Fairtable.com%2FshrwvO1hs7bhXiONV&amp;image=https%3A%2F%2Fstatic.airtable.com%2Fimages%2Foembed%2Fairtable.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=airtable" width="800" height="533" frameborder="0" scrolling="no"><a href="https://medium.com/media/99130967edf449bc8a45357ce1aff31a/href">https://medium.com/media/99130967edf449bc8a45357ce1aff31a/href</a></iframe><p>Of course this is a live document, so some conferences might end up being canceled or going virtual, while others might later in the year decide to go full in-person. So if you find such instances please message me on <a href="https://twitter.com/ivanburazin">@ivanburazin</a> and I’ll update this table.</p><p>Hope it helps, and if you’re at any of these events please do reach out and we can grab a coffee.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5186aded1e8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infobipdev/in-person-developer-conferences-to-attend-in-2022-d5186aded1e8">In-Person Developer Conferences to Attend in 2022</a> was originally published in <a href="https://medium.com/infobipdev">Infobip Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Write a URL Shortener in 26 Lines of Code with .NET Minimal APIs]]></title>
            <link>https://medium.com/infobipdev/write-a-url-shortener-in-26-lines-of-code-with-net-minimal-apis-52e110a07a25?source=rss----97827c79af94---4</link>
            <guid isPermaLink="false">https://medium.com/p/52e110a07a25</guid>
            <category><![CDATA[webapi]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Dino Lozina]]></dc:creator>
            <pubDate>Thu, 13 Jan 2022 10:01:09 GMT</pubDate>
            <atom:updated>2022-01-13T10:01:09.588Z</atom:updated>
            <content:encoded><![CDATA[<h3>Write a URL Shortener in 26 Lines of Code with .NET Minimal APIs</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ILzVq4SMSIH0VlYn2urysg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@markuswinkler?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Markus Winkler</a> on <a href="https://unsplash.com/@markuswinkler?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I was looking forward to .NET minimal API framework for a very long time and now, it is finally out! Let’s dive into new version of .NET6 and answer the following questions:</p><ol><li>What is .NET minimal API?</li><li>How to refactor existing URL shortener?</li><li>How to add dependency to service?</li><li>How to add endpoint to service?</li><li>Where are using statements?</li></ol><h3>🤔 1. <strong>Introducing .NET Minimal API</strong></h3><p><em>”Do you need </em><strong><em>all of this</em></strong><em> stuff just to shorten URL?”</em></p><p>This was a first reaction of a friend (who happens to be a Python programmer) when I showed him my <a href="https://github.com/dlozina/url-shortener-service-v2">first shortner example</a>.</p><p>“Yes” would have been a pretty accurate answer, but not the one that I’d be happy with.</p><p>There was a lot of boilerplate code compared to other frameworks.</p><p>One benefit is that the structure is already set up — very convenient when we have larger projects to tackle. On the other hand, not ideal when I need to create a small service as part of a microservices architecture.</p><p>Most SaaS providers are using microservice architecture for its scalability, smaller/faster deployments, and ease of understanding.</p><p>Take a look at the <strong>Flask API template</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/300cc34cfba8544017637c7bbc6e4947/href">https://medium.com/media/300cc34cfba8544017637c7bbc6e4947/href</a></iframe><p>In just 5 lines of code, we have our first endpoint! Single file, no other setup needed. All we need to focus on is the feature of this new service.</p><p>Now, let’s take a look at the initial .NET template. Out of the box, we get</p><p><em>Startup.cs</em>, <em>Program.cs</em>, <em>Controllers</em>…a lot of boilerplate code. This could be unnecessary if the goal is to write one small service as part of a SaaS product or just a prototype.</p><p>Fortunately, .NET6 addresses this issue. Let’s rewrite the previous example in <strong>.NET6 with a new template</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69ffc7cf3247e7f386ec70f247223fba/href">https://medium.com/media/69ffc7cf3247e7f386ec70f247223fba/href</a></iframe><p>Just 4 lines of code for our first endpoint. Single file. This is new .NET minimal API!</p><p>Back to my friend’s question — <em>“Do you need all of this stuff just to shorten URL?”</em></p><p>No.<br>I can do better.</p><h3>✂️ 2. Refactored URL shortener example</h3><p>A while back, I wrote a post on <a href="https://medium.com/infobipdev/how-to-write-url-shortener-in-net5-ec415d581fb8">how to write URL shortener in .NET5?</a>, but I never could have imagined that I would be able to write .NET shortener in 26 lines of code and a single file.</p><p><em>Note: we actually have two files — we will get to the bottom of that in the fifth section, bear with me.</em></p><p>Refactored code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/09c9f65c88d427d77058ce3f5a3d2abe/href">https://medium.com/media/09c9f65c88d427d77058ce3f5a3d2abe/href</a></iframe><p>You can find the previous URL shortener example in this<a href="https://github.com/dlozina/url-shortener-service-v2"> github repository</a>. There is nothing minimal about the codebase.</p><p>If we compare the old code to our minimal shortener, we will see the hidden complexity of the minimal API framework right away.</p><p>We start from scratch in the minimal API template and only introduce the dependencies we need. We can concentrate on the important stuff — the code for the requested feature.</p><p>Let’s analyse the code and see what new things come with .NET6 that you could start implementing in your services.</p><h3>⚙️ 3. <strong>Adding Dependencies</strong></h3><p>My service needs a database, so I’m adding a dependency to LiteDB.</p><pre>dotnet add package LiteDB</pre><p>Usually, we would go to <em>Startup.cs</em> and set up our dependency. Since we don’t have one, the way to go is shown below on line 2. Same code, in a different position.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d24b6083143d5673f28f40e1eb8bb007/href">https://medium.com/media/d24b6083143d5673f28f40e1eb8bb007/href</a></iframe><h3>🔗 4. Adding an Endpoint</h3><p>All the methods we need are in the app — or should I say framework?</p><ul><li><strong>MapGet(pattern, handler)</strong></li><li><strong>MapPost(pattern, handler)</strong></li><li><strong>MapPut(pattern, handler)</strong></li><li><strong>MapDelete(pattern, handler)</strong></li></ul><p>Check how to implement <strong>POST</strong> method and <strong>GET</strong> method in the example below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9cbfed6c69a606d8d904acc57393533/href">https://medium.com/media/e9cbfed6c69a606d8d904acc57393533/href</a></iframe><p>The first parameter is the route pattern, and the second parameter is the handler. The handler is delegate executed when the endpoint is matched.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97628756db6f380de7fb5451530629ee/href">https://medium.com/media/97628756db6f380de7fb5451530629ee/href</a></iframe><p>Url object is <strong>record</strong>, also something new in .NET6. It could be a class as well, but I just wanted to shred couple of lines of code to get those 26 magic lines.</p><p>Data that our <strong>POST</strong> method (body of req) needs to contain is<br>defined by the record. (It is enough to send <em>longURL</em>, id will be set automatically by our <em>db</em>)</p><p>We have our database in the list of services that our app uses. The next step is to inject it into the endpoint. The delegate needs to have our database context to add data from the client to the database.</p><p>In the end, set up your service address and port.<br>And you are done!</p><pre>app.Run(&quot;http://localhost:4000&quot;);</pre><h3>🙋 5. Where are using statements?</h3><p>Global using statements is another feature I am happy with.</p><p>Do you remember having something like this on top of every file in your project?</p><pre>using System;<br>using System.Reflection;<br>using System.Linq;<br>using System.Net.Http;<br>using System.Linq;</pre><p>Implicit usings are hidden in an auto-generated file inside the <em>obj</em> folder. That file declares global <em>using</em> statements behind the scenes. If you go to the project folder then to <em>obj/Debug/net6.0</em>, you will find a file titled <em>”{ProjectName}.GlobalUsings.g.cs”</em>.</p><p>Open this file, and see the content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8401df6166cee21357046c46409c743/href">https://medium.com/media/d8401df6166cee21357046c46409c743/href</a></iframe><p>Since this is an auto-generated file, we can’t edit it here.</p><p>In our minimal shortener, we have two packages (LiteDB, Hashids.net) that we depend upon, and we would need to place <em>using</em> statements in <em>Program.cs</em> to use code from these packages.</p><p>Instead, let’s manually create a file that will hold our global <em>using</em> statements. This way, we keep our <em>Program.cs</em> free from all using statements.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5463099ec70f7f737519ecdf6c94461/href">https://medium.com/media/a5463099ec70f7f737519ecdf6c94461/href</a></iframe><p>It might be overkill in this particular example, but imagine adding more dependencies. It is a good option for keeping code clean.</p><h3>🎊 So, is it possible? Of course! 🎊</h3><p>Most of the time, we don’t need all the ceremony that we got with previous .NET Web API templates.</p><p>Now, there’s the option to start from scratch and only add the stuff we really need. Missing MVC Controllers? No problem, add them later. Need Authentication? Same thing.</p><p>The template code has fewer files and a more intuitive setup for newcomers in the .NET world — this is probably one of the best benefits of this framework. I am really looking forward to seeing what future updates bring along.</p><p>If you enjoyed following along and building your own URL shortener in .NET6, keep an eye out for this blog!</p><p>In the next article, we will place this minimal URL Shortener in Docker and explore another essential piece of the tech stack.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52e110a07a25" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infobipdev/write-a-url-shortener-in-26-lines-of-code-with-net-minimal-apis-52e110a07a25">Write a URL Shortener in 26 Lines of Code with .NET Minimal APIs</a> was originally published in <a href="https://medium.com/infobipdev">Infobip Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Passwordless SMS Authentication 101 | Python Edition]]></title>
            <link>https://medium.com/infobipdev/passwordless-sms-authentication-101-python-edition-367af7cc1060?source=rss----97827c79af94---4</link>
            <guid isPermaLink="false">https://medium.com/p/367af7cc1060</guid>
            <category><![CDATA[2fa]]></category>
            <category><![CDATA[passwordless]]></category>
            <category><![CDATA[sms]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Aldin Kiselica]]></dc:creator>
            <pubDate>Fri, 19 Nov 2021 17:31:47 GMT</pubDate>
            <atom:updated>2025-08-04T07:09:32.163Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vZySLS4F7Ef9kGcQL20uUw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@kaip">Kai Pilger</a> on <a href="https://unsplash.com/collections/63896687/it-security">Unsplash</a></figcaption></figure><p>Imagine yourself logging into an application without being required to create and remember a password. Well, not much to imagine, right? We all did it at least once before. There are plenty of approaches on how to implement this. One of those approaches is by using passwordless SMS authentication.</p><h3>What is Passwordless SMS Authentication?</h3><p>Passwordless SMS Authentication enables application developers to offer authentication without having to remember login credentials. It allows users to enter their mobile device phone number to get a one-time code which can help them to log in.</p><p>With this user authentication technique, when, for example, a mobile user authenticates in an app for the first time, they are asked for their phone number. A one-time code is then sent from the developer’s server-side app to that phone number as an SMS text message. The user then enters the code into the app and they are authenticated.</p><p>Let’s say it’s the first time for a user to use the app. An account will be created for that user. If not, the user will be authenticated to use the unique ID assigned by the identity provider. The authentication code sent to the user’s phone number is not reusable, but it can only be used once, after which it expires. When the user visits the app again, a new code will be sent to their mobile phone number, which they can use to log in.</p><p>Thus, it will either:<br>- save your users from the need to remember account passwords, or<br>- add another level of security in case you want to use it as an add-on in the 2FA, 3FA, or MFA setup.</p><p>There are suitable use-cases for either approach.</p><h3>When (not) to use it?</h3><p>So, when and why should you use (or avoid) this mode of authentication?</p><p>I guess the answer to this question varies depending on what are you trying to achieve. There are more elegant ways and which significantly reduce the risk of fraudulent activities such as account takeover, and there are enough articles out there talking about how and why should you go with either alternative approach.</p><p>To keep it completely real, if you are seeking ultimate security, you might consider using SMS simply as one of the layers of your multi-factor authentication process. Or you might just say: nope, I want something else.</p><p>If you’re simply trying to do a simple integration that enables you to verify your user’s phone number or really anything that is not that safety-critical, then sure, jump on board — it’s easy to do it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TzC41aj_XWK5pZe7sEVMxw.png" /><figcaption>Copyright Infobip</figcaption></figure><p>Ok, by now you should kind of be aware of what it is, and what might be the benefits or potential pitfalls. I guess it is safe to proceed with a bit of hands-on and see how this actually works in practice.</p><h3>Passwordless SMS Authentication in Python</h3><p>In this section, we will be discussing one approach on how to implement this authentication technique.</p><p>Infobip platform offers you a solution that you can use to send authentication messages. It provides official API libraries for different (at the moment of writing: Java, C#, PHP, Python &amp; Go) programming languages.</p><p>You can find the list of various SDKs provided by this platform <a href="https://www.infobip.com/docs/sdk"><strong>here</strong></a>. All our API-related SDKs are open-source and made available on <a href="https://github.com/infobip?q=infobip-api-*-client&amp;type=&amp;language=&amp;sort="><strong>GitHub</strong></a>. To learn more about the platform, visit its <a href="https://www.infobip.com/docs/api"><strong>official documentation here</strong></a>. In this section, we will be demonstrating how to use the Infobip Python API library to send one-time passwords via SMS.</p><h4>Package installation</h4><p>First, you should install the<em> </em><strong><em>infobip-api-python-client</em></strong>. You can install it using Python’s pip package manager. Pip is shipped with Python, thus, you don’t have to install it if you have already installed Python.</p><p>Open the terminal of your operating system and run the following command:</p><blockquote>pip install infobip-api-python-client</blockquote><p>The command will install <strong><em>infobip-api-python-client</em></strong><em> </em>on your computer. You should get a success message similar to the one shown in the following image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pWG6NpNn4QUE0-aCQJtzUQ.png" /><figcaption>Installing infobip-api-python-client package via pip command</figcaption></figure><h4>Configuration</h4><p>Have you created an Infobip account? If not, please do so <a href="https://www.infobip.com/signup?signup_source=PasswordlessSMSAuthPython101"><strong>here</strong></a>, you’ll need one in order to follow this to the letter. The next step should involve configuration and authentication. To properly set the configuration, you need a specific URL and an API key (both is provided to you when the account is created). You can find both on the <a href="https://portal.infobip.com/"><strong>homepage</strong></a> of your account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J6K09dO8TxHQAAoGqtcNqw.png" /><figcaption>Portal homepage containing the API Base URL and API Key</figcaption></figure><p>To be able to use both of the above, simply click the <em>copy-to-clipboard</em> buttons and paste them into their proper locations in the config setup.</p><p>In order to initialize the Infobip 2FA API client and properly set the configuration for it, you should do the following.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6080e1f24cb9b56906cb49dbf99f4d4/href">https://medium.com/media/e6080e1f24cb9b56906cb49dbf99f4d4/href</a></iframe><p>Ensure that you substitute the right values of the various parameters in the above code. These include the API Base URL, the API Key, and the API Key prefix. For you to send the SMS successfully, these credentials MUST be correct.</p><p>While API Base URL and API Key you can simply copy from your account homepage, you have to set API Prefix manually. The reason behind this is that there are multiple authentication options, and you might choose not to use API Key but one of its alternatives. In case you chose to simply copy the key value available on your account, then you need to set the API Key Prefix value to <strong><em>App</em></strong>. That’s it, you are ready to make API calls to the Infobip platform.</p><h4>Application Setup</h4><p>Before being able to send one-time passwords you need to set up the application and message template.</p><p>The application represents the service you are using it for. It is recommended to have different applications configured for different use cases or services. That is done by invoking the <a href="https://www.infobip.com/docs/api#channels/sms/create-2fa-application"><strong><em>Create 2FA Application</em></strong></a><strong><em> </em></strong>endpoint. Python lib you previously installed does it like shown below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/527b29d85b0169062863592d808ca40d/href">https://medium.com/media/527b29d85b0169062863592d808ca40d/href</a></iframe><p>The last line reads the id of the created application so you can re-use it. Spoiler alert, you need it for the next step.</p><h4>Message Template Setup</h4><p>When the application is configured, you need to prepare the template for the message(s) you want to send. Let’s see an example of how can you design the message body and the password (PIN) placeholder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ca2c60c0b2f9debc4f734ab1506b92e/href">https://medium.com/media/7ca2c60c0b2f9debc4f734ab1506b92e/href</a></iframe><p>Similar to what you did in the previous chapter, now you read the id of the created message template. In order to actually send a password via SMS, we’ll need both of the IDs - application and message template.</p><h4>Sending SMS</h4><p>Now that you have set up the application and designed the message template, let’s send the code to the user via SMS. In order to do it, you can simply use the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db2bea48269d7a8ee3597c8fa9323244/href">https://medium.com/media/db2bea48269d7a8ee3597c8fa9323244/href</a></iframe><p>Note that after sending the password you checked whether the message was sent successfully, and also saved another id. This one is going to be used in order to verify the user to whom you sent the SMS message.</p><h4>Authentication Verification</h4><p>So, you configured everything and sent the password. But how do you know whether the proper password was used by the user?</p><p>Well, obviously you somehow have to offer the user a way to put the password you just sent to him. After he does it, you simply need to call the following and check whether the response says the user is verified.</p><p><a href="https://gist.github.com/kiselitza/85f89ee9f07dd0159aeebfff5e265b1a?file=verify_phone_number.py">https://gist.github.com/kiselitza/85f89ee9f07dd0159aeebfff5e265b1a?file=verify_phone_number.py</a></p><p>And if <strong><em>verified </em></strong>is true, that’s it —your user successfully authenticated himself.</p><h3>To conclude</h3><p>Passwordless SMS Authentication can be used in various cases. Where needed, it can help developers to authenticate users without requiring them to remember a password. In other cases, it can be used to provide an additional layer of security on top of the basic username-password authentication.</p><p>It’s really up to the application owner(s) to determine whether they need extra simplicity or extra security. This article is not going to go there, its sole purpose is to show you how easy it is to set it up.</p><p>Today we covered how it can be done via SMS, but Infobip also allows you to do utilize it via Voice and/or Email as well. Even Biometrics and something called Silent Mobile Verification are in play — more on it in one of the next articles.</p><p>Feel free to check this out and try it yourself after you <a href="https://www.infobip.com/signup?signup_source=PasswordlessSMSAuthPython101"><strong>create a trial account</strong></a> (needless to say; a free one). Unless you already have one, in which case you simply <a href="https://www.infobip.com/docs/api"><strong>go and play</strong></a> with it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=367af7cc1060" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infobipdev/passwordless-sms-authentication-101-python-edition-367af7cc1060">Passwordless SMS Authentication 101 | Python Edition</a> was originally published in <a href="https://medium.com/infobipdev">Infobip Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to schedule tasks in .NET?]]></title>
            <link>https://medium.com/infobipdev/how-to-schedule-tasks-in-net-c3fd6472b115?source=rss----97827c79af94---4</link>
            <guid isPermaLink="false">https://medium.com/p/c3fd6472b115</guid>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Dino Lozina]]></dc:creator>
            <pubDate>Thu, 18 Nov 2021 08:24:14 GMT</pubDate>
            <atom:updated>2021-11-18T08:27:44.871Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to schedule tasks in .NET? We’ve made it seem easy #2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJ-yxVWAMWRrWRCFPO3Cvg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@bradneathery?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Brad Neathery</a> on <a href="https://unsplash.com/s/photos/clock?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Welcome to the second part of the series about “URL shortener in .NET”. In the first post of this series we created simple URL shortener web service, and tested it manually with Postman. Check <a href="https://medium.com/infobipdev/how-to-write-url-shortener-in-net5-ec415d581fb8">part one</a> here or skip it if you only want to find out how to schedule services in .NET.</p><p>In part two, we want to expand functionality of our web service with some additional features, such as SMS reports.</p><p><strong>This post aims to show you:</strong></p><ul><li>How to send SMS</li><li>How to easily add scheduler to our web service</li><li>How to send SMS periodically</li></ul><p>Use my <a href="https://github.com/dlozina/url-shortener-service-v2">GitHub</a> to find a finished project and avoid the nuisance of writing the code yourself.</p><h3>📱 First Step: Send SMS ✔️</h3><p>For our SMS provider we will use Infobip. Please access our free trial self service account through this <a href="https://www.infobip.com/docs/api">link</a>. After grabbing our API key and URL you just need to implement client library in the project.</p><p>Library: (<a href="https://github.com/infobip/infobip-api-csharp-client">GitHub</a>)</p><pre>dotnet add package Infobip.Api.Client</pre><p>Then, place your user settings in <em>appsettings.json</em>, so that you can easily grab them through our web app.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5de2a45ad9e9e2a1a69d49f2b8ddc28/href">https://medium.com/media/f5de2a45ad9e9e2a1a69d49f2b8ddc28/href</a></iframe><p>Based on Infobip library, we will create method SendNotificationSms:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8a98a2596e73f9e421b033370ba266b/href">https://medium.com/media/e8a98a2596e73f9e421b033370ba266b/href</a></iframe><p>Let’s go through SendNotificationSms(string smsNotificationMessage).</p><ul><li>First, we set up the configuration we will send to SendSmsApi class.</li><li>Then create SmsTextualMessage by setting up Form, Destination and Text fields.</li><li>Finally, add created message to SmsAdvancedTextualRequest.</li></ul><p><em>SendSmsMessage</em> method from Infobip library will do the trick and send the message to our user:</p><pre>var smsResponse = sendSmsApi.SendSmsMessage(smsRequest);</pre><p>Now that the basic functionality is up and running, adding it to your scheduler shouldn’t be a problem.</p><h3>⏰ Second Step: Add scheduler ✔️</h3><p>For this feature we will use Quartz.NET.<br>One could describe Quartz.NET as a full-featured, open-source job-scheduling system.</p><p>There are two important points you need to know; Job Scheduling and Job Execution.</p><p><strong>1. Job Scheduling</strong></p><ul><li>Jobs are scheduled to run when a given trigger occurs, triggers support wide variety of scheduling options.</li></ul><p><strong>2. Job Execution</strong></p><ul><li>Jobs can be any .NET class that implements the simple IJob interface, leaving infinite possibilities for the work that jobs can perform.</li></ul><p>Lets’s add package to our project:</p><pre>dotnet add package Quartz.Extensions.Hosting</pre><p>Now, we have to configure and register our Quartz service. Use <em>Program.cs</em> for that. You can follow documentation <a href="https://www.quartz-scheduler.net/">https://www.quartz-scheduler.net/</a> on how to configure and register in detail.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/76b3e22af7575246dccb15178a37a907/href">https://medium.com/media/76b3e22af7575246dccb15178a37a907/href</a></iframe><p>In this code example, we try to keep <em>Program.cs</em> as short as possible, hence the extension method for our settings.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/26f708d0b7b0ba75f4ab20bf537e68b6/href">https://medium.com/media/26f708d0b7b0ba75f4ab20bf537e68b6/href</a></iframe><h3>⏲️ Third Step: Send SMS periodically ✔️</h3><p>Scheduler is all set up and now you need to add jobs. In our report feature we decided to send SMS messages daily, weekly and monthly.</p><p>Example <a href="https://github.com/dlozina/url-shortener-service-v2">project</a> has three jobs defined in project Jobs folder.</p><p>Remember:</p><blockquote><em>Jobs can be any .NET class that implements the simple </em><em>IJob interface.</em></blockquote><p>Example code below sends daily SMS report of how many URLs are shortened:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7073f29590cc3e23a2dfdc2826de9370/href">https://medium.com/media/7073f29590cc3e23a2dfdc2826de9370/href</a></iframe><p>You may ask yourself: Where is the scheduled time in this code? How can I change it?</p><p>Well…that is the beauty of Quartz — it uses Cron expression which is easy to set up.<br>For example, we have moved scheduler setup to our application settings, so there are separate settings for every job in our application.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/511c61678a414b87ecd303df11ffc345/href">https://medium.com/media/511c61678a414b87ecd303df11ffc345/href</a></iframe><p>You can check out for various settings on <a href="https://www.quartz-scheduler.net/documentation/quartz-3.x/tutorial/crontriggers.html">cron triggers</a></p><p>In our example:</p><ul><li>Cron expression: “0 0 8 ? * MON-SUN” -&gt; Daily — MON-SUN on 08:00 CET for the previous day</li><li>Cron expression: “0 1 8 ? * MON” -&gt; Weekly — MON on 08:01 CET for the past week</li><li>Cron expression: “0 2 8 * * MON#1” -&gt; Monthly — first MON on the month for the past month</li></ul><p>If you go back to <em>Program.cs</em> you will see how we grab and use this settings with our extension method.</p><p>Now our web service is ready to send scheduled reports to users.</p><h3>Conclusion 🎉 🍾</h3><p>It comes as no surprise that scheduling jobs in applications can be a really daunting work. Quartz makes it so much easier. Bare in mind that we just scratched the surface with our settings. There is a lot more stuff under the hood but probably this is enough for most of use cases.</p><p>The same thing can be said about our SMS notification feature. You don’t need to write API request to Infobip platform. Just add library to your .NET project, set config, create your message objects and than send an SMS. It is also possible to expand this simple example and send reports with other<br>information channels, such as Email and WhatsApp.<br>Find other available options on <a href="https://www.infobip.com/docs/api">Infobip Api</a>.</p><p>Stay well,</p><p>Dino</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3fd6472b115" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infobipdev/how-to-schedule-tasks-in-net-c3fd6472b115">How to schedule tasks in .NET?</a> was originally published in <a href="https://medium.com/infobipdev">Infobip Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t go OpenAPI first, go API first]]></title>
            <link>https://medium.com/infobipdev/dont-go-openapi-first-go-api-first-1a0775fc870f?source=rss----97827c79af94---4</link>
            <guid isPermaLink="false">https://medium.com/p/1a0775fc870f</guid>
            <category><![CDATA[infobip]]></category>
            <category><![CDATA[openapi-generator]]></category>
            <category><![CDATA[open-api]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Ivan Letenko]]></dc:creator>
            <pubDate>Wed, 17 Nov 2021 10:13:45 GMT</pubDate>
            <atom:updated>2021-11-17T11:31:34.405Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iJqCzjNEIEuva1wB" /><figcaption>Photo by <a href="https://unsplash.com/@ante_kante?utm_source=medium&amp;utm_medium=referral">Ante Hamersmit</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Despite the fact that API first approach has been around for many years, interest in it does not decrease and new articles are published.</p><p>There’s a lot of interest thanks to the popularity of microservices and distributed systems, as well as actively growing as-a-Service solutions and add-ons marketplaces where developers can build and publish their applications and APIs on top platform’s APIs.</p><p>Technical articles and presentations on API-first mainly focus on the technical implementation and use of certain tools, such as back-end code generation from<a href="https://www.openapis.org/"> OpenAPI specification</a>, as well as rising interest to <a href="https://www.asyncapi.com/">AsyncAPI specification</a> that brings standard to event-driven architectures.</p><p>However, I think it is important not to confuse goals and methods of achieving them; remember the basics of API first!</p><h3>What is API first?</h3><p>First of all, it is a development process and strategy.</p><p>Think about your API as a product for other developers even if it’s an internal service. Apply agile development principles to the API design and definition. This allows us to establish a contract for how the API is supposed to behave. This contract is crucial because it improves the interaction of developers and allows you to get a system consisting of a reusable, and extensible building blocks, which brings a great value for business.</p><p>An analogy is a test driven development (TDD), since it’s also API first approach. Start with an interface, and the test will be the first consumer of your API.</p><p>The API contract itself can be specified in various ways which depend on the specifics of project and context.</p><p>It could be an OpenAPI specification, request/response JSONs, or interfaces.</p><p>For example, at Infobip most of the services define their API through Java interfaces and data models, on the basis of which the OpenAPI specification is generated, if necessary.</p><p>If you are designing an API for a web or mobile client of your service, design it as a product for external clients in order to avoid situations when you need to develop separate APIs for every new use cases.</p><p>The benefits of an API first approach are similar to agile development processes:</p><ul><li>Fast feedback that allows you to make adjustments earlier while the cost of change is low;</li><li>No constraints inherited from wrong abstractions &amp; data models, you better understand customer needs by collaboratively discussing and adapting APIs;</li><li>Decoupling &amp; parallelisation of work, teams can work independently having a common source of truth in the form of an API contract.</li></ul><h3>What is code first?</h3><p>With a more traditional code first approach, the main functionality of the application is first developed and then an API for consumers and contributors is inserted on top of it.</p><p>This approach works well only for small APIs, mainly internal, when requirements are clear and stable.</p><h3>Tools &amp; Workshops We Use For 1600 Applications</h3><p>Let’s see briefly how we deal with internal &amp; external APIs at Infobip. Infobip is a global communication platform that consists of over 1600 applications (service types) with hundreds of databases, data pipelines and support systems. More than 80 engineering teams work on. We have about 20 products that expose public APIs. At this scale it is vital for us to have reliable tools that synchronize and standardize service interactions while maintaining flexibility and speed of development.</p><p>As I mentioned, most of our internal services are written in Java or Kotlin. They expose their APIs as Java interfaces (we call them “connectors”) and register them in home crafted remoting system. This system transparently builds HTTP APIs for inter-service communication. For non-JVM services we use sidecar pattern.</p><p>Dependent services can just import “connectors” and use them without worrying about implementation. In this way, the contract is defined and development is completely independent.</p><p>For APIs that should be exposed publicly we use a solution based on <a href="https://springdoc.org/">springdoc-openapi</a> that generates OpenAPI specification from Java/Kotlin classes. Non JVM services can expose OpenAPI specification by themselves on a dedicated endpoint. Thus, regardless of how the specification is created, it is a public contract.</p><p>From that specification we generated <a href="https://www.infobip.com/docs/api">public documentation</a> and <a href="https://www.infobip.com/docs/sdk">client libraries</a> using <a href="https://openapi-generator.tech/">OpenAPI Generator</a> based pipeline. Library generation also helps maintain the quality and stability of specifications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hwvklFWPN8QgKMTftZo1wA.png" /><figcaption>API docs &amp; libs generation flow</figcaption></figure><h3>What Works For Us At Infobip</h3><ul><li>Focus on API design before development;</li><li>Treat your API as a public product;</li><li>Tools &amp; workflows are secondary.</li></ul><p>In most cases, there is no need to dive into the complexity of OpenAPI right away.</p><p>OpenAPI has essentially become an industry standard and it is easy to use as a common language between components that guarantees interoperability and simplifies API management.</p><p>If you want to know more on this topic give some claps &amp; comments ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a0775fc870f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infobipdev/dont-go-openapi-first-go-api-first-1a0775fc870f">Don’t go OpenAPI first, go API first</a> was originally published in <a href="https://medium.com/infobipdev">Infobip Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to write URL shortener in .NET5?]]></title>
            <link>https://medium.com/infobipdev/how-to-write-url-shortener-in-net5-ec415d581fb8?source=rss----97827c79af94---4</link>
            <guid isPermaLink="false">https://medium.com/p/ec415d581fb8</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[begginer]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[dotnet]]></category>
            <dc:creator><![CDATA[Dino Lozina]]></dc:creator>
            <pubDate>Thu, 11 Nov 2021 09:08:17 GMT</pubDate>
            <atom:updated>2021-11-11T09:08:17.288Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to write URL shortener in .NET5? We’ve made it seem easy #1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*noNAPXiTjNJRaB9BLPmzow.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@emilep?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Emile Perron</a> on <a href="https://unsplash.com/s/photos/developer-working?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Welcome to our tutorial series, a place to be for those looking for a quick and efficient guide to writing URL shortener.</p><p>In this series we will try to show you how easy it is to write a service that shortens URLs with .NET5. On top of that, we will add an additional functionality — service will have to send an SMS when target URL is shortened and periodically send SMS reports.</p><p>Stick with me until the end and you will learn how to:</p><ul><li>Create youtube like links for short URLs</li><li>Use embedded NoSQL database</li><li>Schedule web service, ex. send reports every day, week and/or month</li><li>Send SMS from our service</li></ul><p>Just to give you heads up, this is by no means an extensive tutorial on how to build production grade shortening systems. For production grade systems we need to take in to account scale and load. It would be nice to have some kind of analytics, but we have to start from somewhere, right?</p><p>Software engineering nowadays can be compared to playing with LEGO bricks. All the nice bricks are out there, we need to implement them in a smart way. We don’t want to reinvent the wheel every time we start programming, so we’re going to use a couple of packages to make all this magic happen.</p><p>First, we’re going to need some SDK-s and tools:</p><ul><li>For IDE we can use (<a href="https://code.visualstudio.com/">https://code.visualstudio.com/</a>)</li><li>We need .NET core SDK (<a href="https://dotnet.microsoft.com/download">https://dotnet.microsoft.com/download</a>)</li><li>Postman (<a href="https://www.postman.com/downloads/">https://www.postman.com/downloads/</a>)</li></ul><p>On my <a href="https://github.com/dlozina/url-shortener-service-v2">github</a> you will find the finished project so there’s no need for you to write code yourself.</p><p>Once we have .NET framework in place we will just check if everything is working for us with (type in terminal):</p><pre>dotnet --version</pre><p>After the test we can create our template project:</p><pre>dotnet new webapi -n &quot;Shortener.Service&quot; -lang &quot;C#&quot; -au none</pre><p>*<em>parameter -au none means there is no default authentication for our webapi</em></p><p>With this command we get template webapi project. Now that we have all things up and running let’s start with step by step guide.</p><h3>🎮 First Step: Create controller methods ✔️</h3><p>Remove default web api controller and create your own. For this simple example we will have one GET and one POST method.</p><p>Let’s dig into POST method. User will provide us with URL (simple UrlDataDto object) that needs to be shortened. We will store that URL we will store in LiteDB.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3994368b71d98e92e26a3680b1add26/href">https://medium.com/media/c3994368b71d98e92e26a3680b1add26/href</a></iframe><p>GET method needs a parameter shortUrl. If we have that shortUrl in our database, method will redirect us to “long” URL if request was made by browser. Request could also be made by “thin” client like Postman, so we will make sure that we return JSON with “long” URL. (In that case we don’t want to redirect)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/12027a05d0ed2ca3fef4c7acbd7681d7/href">https://medium.com/media/12027a05d0ed2ca3fef4c7acbd7681d7/href</a></iframe><h3>💾 Second Step: Add database ✔️</h3><p>As mentioned, we need DB to store our shortened URLs. For this small service we really don’t want to install DB or do something beforehand. Goal is just to “press play” and our app is ready to go.</p><pre>dotnet add package LiteDB</pre><p>This will give us small NoSql database, perfect for our proof of concept.</p><p>Now we need to link our application with DB:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82b2c7ee20aa3fa9f6e663c2b340e397/href">https://medium.com/media/82b2c7ee20aa3fa9f6e663c2b340e397/href</a></iframe><h3>⚙️ Third Step: Add services ✔️</h3><p>As you can see, our controller is simple and whole business logic is in services. Let’s just check what we did in services.</p><p>First of all, let’s create service that will write data to our DB.</p><p>Add to DB:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e9763623ba4ec9dca3163dfffd2d00c/href">https://medium.com/media/5e9763623ba4ec9dca3163dfffd2d00c/href</a></iframe><p>Get from DB:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89251c337b40a52055c445516e11baf5/href">https://medium.com/media/89251c337b40a52055c445516e11baf5/href</a></iframe><p>We need logic that will shorten our URL. For this we can use cool package Hashids.net and get youtube like short ids. We can chose length and “salt” for our links. Check out <a href="https://github.com/ullmark/hashids.net">hashids.net</a> for short instructions.</p><p>For example, if we sent UrlDataDto:</p><pre>{<br>  &quot;url&quot;: &quot;https://www.infobip.com/docs/api&quot;<br>}</pre><p>We get in response nice youtube-like short links:</p><pre>{<br>  &quot;url&quot;: &quot;http://localhost:8000/V1oExr&quot;<br>}</pre><p>Let’s add this feature:</p><pre>dotnet add package Hashids.net</pre><p>Method in service for encode:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/734a8a20fe55c4dcc21871ca6aa08235/href">https://medium.com/media/734a8a20fe55c4dcc21871ca6aa08235/href</a></iframe><p>As you can see, we will encode DB id and generate our short URL from that data. (We will use this service in POST method)</p><p>Method in service for decode:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13bfcc365be01ed9a922a01121024dfe/href">https://medium.com/media/13bfcc365be01ed9a922a01121024dfe/href</a></iframe><p>Vice versa, on the other endpoint (our GET method) we will decode shortUrl to get id.</p><h3>🧪 Fourth Step: Test with Postman ✔️</h3><p>After dotnet build and dotnet run commands you are all set for manual test! Postman collections for you will find as part of the project, so that you can easily import.</p><p>POST:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/753/0*-MTTl2VThO3Iifai.png" /></figure><p>GET:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/0*z-0brQKH1EuLi7uA.png" /></figure><h3>That’s all, folks! Or is it? 🎉 🍾</h3><p>In part one of this series, we have created a simple URL shortener. We’ve showed you how to save data without installing database and generate short URLs with Hashids.net.</p><p>Application passed our manual test with Postman, and we have set up stage to implement notifications in our web service.</p><p>In part two of this series, we will learn how to:</p><ul><li>Schedule tasks in .NET applications</li><li>Send SMS via Infobip platform</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec415d581fb8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infobipdev/how-to-write-url-shortener-in-net5-ec415d581fb8">How to write URL shortener in .NET5?</a> was originally published in <a href="https://medium.com/infobipdev">Infobip Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Infobip WebRTC — A Quick Setup & Test Guide]]></title>
            <link>https://medium.com/infobipdev/infobip-web-rtc-a-quick-setup-test-guide-d9672d1f328e?source=rss----97827c79af94---4</link>
            <guid isPermaLink="false">https://medium.com/p/d9672d1f328e</guid>
            <category><![CDATA[webrtc]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Adnan]]></dc:creator>
            <pubDate>Wed, 10 Nov 2021 08:06:34 GMT</pubDate>
            <atom:updated>2021-11-10T08:10:06.704Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Infobip WebRTC — A Quick Setup &amp; Test Guide</strong></h3><p>You know the usual developer drill — you sit down, ideas come and go, you filter the ones that work and write it all in a single go? Erm, not really!</p><p>When we start writing new software, there is always the stage of planning and deliberating about which technologies to use and which dependencies can help us make the best software for our use-cases and potential clients. This is where having the right tool is crucial for making the best decisions. If you are looking to integrate real-time communications into your application, we already have one of those tools in mind for you.</p><h3>Why integrate RTC into your application in the first place?</h3><p>You might ask yourself “Why would I use WebRTC anyway? Can’t I just call someone over the phone?”. Sure you can, but think about the different scenarios that could happen and the platform that could address them all. For instance, if you want to show someone a certain product or let them check something from a distance, you can use video calls over WebRTC to provide this service. Or let’s say you’re out on the road and you’ve just had an accident which you need to report to your supervisor. With WebRTC this could be as easy as having a two-minute video call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l8BjJY1ejiCr6LTlLCSLhQ.png" /></figure><h4>Communicate across devices with multiple participants</h4><p>By using WebRTC you can also employ many other devices, not just mobile phones, for your communication needs. If there is an office employee contacting multiple colleagues that work on the terrain, he or she can sit at their computer and still talk to the colleagues using their phones. If there’s a need to talk to multiple people at once, WebRTC will make it happen quick and easy via the conferencing feature.</p><h4>Record calls and keep track of communications</h4><p>Recording calls, be it 1-on-1 or conference, is something not only useful, but also sometimes required by regulatory measures. With WebRTC you can choose to record your calls whenever you want and keep track of your communications when needed.</p><p>All of the above shows that with WebRTC you can harness the true power of your communications, implement more communication channels, and make the life of your clients and employees easier. If you want to test it out yourself, we’ve prepared a detailed setup guide. To be able to follow this showcase setup, please login to <a href="https://portal.infobip.com/">Infobip Portal</a>.</p><h3>What is Infobip RTC Showcase?</h3><p>The Infobip RTC Showcase is a collection of simple apps implementing our Web and In-app Calls communication channel using WebRTC. These apps enable you to setup a simple WebRTC app and test its features out on your own, even change the code and experiment.</p><p>The following app examples are present in our showcase:</p><ul><li>Kotlin</li><li>Swift</li><li>React Native</li><li>Angular</li><li>jQuery</li><li>React</li></ul><p>Considering the main purpose of this app, you will also notice that the user interface is basic. This enables everyone to easily change the code in a matter of minutes and test out new things if they are interested.</p><figure><img alt="Basic user interface of Infobip RTC Showcase application with some text, an input box, and 7 buttons" src="https://cdn-images-1.medium.com/max/720/1*vN5O6UIO9IBWs1krMXg7kQ.png" /><figcaption>Infobip RTC simple user interface</figcaption></figure><p>Of course, if you are going to use the RTC Showcase and integrate WebRTC into your own app in the future, you will need to fulfil some prerequisites.</p><h3>What to Know Before You Start?</h3><p>To be able to use Infobip RTC Showcase, you first need to have certain things installed:</p><ul><li>Node.js</li><li>Java, version 12</li></ul><p>Next, you will have to set up the token application for the showcase applications. The token application is used to fetch the Infobip token you need for authenticating your identity when accessing Infobip’s backend. Here you have two options, depending on the technology you want to test out with the showcase.</p><h4>JavaScript Token Application</h4><p>To be able to run the JavaScript-based token application, you will need to add a <strong>config.json</strong> file to the <strong>token/node</strong> folder with the following structure:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48770e4336198d02a3de51e73a794928/href">https://medium.com/media/48770e4336198d02a3de51e73a794928/href</a></iframe><p>The <strong>HTTP_PORT</strong>, <strong>INFOBIP_API_HOST</strong>, and <strong>INFOBIP_RTC_TOKEN_PATH</strong> parameters are used to set the port on which your token app will run, and the host and path from which your token will be fetched. These values will be the same for everyone using our RTC showcase, although you can freely change the <strong>HTTP_PORT</strong> if the predefined port is taken. To be able to use the new port for the token application, do not forget to change the port in every respective application to the new one.</p><p>The more important parts of this config file are <strong>INFOBIP_API_KEY</strong> and <strong>INFOBIP_APP_ID</strong>. You can get both values from the <a href="https://portal.infobip.com/">Infobip Portal</a> after you have logged in into your account.</p><ul><li>To get <strong>INFOBIP_API_KEY</strong> you will need to access the “Manage API keys” site from the Portal dashboard (<a href="https://portal.infobip.com/settings/accounts/api-keys">Manage API keys</a>) and copy your chosen API key into the config.json file</li><li>To get <strong>INFOBIP_APP_ID</strong> you will need to access the “Apps &gt; Web and In-App Calls &gt; Applications” site (<a href="https://portal.infobip.com/apps/webrtc/">My Applications</a>) and copy your chosen APP ID into the config.json file</li></ul><p>When you have filled out the required information in the config.json file, you will need to do two more steps with the token application before you are ready to go onto the showcase applications. First go to the <strong>token/node</strong> folder through your terminal/command prompt and then:</p><ul><li>Run <strong>npm install</strong>, which will install the packages needed for the token application</li><li>Run <strong>npm start</strong>, which will start the application on <a href="http://localhost:8080/"><strong>http://localhost:8080</strong></a> (If you have not changed the port in the config.json file)</li></ul><p>Now you can start running and experimenting with the showcase applications that can be found in the <strong>js/</strong> folder, but if you want to be sure that the token application is running, you can run</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2dd4ff8bc9dea4c0d49a24a0dfcc1ad3/href">https://medium.com/media/2dd4ff8bc9dea4c0d49a24a0dfcc1ad3/href</a></iframe><p>If your token application is running, this will return a JSON object like the following</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/295516bfff76c20e0632a3c6c3ddaf57/href">https://medium.com/media/295516bfff76c20e0632a3c6c3ddaf57/href</a></iframe><h4>Java Token Application</h4><p>To be able to run the Java-based token application, you will need to add two environment variables with the values for <strong>INFOBIP_API_KEY</strong> and <strong>INFOBIP_APP_ID</strong>. You can add the environment variables in several ways depending on the operating system you are using, and which approach you prefer. To set the environment variables through the terminal/command prompt:</p><ul><li>For Unix-like operating systems (Mac OS and GNU+Linux)</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2dd318600d99d7dd3001e40d7f58aefc/href">https://medium.com/media/2dd318600d99d7dd3001e40d7f58aefc/href</a></iframe><ul><li>For Windows operating systems</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/73f6156988e9e09b2210224be09b26e3/href">https://medium.com/media/73f6156988e9e09b2210224be09b26e3/href</a></iframe><p>If we look at <strong>token/java/src/main/resources/application.yml</strong>, where you will find the following code</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/789a74f60cd27c4295bb8de7e9ed0cd7/href">https://medium.com/media/789a74f60cd27c4295bb8de7e9ed0cd7/href</a></iframe><p>We will see that we can also easily change the <strong>HTTP_PORT</strong> value if needed. We just need to set the <strong>HTTP_PORT</strong> environment variable on our system, and our token application will prioritize that value.</p><p>After setting up the environment variables, we just need to run the following command from inside the <strong>token/java</strong> folder:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3adf1e8ea94011a1f9e15d462f3fccdc/href">https://medium.com/media/3adf1e8ea94011a1f9e15d462f3fccdc/href</a></iframe><p>This will start the token application which is built with the Java Spring Boot framework. We can check if our token application is up and running by using the same command as the last time</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2dd4ff8bc9dea4c0d49a24a0dfcc1ad3/href">https://medium.com/media/2dd4ff8bc9dea4c0d49a24a0dfcc1ad3/href</a></iframe><p>If your token application is running, this will also return a JSON object like the last time</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/295516bfff76c20e0632a3c6c3ddaf57/href">https://medium.com/media/295516bfff76c20e0632a3c6c3ddaf57/href</a></iframe><p><strong>Keep in mind:</strong> If you want to run both token applications at the same time, you will need to change the <strong>HTTP_PORT</strong> value for at least one of them.</p><h3>Showcase Applications</h3><p>Showcase applications will use the token application to authenticate users on Infobip platform, so be sure to set up the token applications correctly before continuing.</p><h4>Change Needed Configurations</h4><p>If you have changed the <strong>HTTP_PORT</strong> inside the token application’s configuration, you will first need to change the port for the token application inside showcase applications from 8080 to your preferred port.</p><p>Also, if you want to change the ports that the JavaScript-based showcase applications are using, you can do that by:</p><ul><li><strong>jQuery<br></strong>Changing the <strong>HTTP_PORT</strong> value in <strong>js/jquery/app.js</strong> from 8010 to your preferred port</li><li><strong>React<br></strong>Changing the <strong>PORT</strong> value in <strong>js/react/package.json</strong> from 8020 to your preferred port</li><li><strong>Angular<br></strong>Changing the <strong>port</strong> option in the ng serve command in <strong>js/angular/package.json</strong> from 8030 to your preferred port</li></ul><h4>Add Google Services to Android Showcase Applications</h4><p>To be able to receive notifications on incoming calls from Infobip showcase applications, you will need to add a Firebase configuration file to the app (step 3 <a href="https://firebase.google.com/docs/android/setup">here</a>) named <strong>google-services.json</strong> to the app.</p><p>Depending on the project, you will need to add the <strong>google-services.json</strong> file in a different place:</p><ul><li><strong>Android Kotlin<br></strong>Add the <strong>google-services.json</strong> file to <strong>android/kotlin/infobip-rtc-showcase-android</strong></li><li><strong>React Native<br></strong>Add the <strong>google-services.json</strong> file to <strong>react_native/android/app</strong></li></ul><p>Here you can also make sure that you add the correct path to the Android SDK (Software Development Kit) on your computer on the React Native showcase application. You can set this in <strong>react_native/android/local.properties</strong> on the <strong>sdk.dir</strong> property.</p><h4>Running JavaScript-based Showcase Applications</h4><p>If you have gotten to this step and the token application inside <strong>token/node</strong> or <strong>token/java</strong> is running, then the following is straight forward. You just need to navigate to the folder for the chosen technology (be it jQuery, React, or Angular) and run the following</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a85b1b08279cf9bd9ff063c3bd9868b4/href">https://medium.com/media/a85b1b08279cf9bd9ff063c3bd9868b4/href</a></iframe><p>This will install and then run the application on the preferred port, which you can then access through your browser. To simply test out the application, you can start up two browser tabs and call the other user from one tab.</p><p><strong>Keep in mind:</strong> If you are running the React or Angular applications, the page will reload automatically if you make any edits. You will also be able to see any lint errors in the console.</p><h4>Running Mobile Showcase Applications</h4><p>You can run the Android Kotlin and iOS Swift showcase applications as any other application through their respective IDEs (Android Studio and XCode) in the emulator. There is a known issue with receiving push notifications for incoming calls on subsequent runs on the emulator on all three mobile showcase applications (React Native, Kotlin, and Swift). This can be solved by wiping data from the emulator before running it again.</p><p>You can also run the app on a real device, although you will need access to the token application from the device itself. You can enable this by using the <strong>ngrok</strong> command, which allows you to expose your local port on the whole network. The following command will enable this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/abb0cd1d550b93ae892b2f740ec2e351/href">https://medium.com/media/abb0cd1d550b93ae892b2f740ec2e351/href</a></iframe><p>Here you can also choose the preferred port to expose the token application.</p><p>Unlike the Kotlin and Swift showcase applications, the React Native application will require you to do one more step. Run the following inside the <strong>react_native</strong> directory:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e1eb59465c4ab672ae4f5c4806a6a622/href">https://medium.com/media/e1eb59465c4ab672ae4f5c4806a6a622/href</a></iframe><p>or you can also use yarn:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/338df40956f918305794ec5c105791e5/href">https://medium.com/media/338df40956f918305794ec5c105791e5/href</a></iframe><p>The commands do the following:</p><ul><li>Install needed dependencies</li><li>Start the application</li><li>Run the application on an Android emulator or your connected phone</li></ul><p><strong>Keep in mind:</strong> You can use either npm or yarn to run this application, but it is advised not to mix package managers to avoid resolution inconsistencies.</p><h3>That’s it. You’re ready to go!</h3><p>For now, through the RTC Showcase applications you can look at:</p><ul><li>1-on-1 audio and video calls through WebRTC</li><li>Sharing your screen during the call</li><li>Calling a phone number using WebRTC</li><li>Joining conferences with audio and video</li><li>Sharing your screen during conferences</li></ul><p>If you want to learn more about Web and In-Application Calls, you can visit <a href="https://www.infobip.com/docs/voice-and-video/webrtc">Infobip’s Voice and Video documentation for WebRTC</a>.</p><p>Check if you already have access to our WebRTC Demo applications and try out the newest features over there:</p><ul><li><a href="https://webrtc-demo.infobip.com/">Browser application</a></li><li><a href="https://play.google.com/store/apps/details?id=com.infobip.webrtc.demo.android">Android application</a></li><li><a href="https://apps.apple.com/us/app/infobip-webrtc/id1469234824">iOS application</a></li></ul><p>To enable Web and In-App Calls, contact your dedicated Account Manager or our <a href="https://www.infobip.com/contact">Sales</a> team.</p><p>When you are ready to start integrating our SDKs into your own application, you are more than welcome to look at the reference documentation for various SDKs:</p><ul><li><a href="https://github.com/infobip/infobip-rtc-js/wiki">JavaScript SDK</a></li><li><a href="https://github.com/infobip/infobip-rtc-android/wiki">Android SDK</a></li><li><a href="https://github.com/infobip/infobip-rtc-ios/wiki">iOS SDK</a></li><li><a href="https://github.com/infobip/infobip-rtc-react-native/wiki">React Native SDK</a></li></ul><p>If you have any questions, we’d be happy to hear from You <a href="https://www.infobip.com/contact"><strong>here</strong></a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9672d1f328e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infobipdev/infobip-web-rtc-a-quick-setup-test-guide-d9672d1f328e">Infobip WebRTC — A Quick Setup &amp; Test Guide</a> was originally published in <a href="https://medium.com/infobipdev">Infobip Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Email collections under GDPR — The right way]]></title>
            <link>https://medium.com/infobipdev/email-collections-under-gdpr-the-right-way2-6587ea967e7a?source=rss----97827c79af94---4</link>
            <guid isPermaLink="false">https://medium.com/p/6587ea967e7a</guid>
            <dc:creator><![CDATA[Ivan Burazin]]></dc:creator>
            <pubDate>Mon, 01 Nov 2021 11:54:39 GMT</pubDate>
            <atom:updated>2022-01-04T11:41:58.626Z</atom:updated>
            <content:encoded><![CDATA[<h3>Email collections under GDPR — The right way</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KAhk-JV9neqnF2j1h3_YUQ.png" /></figure><p>You’re a certain someone who works on development of a client-oriented technical solution(s)? You probably want to have the best ways to communicate to those who are consuming your services in a robust way and scale it easily? If that’s all you then keep reading.</p><p>This article has plenty of non-developer essential angles of email marketing covered, yet it emphasizes the need of conveying your messages properly. If you’re not that interested in high-level why’s and how’s, but still are looking for the best solution (platform, APIs, SDK, portal, etc.) then I’d suggest you jump straight to the solution we linked for you below and start playing with it.</p><h3>What is email marketing and why should you care?</h3><p>In earlier years it was possible to collect and use consumer data with little restrictions (if any). Lately, however, with all the data privacy topics being in the focus it is now a service provider who must be careful on how is he approaching service consumers.</p><p>With email marketing, you can create long-lasting connections with your consumers. It’s the process of sending commercial emails to those on your list who have given permission for us to contact them through email by subscribing — and people love getting <strong>great</strong> offers!</p><p>An example campaign would include an automated message sent at 9 AM every morning reminding customers about some exciting deals happening now only available via this link which will take 10 minutes off their purchase time — what are they waiting for!?</p><p>When it comes to small companies, it is one of the most cost-effective options. It’s critical to realize that a large part of your success is entirely dependent on the email marketing software you select since they are ultimately responsible for ensuring that your emails get sent. If you’re not cautious, you’ll find yourself paying much more for fewer marketing options and poor email deliverability rates.</p><p>If you are looking for a reliable email solution, look no further than <a href="https://www.infobip.com/docs/api#channels/email"><strong>Infobip</strong></a>. Infobip platform handles plenty of communication channels, and email is just one of them. Check how simple it is to incorporate our solution into your product and choose for yourself if it meets all of your requirements. Our <a href="https://www.infobip.com/signup?signup_source=BlogMediumEmail2021Nov01"><strong>free trial</strong></a> will assist you in familiarizing yourself with our solution, understanding integration, and recognizing the best possibilities with our solution.</p><h3>How much do you need to worry about GDPR?</h3><p>General Data Protection Regulation (GDPR) is a new set of European Union regulations governing the handling of personal data. Due to the constant development of the digital world, the GDPR is intended to bring prior data protection regulations up to date. It is designed to improve data protection inside the EU by implementing rules (and fines!) regarding personal data processing, acquisition, and storage.</p><p>The GDPR applies to your business if it processes, saves, or utilizes the personal data of EU people. Personal data includes email addresses, names, phone numbers, and behavioral data about your consumers. It is critical to remember that the rules apply to personal data transferred beyond the EU (to the US, for example).</p><p>Businesses may send email marketing to people only if the following conditions are met:</p><ul><li>The person has expressly agreed.</li><li>They are a current client who purchased a comparable service or product and was provided with an easy method to opt-out.</li></ul><p>The rise of social media has changed the way we interact with brands. In many cases, companies will send customers emails without their permission because they haven’t unsubscribed from marketing lists or opted out — even if you don’t want the communication! The best thing a person can do is check your inbox for any unsolicited messages and make sure that nobody else could have access to it either — only signing up using one email address should be enough protection against bad actors trying too hard to sell everything all at once… but let’s face it: Most people just end up clicking “yes” anyways; whether on purpose or not doesn’t really matter as long as there isn’t an Automated Response waiting.</p><p>To be acceptable, however, they must have been provided a clear and simple option to opt out. This should be made available when their first data is taken and should be included in any future messages delivered.</p><p>This regulation implies that, although information may be given to current customers by email or text, it does not apply to new contacts or prospective consumers. Additionally, it does not apply to any promotional activity that is not commercial, such as political campaigning or charity fundraising.</p><h3>Why is the Subscriber’s consent important?</h3><p>The GDPR imposes strict requirements on how you get, record, and maintain permission for marketing communications. In reality, this implies that people providing you with their email address must express permission actively and openly before you may send them emails.</p><p>Consent must be provided voluntarily. This implies that it cannot be accomplished via the use of a pre-ticked box. Apart from that, explicit permission is essential. This means that the client must understand what they are signing up for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*327mfhBn0cpoVmgH" /></figure><p>Take note that if you are contacted, you must provide evidence of the permission provided. It is critical, then, that you maintain a record of all consents granted by your subscribers.</p><p>You may send emails without obtaining permission. Rather than relying on consent, you may claim that you distribute newsletters to further your company’s legitimate interests. However, and this is critical, the individual you are sending emails to should have some connection with you, such as having purchased one of your goods. It is up to each business to choose which approach is most appropriate for them — whether via consent or legitimate interests — and ensure compliance with the GDPR.</p><h3>Email Marketing After GDPR implementation</h3><p>Email marketing is a popular kind of advertising that was formerly very simple to deploy. However, with the implementation of GDPR, there is another area that needs careful attention.</p><p>For example, businesses must get express permission from their contacts before continuing to send them emails. This necessitates a more rigorous membership procedure that includes a double opt-in and an easy opt-out option and prohibits forced or compelled opt-ins.</p><p>A double opt-in verifies that users want to receive emails, filtering out fraudulent or negligent requests (for example, a user’s failure to uncheck an automatically selected subscription box). If a customer gives their email address for a subscription, they will be required to consent to it a second time in their email.</p><p>The need for double opt-in serves as a safeguard for businesses that send promotional emails. Anybody subscribing to your emails should do so freely and without feeling compelled to do so in exchange for a specific product or service. Additionally, they should be able to unsubscribe from your email list at any moment without suffering any consequences.</p><h3>To conclude</h3><p>Well, we discussed that GDPR refocused marketers on established email best practices, further strengthening marketing campaigns for those already committed to providing superior customer experiences.</p><p>Now, these similar standards and guidelines advise subscribers how they will hear from you and how they want to communicate with you. As we’ve seen, this puts your marketing efforts in an ideal position to connect with a genuinely engaged audience, enabling you to deliver high-performing messages that impact your revenue. As marketers, we can now target and plan with more zeal, laser-focused on the information we have about our consumers. Now, their expectations have the potential to impact our companies significantly.</p><p>Moreover, using the right platforms can help create robust email solutions for their services, which helps in creating highly interactive email newsletters quickly and easily with robust solutions.</p><p>Feel free to sign up for our <a href="https://www.infobip.com/signup?signup_source=BlogMediumEmail2021Nov01"><strong>trial</strong></a> account to test out how we solve communication challenges! There you can experience how to integrate <a href="https://www.infobip.com/docs"><strong>Infobip</strong></a> communication platform into your technical solution(s) and how it might help you expand the business.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6587ea967e7a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infobipdev/email-collections-under-gdpr-the-right-way2-6587ea967e7a">Email collections under GDPR — The right way</a> was originally published in <a href="https://medium.com/infobipdev">Infobip Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s Talk About Executing and Caching Queries with React Apollo]]></title>
            <link>https://medium.com/infobipdev/lets-talk-about-executing-and-caching-queries-with-react-apollo-3752d8f33399?source=rss----97827c79af94---4</link>
            <guid isPermaLink="false">https://medium.com/p/3752d8f33399</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Danko Šimunović]]></dc:creator>
            <pubDate>Wed, 27 Oct 2021 16:02:25 GMT</pubDate>
            <atom:updated>2021-10-27T16:02:24.991Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iBorynnt0joMwqHJHavY8g.jpeg" /></figure><p>Yep, you’ve guessed it. We’re going to talk about queries.</p><p>Let’s start with basics. The useQuery React hook is the primary API for executing queries when using Apollo Client in React. To run a query within a React component, we call the useQuery and pass it a GraphQL query string. When the component renders, useQuery returns an object from Apollo Client that contains loading, error, and data properties.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9f07cc3c0f27ef690d1dd8fcfe9e37d/href">https://medium.com/media/c9f07cc3c0f27ef690d1dd8fcfe9e37d/href</a></iframe><p>Apollo Query component is a deprecated way of executing queries. It’s a part of @apollo/react-components package and it is implementing Render props pattern. Render props are used for sharing code between React components using a prop whose value is a function. A component with a render prop takes a function that returns a React element. The component then calls this function instead of implementing its own render logic. In the case of Query component, we are using the <strong>children</strong> prop as a render prop. But because the children prop doesn’t need to be named in the list of “attributes”, you can put it directly inside the element. In the following example, we are passing a query prop, which is required.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aec4c6dc158338b8a7f038b6b779fece/href">https://medium.com/media/aec4c6dc158338b8a7f038b6b779fece/href</a></iframe><p>Internally, Query component actually uses the useQuery hook and then calls the render props function with results returned from the hook. This means that we’re using the same options and are getting the same result object as when using the useQuery hook.</p><h3>Cache-first, Ask Questions Later</h3><p>Apollo is locally caching results for the queries by default. This makes subsequent executions of the same query extremely fast. This is called <strong>cache-first</strong> policy. We can define fetch policy on query level.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f4bf55d791aceb41113a5d9b0c49ecb/href">https://medium.com/media/0f4bf55d791aceb41113a5d9b0c49ecb/href</a></iframe><p>These are 6 supported fetch policies:</p><ul><li><strong>cache-first</strong>: This is the default fetch policy. If data is present in the cache, that data is returned. Otherwise, a query is executed against the GraphQL server and the data is returned after it is cached.</li><li><strong>cache-only</strong>: Query is only executed against the cache. GraphQL server is never called.</li><li><strong>cache-and-network</strong>: If data is present in the cache, that data is returned. But even then, a query is executed against the GraphQL server. If the response differs from what is stored in the cache, it will update the cache.</li><li><strong>network-only</strong>: Query is executed against the GraphQL server, without first checking the cache. The query’s result is stored in the cache in case the same query with a different fetch policy is being made elsewhere in the application.</li><li><strong>no-cache</strong>: Behaves like network-only, except the query’s result is not stored in the cache.</li><li><strong>standby</strong>: Behaves like cache-first, except this query does not automatically update when underlying field values change. You have to update it manually.</li></ul><p>There is also a possibility to define <strong>nextFetchPolicy</strong> option. This way, you can define fetch policy for the first query execution using <strong>fetchPolicy</strong> and then you can define fetch policy for the subsequent executions with <strong>nextFetchPolicy</strong>.</p><h3>Apollo Client Behind the Scenes</h3><p>Apollo Client acts as a facade to the underlying cached data. Behind the scenes, Apollo normalizes the data by splitting the results into individual objects and assigns a unique identifier to each object. These objects are stored in a flattened structure. Apollo then exposes an API to interact with the cached data. By minimizing direct access to the actual data using the facade/API, Apollo can normalize data under the hood.</p><p>Apollo can <strong>automatically update cache</strong> for:</p><ul><li>Queries</li><li>Mutations that update a single existing entity</li><li>Bulk update mutations that return the entire set of changed items</li></ul><p>Of course, there are use cases in which we have to <strong>manually update the cache</strong>:</p><ul><li>Application-specific side-effects (something that happens after the mutation, but does not use data returned from the mutation)</li><li>Update operations that add, remove, or reorder items in a cached collection</li></ul><h3>Manually Updating Cached Data</h3><p>Apollo supports multiple ways of reading and writing cached data:</p><ul><li>readQuery / writeQuery</li><li>readFragment / writeFragment</li><li>cache.modify</li></ul><p>With readQuery method, it is possible to run GraphQL queries directly on the local cache. If the cache contains all of the data necessary to execute a specified query, readQuery returns a data object in the shape of the query, just like a GraphQL server does. If some fields are missing from the cache, null is returned. Using writeQuery we can write arbitrary data to the cache for the specific query. It looks similar to readQuery, but it accepts data option.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/65509f5648938453bfcd00f31720f6b3/href">https://medium.com/media/65509f5648938453bfcd00f31720f6b3/href</a></iframe><p>Using fragments it is possible to read or update only parts of the cached data, unlike readQuery / writeQuery methods, which require a complete query. When using fragments to interact with cache, we can use readFragment / writeFragment methods. They require id option, which represents the unique identifier that was assigned to the object in the cache. By default, this identifier has the format &lt;_typename&gt;:&lt;id&gt;, but this can be customized. If there is no object with the specified ID, readFragment returns null. writeFramgent accepts data option, which represents data that will be written for the specified object and that conforms to the specified fragment.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/991bc86ae29b2ae323328f32763640b7/href">https://medium.com/media/991bc86ae29b2ae323328f32763640b7/href</a></iframe><p>With cache.modify it is possible to directly modify cached fields. This method requires the ID of the cached object to modify and a modifier function for each field to modify.</p><p>It is important to emphasize that any changes made with these methods are not pushed to the GraphQL server. If the current page is refreshed, these changes will disappear. Also, all methods trigger a refresh of all active queries that depend on modified fields.</p><h3>Two Strategies for Updating the Cached Results</h3><p>Besides manually rewriting cached data, there are two strategies for updating the cached results: <strong>polling</strong> and <strong>refetching</strong>.</p><p>With polling, we execute the query periodically at a specified interval.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed9cb045316424c63575f1abe37bc908/href">https://medium.com/media/ed9cb045316424c63575f1abe37bc908/href</a></iframe><p>Refetching is done by using refetch function that enables us to re-execute the query.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e8150d1d71f254e169fc4713ae1c254/href">https://medium.com/media/9e8150d1d71f254e169fc4713ae1c254/href</a></iframe><h3>Apollo Client is a Powerful Caching Machine</h3><p>In conclusion, one would have to agree that Apollo Client is a mighty caching machine. It’s equipped with a powerful caching mechanism that makes it easy to execute data queries quickly and efficiently. However, to make better use of its caching possibilities, one should get familiar with various methods of interacting with cache, cache setup and configuration.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3752d8f33399" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infobipdev/lets-talk-about-executing-and-caching-queries-with-react-apollo-3752d8f33399">Let’s Talk About Executing and Caching Queries with React Apollo</a> was originally published in <a href="https://medium.com/infobipdev">Infobip Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I am a code-monkey and so are you]]></title>
            <link>https://medium.com/infobipdev/i-am-a-code-monkey-and-so-are-you-f4803d9869aa?source=rss----97827c79af94---4</link>
            <guid isPermaLink="false">https://medium.com/p/f4803d9869aa</guid>
            <category><![CDATA[code-monkey]]></category>
            <dc:creator><![CDATA[Zoran Rubinić]]></dc:creator>
            <pubDate>Wed, 29 Sep 2021 07:00:16 GMT</pubDate>
            <atom:updated>2021-09-29T07:00:16.579Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*lqKWVOqh--1YI27RJcMM7g.jpeg" /></figure><p>We have all been code monkeys. And yes, I admit — I was the monkey too. And now I am the monkey sometimes, code-monkey that is.</p><p>But what is a code-monkey? Is it a person, a role, or a strategy?</p><p>It is a programmer with a simple and basic skill set, according to <a href="https://www.techopedia.com/definition/31469/code-monkey">Techopedia</a>,. It’s the first step after you finish your education in IT and you get your first job as a software developer.</p><p>Now, I am a software engineer with 14+ experience in the industry and I look back to that time of the beginning when everything was simple.</p><p>I didn’t have to think about the whole mechanism and how it will work, just one simple gear at a time. It was a time when I have entered the world of professional software development with very little knowledge of anything but the programming language I worked with (C# Love), an entry-level code-monkey some would say. I could focus on my for… loops, my class naming, etc.</p><p>If I had any questions, the “Engineers” had all the answers and the Senior Engineers were like Masters of their craft. When they lift a finger the solution appeared in front of you. And I was like ‘I wanna be you…’ and it happened, after many many highs and lows and years.</p><p>Today I think about mechanisms, systems, concepts, patterns, designs, and coding is the last thing on to-do list for any solution. I love that. I love being an engineer but it is far more than lifting a finger. I have to bleed and also do the monkey code dance.</p><p>Everybody in the development community has heard about the concept “Release early, release often”.</p><p>In one of my previous jobs, the humans responsible for company vision had a “new” vision, a new application that could sky rock us high in earnings but we had to be quick, we had to prove that idea is good. The plan was to make a few basic killer features the app has to offer, release it and get some paying customers. A typical startup story. We (the team) were excited and started working on the app’s architectural design. Then it happened. The architect weighted in: We needed to think about security, data storage, hosting, scaling, UX, etc.</p><p>Short story: we didn’t release the app early. In fact, we didn’t release it at all. We overengineered the damn thing. Sure, the junior developer who said to hardcode all we could and forget the concepts was WRONG, what a monkey!</p><p>We need both code-monkeys and engineers in development teams.</p><p>The natural path of learning and evolving as a software developer would be code-monkey (or junior) becoming an engineer. But how do we become engineers if we do only simple tasks with a basic skillset? We don’t, we expand our skillset all the time. Learning new technologies, new design patterns, new solutions to our problems. So if we are doing that from the beginning aren’t we also engineers? I think we are.</p><p>We are both; code-monkeys and engineers all the time because after we think about big peace, big scope, big ideas, solutions we come down to little parts where we use our simple skillset to make them work.</p><p>When we are pressed by our managers to fix a bug, it’s always in a hurry, always some kind of fire we need to put out. Fix it now.. We’ll rewrite it like we should… later! Come on, when do we honestly rewrite something if it works? Even in situations when everything is burning around us, we have to try to predict what could happen and how it will work down in the chain.</p><p>Only then we can call ourselves “Engineers”. However, correcting that crucial buggy for…loop that started all the mess could be the time when you use the code-monkey.</p><p>«Code-monkey» is not a role, it is a strategy, a tool that you use in a day to do focused coding tasks.</p><p>This strategy is used after everything else is completed, the assessment, the diagrams, the planning, the engineering work, and the only thing is left is to code it, make it happen.</p><p>Experienced software engineers would say “that’s the easy part”, even a monkey could do it — but we do it. All of us, juniors, seniors, architects — no monkeys.</p><p>When I don’t want to do a task break down, don’t want to talk to people, don’t want to think about the whole system, and just want to work on good explained task and write code. It’s is my time for a Code-Monkey!</p><p>My question to you is: Are you a code-monkey?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4803d9869aa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infobipdev/i-am-a-code-monkey-and-so-are-you-f4803d9869aa">I am a code-monkey and so are you</a> was originally published in <a href="https://medium.com/infobipdev">Infobip Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>