# emico/magento-2-robinhq

> Magento 2 module for RobinHQ integration. Provides API endpoints for RobinHQ dynamic API

`composer require emico/magento-2-robinhq`

Canonical URL: https://packagento.com/emico/magento-2-robinhq

## At a glance

- **Vendor**: emico (https://packagento.com/emico.md)
- **Latest version**: 5.1.0 — released 2025-12-10
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/emico/magento-2-robinhq and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require emico/magento-2-robinhq:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Magento 2 module for RobinHQ integration. Provides API endpoints for RobinHQ dynamic API

## README

[![Build Status](https://travis-ci.com/EmicoEcommerce/Magento2RobinHq.svg?branch=master)](https://travis-ci.com/EmicoEcommerce/Magento2RobinHq)

Provides API integrations with the RobinHQ platform / dashboards

### Installation
Prerequisites
 - Magento 2.4.4 or higher
 - PHP 8.0 or higher

Install package using composer
```sh
composer require emico/magento-2-robinhq
```

Run installers
```sh
php bin/magento setup:upgrade
```

### Dynamic API

This module provides 5 endpoints for the RobinHQ dynamic API integration.
This endpoints are called directly from within the RobinHQ dashboard, providing the latest up to date information from Magento.

The following endpoints are available:
 - /robinhq/api/customer?email=`$EmailAddress`
 - /robinhq/api/customerOrders?email=`$EmailAddress`
 - /robinhq/api/order?orderNumber=`$Id`
 - /robinhq/api/search?searchTerm=`$Expression`
 - /robinhq/api/lifetime?email=`$Email`
   
Those are accessible from the root of your magento domain. http://my.shop.nl/robinhq/api/customer

To enable the dynamic API functionality you have to enable it in the configuration.

`Stores` -> `Configuration` -> `Emico` -> `RobinHQ` -> `Enable dynamic API`

##### Authentication

The authentication of the dynamic API is done by a pre shared key which must be communicated to RobinHQ.

You can define an API key and secret in the RobinHQ configuration.

When issueing requests to the dynamic API endpoint you have to include a Basic authentication header.
The value you have to sent is a base64-encoding of `{apiKey}:{apiSecret}`.

For example you have set up API key to `abc` and API secret to `def`.
The value would be `base64(abc:def)`, which resolves to `YWJjOmRlZg==`.
The full authorization header is:
`Authorization: Basic YWJjOmRlZg==`

##### Customize panelview and detailview

Some endpoints provide the possibility to provide custom data in the Robin dashboards.

For example when retrieving customer details using `/robinhq/api/customer` the following payload is returned.

```
{
    "naam": "Robin Doe",
    ...
    "panel_view": {
        "street": "Lovinklaan 1",
        ...
        "my_customfield1": "234",
        "loyalty_card_number": "1265645456"
    }
}
```

You can simply add custom attributes to these views in the configuration.
`Stores` -> `Configuration` -> `Emico` -> `RobinHQ` -> `Custom Attributes` section.

When you need even more control or implement your own bussiness logic you can implement the interfaces `DetailViewProviderInterface` or `CustomerPanelViewProviderInterface`.

For example:
```
namespace MyVendor\MyModule;

class MyPanelViewProvider implements CustomerPanelViewProviderInterface
{
    public function getData(CustomerInterface $customer): array
    {
        return [
            'my_custom_field' => 'some value'
        ]
    }
}
```

Register in your `di.xml`

```
<virtualType name="Emico\RobinHq\DataProvider\PanelView\CustomerPanelViewProvider" type="Emico\RobinHq\DataProvider\PanelView\AggregateProvider">
    <arguments>
        <argument name="providers" xsi:type="array">
            <item name="mydata" xsi:type="object">MyVendor\MyModule\MyPanelViewProvider</item>
        </argument>
    </arguments>
</virtualType>
```

### Dynamic API POST requests

For complete integration with Robin dynamic API the Magento module needs to issue POST requests to the RobinHQ platform.

For this functionality to work correctly it is mandatory to have a working RabbitMQ instance. You can read more about setting this up in the [Magento documentation](https://devdocs.magento.com/guides/v2.3/install-gde/prereq/install-rabbitmq.html).

Use the following command to process the message queue:
`bin/magento queue:consumers:start EmicoRobinHq`

You can configure this in a cronjob or preferably using supervisor.

### Frontend widgets

This module provides a widget to display the RobinHQ tracking script on your website.
This makes it possible to gain insight into all products viewed by the customer and the contents of the shopping cart.
Should work out of the box with the default Luma theme.

See: https://developers.cm.com/mobile-service-cloud/docs/viewed-products

To enable this feature you have to enable it in the configuration.

`Stores` -> `Configuration` -> `Emico` -> `RobinHQ` -> `Enable viewed products tracking`

## Recent Versions

| Version | Released |
|---|---|
| 5.1.0 | 2025-12-10 |
| 5.0.1 | 2025-05-06 |
| 5.0.0 | 2025-05-06 |
| 4.1.4 | 2024-09-17 |
| 4.1.3 | 2024-04-16 |
| 4.1.2 | 2024-03-19 |
| 4.1.1 | 2024-03-19 |
| 4.1.0 | 2024-03-19 |
| 4.0.0 | 2024-03-13 |
| 3.0.0 | 2024-02-21 |

Showing 10 of 50 versions. Full release history on https://packagento.com/emico/magento-2-robinhq.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| emico/robinhq-lib | ^5.0 |
| ext-json | * |
| laminas/laminas-diactoros | ^2.0\|^3.0 |
| magento/framework | 101.*\|102.*\|103.* |
| magento/module-catalog | 102.*\|103.*\|104.* |
| magento/module-config | 101.* |
| magento/module-customer | 101.*\|102.*\|103.* |
| magento/module-sales | 101.*\|102.*\|103.* |
| php | >=8.0 <=8.5 |
| webmozart/assert | ^1.4 |

### Require (dev)

| Package | Constraint |
|---|---|
| codeception/codeception | ^5.1 |
| mockery/mockery | ^1.6 |

### Suggest

| Package | Constraint |
|---|---|
| magento/framework-message-queue | Use Magento AMQP queuing for POST requests. Highly recommended |
| magento/module-message-queue | Use Magento AMQP queuing for POST requests. Highly recommended |

## Quality

Latest release (5.1.0) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | not tested |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Fail | 142 | 6 errors, 136 warnings (ruleset: Magento2) — 112 auto-fixable with phpcbf |
| PHPMD | Warning | 3 | 3 rule violations (MissingImport:2, IfStatementAssignment:1) |
| Cpd | Pass | 0 |  |
| Composer validate | Pass | 0 |  |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 10 | 10 | – | – |
| 2.4.8 | – | 10 | 10 | – |
| 2.4.9 | – | – | 10 | N/A |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["emico/magento-2-robinhq"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

emico is a Magento 2 vendor on Packagento. See https://packagento.com/emico.md for their full catalogue.

