Integrating Amplitude with Reteno

Amplitude is a platform to collect app events, visualize data as graphs, and then analyze them in a user-friendly interface.

You can easily automate the simultaneous streaming of users and events from your app to Amplitude and Reteno.

Setting Up Integration

To integrate Amplitude with Reteno, you must create destinations, where Reteno will receive the data from Amplitude.

Create three destinations:

  • For receiving anonymous users with Amplitude IDs (device IDs)
  • For enriching user data with emails, languages, countries, etc.
  • For receiving events that will be matched with users by Amplitude IDs

Creating Destination

  1. In Amplitude Data, select the Destination tab from the Connections drop list and click Add Destination.
Amplitude Destinations page with the Destinations menu item highlighted, listing three webhook destinations and an Add Destination button
  1. Enter Webhook in the search field and click the Webhook tab.
Amplitude Destinations catalog with webhook entered in the search field, showing the Webhook option under Event Streaming
  1. Enter the Sync Name and click Create Sync.
Amplitude Add New Webhook Sync page with an empty Sync Name field and a disabled Create Sync button

Setting Destination for Anonymous Users

  1. Enter the https://mobile-api.reteno.com/api/v1/device endpoint in the Webhook URL field.
Amplitude Destination for Anonymous Users settings with the Webhook URL field highlighted, showing https://mobile-api.reteno.c
  1. In Headers, create and fill in the following fields:

    • authorization — your basic authorization token,
    • accept — the value from the endpoint requirements,
    • x-reteno-sdk-version — amplitude-device,
    • x-reteno-access-key — your access key.
    Amplitude Destination settings Headers section with the authorization, accept, x-reteno-sdk-version, and x-reteno-access fields highlighted
  2. Deactivate the Send Events switcher and activate the Send Users switcher.

Amplitude Destination settings with the Send Events toggle disabled and the Send Users toggle enabled, both highlighted
  1. Open the Define user payload dropdown list and choose the Customize payload radio button. Paste the code in the following format to it:
{  
    \<#if input.device_id??>  
      "deviceId": "${input.device_id}",  
    \</#if>  
    \<#if input.device_id??>  
      "externalUserId": "${input.user_id}",  
    \</#if>  
    \<#if input.os_name??>  
      "osType": "${input.os_name?upper_case}",  
    \</#if>  
    \<#if input.version_name??>  
      "appVersion": "${input.version_name}",  
    \</#if>  
    \<#if input.os_version??>  
      "osVersion": "${input.os_version}",  
    \</#if>  
    \<#if input.device_model??>  
      "deviceModel": "${input.device_model}",  
    \</#if>  
  "category": "MOBILE"  
}
šŸ“˜

Note

  • The "category": "MOBILE" is the hard-coded mandatory parameter.
  • Use upper_case in the osType parameter code.
  • Use amplitude_id as your externalUserId in the SDK settings:
  1. Click Save.

As a result of the request, an anonymous user will be created in your Reteno account.

Reteno contact information page showing a newly created anonymous contact with empty fields and included in 1 segment

To enrich data about such a user, create the next destination.

Setting Destination for Enriching User Data

  1. Enter the https://api.reteno.com/api/v1/contact endpoint in the Webhook URL field.
Amplitude Destination for Anonymous Users settings with the Webhook URL field highlighted, showing https://api.reteno.c
  1. Copy the authorization and the accept headers from the Add/update a contact page
Reteno API documentation for Add/update a contact with the accept and authorization headers highlighted in the cURL example

and paste them into the corresponding Destination fields.

Amplitude Destination settings with the authorization and accept header fields highlighted
  1. Deactivate the Send Events switcher and activate the Send Users switcher.

  2. Open the Define user payload dropdown list and choose the Customize payload radio button. Below, you can see the example of the request, where IDs are IDs of custom user fields from your Reteno account:

