Contact attribute lookup
Webhook
Inbox 2.0 CRM integration allows you to pull customer contact data from CRMs or other internal business applications into Inbox 2.0. To integrate your CRM with Inbox 2.0, you need to provide an HTTPS endpoint for lookups.
Create contact attributes
- In Inbox 2.0, go to
Admin settings, expandAgent Workspace, selectContact attributes, and then selectAdd attribute. - Select
Managed by CRM. The CRM is the source of truth for these attributes. After they are imported into Inbox 2.0, they only change when the value changes in the CRM. - Identify lookup attributes by selecting
Use as lookup attribute. These are used by the CRM to find a customer's data. For example, if you want to find a customer by email address, create an attribute called "Email" and designate it as a lookup. When the request is made from Inbox 2.0 to your CRM, the lookup fields are included in the request body. - In the
Unique identifierbox, enter an alias for the lookup attribute. This is used to map the response from your system to the attribute.
Configure integration URL
To pull data from your CRM into Inbox 2.0, you need to implement a POST endpoint that accepts a JSON request and returns a JSON response. The request contains the lookup attributes, and the response should contain the contact data from your CRM.
After the endpoint is implemented, configure it as the lookup URL:
- Go to
Admin settings. - Expand
Integration and APIs. - Select
CRM.
Handle the request
When the endpoint in your system is ready and configured in Inbox 2.0, and one or more lookup attributes have been identified, you can make a request via the Lookup button in the conversation view.
This will trigger the CRM attribute lookup event.
After you've done the lookup in your system, pass attributes back to Inbox 2.0 as a JSON response. The keys in the attributes object correspond to the aliases that were previously added in Inbox 2.0. If a CRM managed attribute is missing from the object or the key has a null value, its value is deleted in Inbox 2.0. Inbox 2.0 expects the response in this format:
{
"autoConfirm": false,
"contactAttributes": [
{"attribute": "email", "value": "fj@example.com"},
{"attribute": "id", "value": "98765432"},
{"attribute": "first_name", "value": "Fred"},
{"attribute": "last_name", "value": "Jones"},
{"attribute": "last_order_number", null}
]
}
Asynchronous Response
You can also return a 200 OK back without a body and call our REST api to send back the result of the lookup request. Call the following REST endpoint:
curl --request PUT 'https://platform.hootsuite.com/inbox/v2/contact/{contactProfileId}/contact-attributes' \
--header 'content-type: application/json' \
--header 'Authorization: BEARER <token>' \
--data-raw '{
"autoConfirm": false,
"contactAttributes": [
{"attribute": "email", "value": "fj@example.com"},
{"attribute": "id", "value": "98765432"},
{"attribute": "first_name", "value": "Fred"},
{"attribute": "last_name", "value": "Jones"},
{"attribute": "last_order_number", null}
]
}'
Confirm your attributes
The CRM attributes sent back in the response must be confirmed before they are saved in Inbox 2.0. There are two ways to do that:
- Select the
Confirmbutton when you see the CRM attributes displayed in Inbox 2.0 after the lookup request. - Add an
autoConfirmfield to the response.
The autoConfirm field tells Inbox 2.0 to automatically save the attributes without having to use the Confirm button.
Request
Responses
- 200
- 4xx
- 5xx
Returns the attributes to be updated in Inbox 2.0.
Lookup failed
Lookup failed