Trigger invitations using Trustpilot APIs
You can use a Trustpilot API to trigger service review invitations to be sent out by Trustpilot. This guide outlines how to set them up.
You may need help from a developer.
Find your API and Secret key
If your account has API access granted, you can create and manage your API keys by following the quick steps below or going directly here.
-
In Trustpilot Business, go to Integrations > Developers > APIs.
-
Under Create a new application, name your application and enter any domains you want to include. Click Create application.
-
Find the application in Your applications. Click the dropdown to expand the application and find your API and Secret key.
Find your Business Unit ID (BUID)
Your Business Unit ID is a unique identifier specific to your domain. It’s static and will only change if your domain on Trustpilot changes. To find the BUID for your domain, you’ll need to use the Find a business unit endpoint. The required parameter here is the “name” of the business unit, for instance, your website’s domain. As a quick example, if you wanted to look up the BUID of Trustpilot, you’d pass along the string “trustpilot.com”.
Try it yourself, just remember to replace the API key.
https://api.trustpilot.com/v1/business-units/find?apikey={{apikey}}&name=trustpilotdemo.com
Once you get the response back, you want the “id” field. This is your BUID for the domain you just searched.
Authentication with OAuth 2.0
In order to use any private API endpoint on Trustpilot, authentication is required in the form of an access token. Since triggering invitations is considered a private endpoint, the goal here will be to get an access token first, which you can reuse for multiple API calls while it’s valid. Once expired, you can refresh the token. To jump right into our authentication documentation for more guidance, take a look here.
For server-side integrations, we recommend using Grant Type: Password.
Trigger a service review invitation
Once you have your access token, you can use our Create invitation(s) API endpoint. This API call JSON request requires the customer name, email, and some sort of reference ID such as an order ID or invoice number. There are also a number of sender options that you can customize. Here's a sample JSON request:
{ "consumerEmail": "john.doe@trustpilot.com", "consumerName": "John Doe", "referenceNumber": "inv00001", "replyTo": "john.doe@trustpilot.com", "locale": "en-US", "senderEmail": "john.doe@trustpilot.com", "serviceReviewInvitation": { "preferredSendTime": "2013-09-07T13:37:00", "redirectUri": "http://trustpilot.com", "tags": [ "tag1", "tag2" ], "templateId": "507f191e810c19729de860ea" }, "locationId": "ABC123", "senderName": "John Doe" }
Successful API calls will queue up invitations in Trustpilot Business, which you can see by logging in to your account and viewing your invitation status page.
Leaving out certain sender options such as the “senderEmail”, “templateId”, or “preferredSendTime” isn’t a problem - this API endpoint will automatically use the settings enabled in your Invitation Settings within Trustpilot Business.
Optional tags
These are extra pieces of specific data that you know about the customer or their purchase. By adding these before the review has been submitted, your reviews will be tagged with hyper-relevant data, allowing for more granular analytics and highly tailored review display.
Valid characters are a-z, A-Z, 0-9, underscore, dash, and period. Spaces are not allowed.
Redirect URI
A redirect URI allows you to redirect the customer to any webpage of your choosing once they submit their review. By omitting the redirect URI, reviewers will be brought to a Trustpilot "review submitted" page. If you'd like to bring them back to a custom page on your website, like your own "thank you" page or simply your homepage, you have full control over that.
Make sure to use a full URL including http/https. As an example, https://example.com would be valid, but example.com would not.
For more information on how to get started with Trustpilot's Private API Authentication, check out this article.