<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ruslan&#39;s Tech Blog</title>
    <link>https://blog.bekenev.net/tags/api.html</link>
    <description>Software development related stuff</description>
    <language>en-us</language>
    <lastBuildDate>Mon, 28 Nov 2022 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.bekenev.net/tags/api/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Facebook webhooks won&#39;t accept Ngrok and Localtunnel anymore</title>
      <link>https://blog.bekenev.net/2022/11/28/facebook-webhooks.html</link>
      <pubDate>Mon, 28 Nov 2022 00:00:00 +0000</pubDate>
      <guid>https://blog.bekenev.net/2022/11/28/facebook-webhooks.html</guid>
      <description>&lt;p&gt;If you want to test webhooks locally you probably use Ngrok or Localtunnel. I do.&lt;/p&gt;&#xA;&lt;p&gt;Recently I wanted to play with Instagram webhooks and I couldn&amp;rsquo;t because surprisingly&#xA;Facebook do not accept Ngrok and Localtunnel URLs anymore and marks them as&#xA;&lt;code&gt;malicious and/or abusive&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I don&amp;rsquo;t really understand why Facebook blocked the only known solutions of local webhooks testing.&lt;/p&gt;&#xA;&lt;p&gt;Fortunately I have a server and a domain name.&lt;/p&gt;&#xA;&lt;h2 id=&#34;solution&#34;&gt;Solution&lt;/h2&gt;&#xA;&lt;p&gt;What we&amp;rsquo;ll need:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Nginx&lt;/li&gt;&#xA;&lt;li&gt;LetsEncrypt cert (because Facebook wants HTTPS URL)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;As soon as you configured your Nginx and it can accept traffic on port 443&#xA;add &lt;code&gt;location&lt;/code&gt; section like this (&lt;strong&gt;pay attention to all the slashes. They are important&lt;/strong&gt;):&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;location /proxy/ {&#xA;  proxy_pass http://localhost:3000/;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will grab all the traffic to &lt;code&gt;you-domain/proxy/&lt;/code&gt;, decrypt it and proxy it to port 3000.&lt;/p&gt;&#xA;&lt;p&gt;Now, on you local machine, run:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;ssh -R 3000:0.0.0.0:3000 -N user@server&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Change ports as needed. The very first &lt;code&gt;3000&lt;/code&gt; is remote port to redirect traffic from.&#xA;The &lt;code&gt;0.0.0.0:3000&lt;/code&gt; part is your local server listening on port &lt;code&gt;3000&lt;/code&gt; as well.&lt;/p&gt;&#xA;&lt;p&gt;You local server will get URLs without that &lt;code&gt;/proxy&lt;/code&gt; part.&#xA;So &lt;code&gt;your-domain/proxy/webhooks&lt;/code&gt; will be transformed to &lt;code&gt;0.0.0.0:3000/webhooks&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now the traffic goes like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;Origin(https) -&amp;gt; your-domain(https) -&amp;gt; your-server:3000(http) -&amp;gt; your-local-machine:3000(http)&lt;/code&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Ebay API and Platform Notifications</title>
      <link>https://blog.bekenev.net/2018/11/02/ebay-api-issues.html</link>
      <pubDate>Fri, 02 Nov 2018 00:00:00 +0000</pubDate>
      <guid>https://blog.bekenev.net/2018/11/02/ebay-api-issues.html</guid>
      <description>&lt;p&gt;If your web site isn&amp;rsquo;t receiving the notifications from Ebay even though you have everything configured AND &lt;strong&gt;you&amp;rsquo;re using oAuth tokens&lt;/strong&gt; for &lt;code&gt;SetNotificationsPreferences&lt;/code&gt; request then you have nothing to do except contact the Ebay support.&lt;/p&gt;&#xA;&lt;p&gt;Currently they have a special &lt;strong&gt;whitelist&lt;/strong&gt; where they have to add your &lt;code&gt;APP ID&lt;/code&gt; and the only way to add your app to that &lt;strong&gt;whitelist&lt;/strong&gt; is to contact them.&#xA;You can actually try to post a thread on their forum, but in this case you have to wait while someone form ebay staff will notice it.&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately the Support costs money and the price is &lt;strong&gt;$75/hour&lt;/strong&gt;. Good news is they are not billing you for the request to whitelist your app so you can spend that hour for something else.&lt;/p&gt;&#xA;</description>
    </item>
  </channel>
</rss>
