<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pierre on Medium]]></title>
        <description><![CDATA[Stories by Pierre on Medium]]></description>
        <link>https://medium.com/@pierrejolly?source=rss-933588e91cce------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Pierre on Medium</title>
            <link>https://medium.com/@pierrejolly?source=rss-933588e91cce------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 16:54:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pierrejolly/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Connecting Akeneo PIM to Slack using the Events API]]></title>
            <link>https://medium.com/akeneo-labs/connecting-the-pim-to-slack-using-the-event-api-2a4dd9157fc8?source=rss-933588e91cce------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a4dd9157fc8</guid>
            <dc:creator><![CDATA[Pierre]]></dc:creator>
            <pubDate>Mon, 10 May 2021 12:10:04 GMT</pubDate>
            <atom:updated>2021-06-01T10:51:10.943Z</atom:updated>
            <content:encoded><![CDATA[<p>This year, as a new practice in the Akeneo API Team, we’ve decided to take some time to explore new subjects and experiment around use cases of our own features, following the <a href="https://en.wikipedia.org/wiki/Eating_your_own_dog_food">Eating your own dog food</a> principle.</p><p>As a first subject, we looked into the possibility of using the new <a href="https://api.akeneo.com/events-documentation/introduction.html">Events API</a> to connect Akeneo PIM to Slack, and be notified when a product is created or updated.</p><p>In this article, we’ll show how you can do it for your own PIM.</p><h3>Configuring the PIM</h3><h4>Add a connection</h4><p>First, you’ll have to create a connection. What is a Connection in Akeneo PIM? Well, in a few words, a connection can be defined as a door to the PIM. It allows you to push or pull data from and into the PIM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/0*3k0y_mGXlvqbn5Qa" /></figure><p>To configure this new connection, you can read the following article of Akeneo PIM documentation: <a href="https://help.akeneo.com/pim/serenity/articles/manage-your-connections.html#create-a-connection">create a connection</a></p><h4>Enable Event subscription</h4><p>Then you will have to configure the subscription and define where the webhook will be sent: <a href="https://api.akeneo.com/getting-started/quick-start-my-first-webhook-5x/welcome.html">How to connect a PIM event subscription to your own app</a></p><p>At this point, you should have checked with <a href="https://api.akeneo.com/getting-started/quick-start-my-first-webhook-5x/step-1.html">mockbin that the subscription is working</a></p><h3>Create a Connector</h3><h4>Creating a new Symfony application</h4><p>Now that we have a PIM connection configured to send webhooks we will have to create an application to receive these messages and send them to slack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*sluVkj0bc8M0fP6rf_3k7g.png" /><figcaption>Here is an overview of the resulting application</figcaption></figure><h4>Listen for events from the PIM and check the Webhook request signature</h4><p>To bootstrap a Symfony application you can check the following article, <a href="https://api.akeneo.com/getting-started/quick-start-my-first-webhook-5x/step-2.html">create your own Symfony app to display event subscriptions data</a></p><h4>Add Symfony Notifier component</h4><p>To communicate with Slack, we decided to use a new feature: <a href="https://symfony.com/doc/current/notifier.html">Symfony Notifier</a>, which was introduced as experimental in Symfony 5.0</p><p>The Notifier component in Symfony provides a dynamic way to send messages to users using many channels (e.g. SMS, Slack messages, emails, push notifications, etc.).</p><p>To use it with your connector application, you will have to add it as a dependency using the following composer command:</p><pre>composer require symfony/notifier</pre><p>You will also need to add the module corresponding to the channel you want to use. For this project, we will use the Slack module, you can add it to your project with this command:</p><pre>composer require symfony/slack-notifier</pre><p>And then, you’ll have to configure how to contact slack with the following configuration extract:</p><pre># config/packages/notifier.yaml<br>framework:<br>	notifier:<br>		chatter_transports:<br>			slack: ‘slack://TOKEN@default?channel=CHANNEL‘</pre><p>You will have to replace these values:</p><ul><li>TOKEN: we’ll see how to create it in the next step</li><li>CHANNEL: the Slack channel in which the messages will appear</li></ul><h4>Build a formatted message and send it to Slack</h4><p>We can now build a message for each event received, and send them to Slack</p><pre>&lt;?php</pre><pre>declare(strict_types=1);</pre><pre>namespace App\\Controller;</pre><pre>use Psr\\Log\\LoggerInterface;<br>use Symfony\\Component\\HttpFoundation\\Request;<br>use Symfony\\Component\\HttpFoundation\\Response;<br>use Symfony\\Component\\Notifier\\ChatterInterface;<br>use Symfony\\Component\\Notifier\\Message\\ChatMessage;</pre><pre>class WebhookController<br>{<br>    public function post(<br>        Request $request,<br>        LoggerInterface $logger,<br>        ChatterInterface $chatter<br>    ): Response {<br>        // Check signature<br>        // ...</pre><pre>// Build and send messages<br>        $eventsContent = json_decode($request-&gt;getContent());<br>        foreach ($eventsContent-&gt;events as $event) {<br>            $eventType = $event-&gt;action;<br>            $chatMessage = new ChatMessage();<br>            $chatter-&gt;send($chatMessage);<br>        }<br>    }<br>}</pre><h3>Configure Slack</h3><h4>Create and configure an application</h4><p>Go to <a href="https://api.slack.com/apps">https://api.slack.com/apps</a> and create a new App.</p><p>Choose a name and a Workspace for your App, then you should be redirected to the “Basic Information” page, scroll down until you see “App-Level Tokens” and generate a Token for your app</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W3e7RvZvpuT4Wrgw" /></figure><p>Once the token is generated, don’t forget to add it to your SF connector application (in config/packages/notifier.yaml).</p><p>You can also make your bot prettier thanks to the Display Information panel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iRoY69Vb0F9-oQ_V" /></figure><h3>Enjoy 🎉</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/0*jeIaP8ZpXsj3GVLw" /></figure><h3>Having issues?</h3><p>Take a look at our <a href="https://help.akeneo.com/pim/serenity/articles/manage-event-subscription.html#debug">how to debug event API</a> article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a4dd9157fc8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/akeneo-labs/connecting-the-pim-to-slack-using-the-event-api-2a4dd9157fc8">Connecting Akeneo PIM to Slack using the Events API</a> was originally published in <a href="https://medium.com/akeneo-labs">Akeneo Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>