{  
  "fields": [  
    {  
      "id": 513758,  
      "value": "${input.user_id!}"  
    },  
    {  
      "id": 513759,  
      "value": "${input.language!}"  
    },  
    {  
      "id": 513760,  
      "value": "${input.country!}"  
    },  
    {  
      "id": 513761,  
      "value": "${input.region!}"  
    },  
    {  
      "id": 513762,  
      "value": "${input.city!}"  
    },  
    {  
      "id": 513763,  
      "value": "${input.device_type!}"  
    },  
    {  
      "id": 513764,  
      "value": "${input.os_version!}"  
    },  
    {  
      "id": 513765,  
      "value": "${input.version_name!}"  
    },  
    {  
      "id": 513766,  
      "value": "${input.platform!}"  
    },  
    {  
      "id": 513767,  
      "value": "${input.library!}"  
    },  
    {  
      "id": 513769,  
      "value": "${input.device_carrier!}"  
    },  
    {  
      "id": 513770,  
      "value": "${input.device_id!}"  
    },  
    {  
      "id": 514043,  
      "value": "${input.user_properties.subscription_product!}"  
    },  
    {  
      "id": 514044,  
      "value": "${input.user_properties.subscription_state!}"  
    },  
    {  
      "id": 514045,  
      "value": "${input.user_properties.has_subscription!}"  
    }  
  ],  
  "channels": [  
    {  
      "device": {  
        "appId": "vcfc4f0e-z891-355b-aea3-107f2f18e6ds"  
      },  
      "type": "email",  
      "value": "${input.user_properties.email!}"  
    }  
  ],  
    "externalCustomerId": "${input.user_id!}"  
}
  1. Click Save.

As a result of the request, the profile of an anonymous user will be enriched in your Reteno account.

To get event data, create the next destination.

Setting Destination for Events

  1. Enter the https://api.reteno.com/api/v3/eventendpoint in the Webhook URL field.
Amplitude Destination settings for test 3 with the Webhook URL field highlighted
  1. Copy the authorization and the accept headers from the Generate event v3 Reteno page
Reteno API documentation for Generate event v2 with the accept and authorization headers highlighted in the cURL example

and paste them into the corresponding Destination fields.

Amplitude Destination settings with the Select & filter events section expanded showing All Events highlighted
  1. Set up event parameters’ compliance.

For example, we want to get user IDs from Amplitude. In Amplitude, the name of this parameter is input.amplitude_id, and in Reteno — externalCustomerId. The request example for sending events will be as follows:

{  
  "eventTypeKey": "${input.event_type!}",  
  "params": \[  
    \<#if input.amplitude_id??>  
      {"name": "externalCustomerId", "value": "${input.user_id}"}  
    \</#if>  
    \<#list [  
        "parameter_1",  
        "parameter_2",  
        "parameter_3"...  
      ] as param>  
      \<#if input.event_properties[param]??>  
        , {"name": "${param}", "value": "${input.event_properties[param]}"}  
      \</#if>  
    \</#list>  
    \<#list [  
        "$parameter1",  
        "$parameter2,  
        "$parameter3"...  
      ] as param>  
      \<#if input[param]??>  
        , {"name": "${param}", "value": "${input[param]}"}  
      \</#if>  
    \</#list>  
  ]  
}
šŸ“˜

Note

Pass all unique event parameters in the request.

More on FreeMarker Templating Language >

  1. Open the Select & filter events and choose All events or select events you want to transfer from the list.
Amplitude Destination settings with the Select & filter events section expanded showing All Events highlighted
  1. Disable the User updates are not sent to Webhook option.
Amplitude Destination settings with the Send Users 'User updates are not sent to Webhook' option highlighted
  1. Click Save.

Send the test event and go to your Reteno account → Automation → Event history.

Reteno navigation with the Automation menu and Event history tab highlighted, showing the empty event history table headers

After clicking the test event, you should see the parameters’ values from the event.

{
  "params": [
    {
      "name": "externalCustomerId",
      "value": "765711983372"
    }
  ]
}

More on Amplitude’s Webhook Event Streaming >


Did this page help you?