Setting Up Birdeye
M
Written by Matt Panton
Updated over a week ago

Introduction

The Birdeye integration allows you to send "Check In" events to Birdeye, when an order is returned to the customer in SMRT. Birdeye will then send review requests automatically, either over Email or SMS depending on the customer's preference in SMRT.

Prerequisites

You need a Birdeye account, with an active campaign automation. Please contact your Birdeye Representative for how to set this up.

You will also need access to a Birdeye API key. Please refer to this guide for how to get access to an API Key: https://support.birdeye.com/s/article/Where-can-I-find-the-API-key-for-my-account

Lastly, you will also need a Segment account, that you've connected SMRT as a source. Please follow this guide if you haven't done so: https://support.smrtsystems.com/hc/en-us/articles/115010091648-Setting-Up-Segment

Store Location Setup

For each store you with to capture reviews for, you'll need to copy its Location ID into the SMRT External Store Identifier field. Please follow the steps below for each of your stores.

1. Open up your Birdeye account.

2. Go to settings

3. highlight your location, and copy the long number (Location ID) highlighted in red for the store location:

step_1.png

4. Open up the stations configuration in SMRT under Settings => Stations

5. Press the cogwheel next to the name of the store you're configuring

6. The below popup will appear. Insert the Location ID from step 3 into the external store identifier as seen below, and press save:

step_2.png

Repeat for each store. You have now associated the stores in SMRT with locations in Birdeye.

Segment Birdeye Integration

Segment doesn't come with a Birdeye integration out of the box. As such, SMRT has created one. The code for it is listed at the bottom of this page. Follow the steps below, to setup this integration for your segment account.

1. Sign in to your segment workspace at https://app.segment.com/ , and go to connections => catalog => functions => new function as shown in below screenshot:

step_3.png

2. Select function type "Destination" and press "Build" in the bottom right:

step_4.png

3. Paste the code at the bottom of this guide under Integration Code, into the source code editor on the left side of the screen as shown in the screenshot below.

step_5.png

4. Replace the text INSERT_API_KEY with your Birdeye API key. Please see the Prerequisites section for how to get the API key from Birdeye. Then press configure.

5. Name the function Birdeye Customer Visit and press Create Function:

step_6.png

6. After creating the function, a popup should appear on the right side of the screen showing a button Connect Destination that you should press. You can get back to this screen at a later time, by going to Connections => Catalog => Functions => Birdeye Customer Visit.

step_7.png

7. Select the SMRT source that you already setup (see the Prerequisites section above), and press confirm source.

step_8.png

8. On the next screen, flip the toggle to enable the integration. This activates the integration

step_9.png

Monitoring Integration

In segment, you can go to the delivery tab under the function, to monitor the integration. Please note that event delivery from SMRT is delayed by 10-20 minutes, and only triggers on store pickup or delivery, and not on new orders.

step_10.png

In Birdeye, you can also monitor the integration by going to the "Contacts" page. Any contacts with recent order returns, should be listed at the top (the page is sorted by last activity). If you hover a contact and press actions => contact journey, you should see the API at work like so:

Screenshot_2020-12-17_at_10.01.04.png

Integration Code

//Replace INSERT_API_KEY below with your Birdeye API key.
const apiKey = 'INSERT_API_KEY';async function onTrack(event, settings) {
	if (event.event !== 'Customer Visit') {
		return;
	}	if (
		!event.properties.homeStore ||
		!event.properties.homeStore.externalStoreIdentifier ||
		!event.properties.orderWasReturned
	) {
		return;
	}	const externalStoreIdentifier =
		event.properties.homeStore.externalStoreIdentifier;
	const endpoint = `https://api.birdeye.com/resources/v1/customer/checkin?api_key=${apiKey}&bid=${externalStoreIdentifier}`;
	let response;	const traits = event.context.traits;
	let name = '';	function isSet(val) {
		return !!val && val != '';
	}	if (isSet(traits.firstName) && isSet(traits.lastName)) {
		name = `${traits.firstName} ${traits.lastName}`;
	} else if (isSet(traits.firstName)) {
		name = traits.firstName;
	} else if (isSet(traits.lastName)) {
		name = traits.lastName;
	}	const payload = {
		name,
		phone: traits.phone,
		emailId: traits.email,
		smsEnabled: traits.receiveTexts ? 1 : 0,
		employees: [
			{
				emailId: event.properties.staff.staffEmail,
				firstName: event.properties.staff.staffFirstName,
				lastName: event.properties.staff.staffLastName
			}
		],
		additionalParams: {
			customerAgent: traits.agent,
			locationType: event.properties.locationType
		}
	};	try {
		response = await fetch(endpoint, {
			method: 'POST',
			headers: {
				Authorization: `Basic ${btoa(settings.apiKey + ':')}`,
				'Content-Type': 'application/json'
			},
			body: JSON.stringify(payload)
		});
	} catch (error) {
		// Retry on connection error
		throw new RetryError(error.message);
	}	if (response.status >= 500 || response.status === 429) {
		// Retry on 5xx (server errors) and 429s (rate limits)
		throw new RetryError(`Failed with ${response.status}`);
	}
}
Did this answer your question?