Skip to content

Commit 7a1bf2c

Browse files
authored
Merge pull request #7687 from segmentio/extensible-webhooks-recipes
Added recipe pages for destination integrations with Extensible Webhooks [DOC-1108]
2 parents 9a7af97 + d038681 commit 7a1bf2c

File tree

5 files changed

+659
-0
lines changed

5 files changed

+659
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
title: Amazon Ads Audience Sync Integration Recipe
3+
4+
---
5+
6+
This recipe will guide you through how to set up a custom destination for [Amazon Ads](https://advertising.amazon.com/?utm_source=segmentio&utm_medium=docs&utm_campaign=partners){:target="_blank”} using Twilio Segment's [Extensible Webhooks](https://segment.com/docs/connections/destinations/catalog/actions-webhook-extensible/){:target="_blank"} feature and how to sync customer data into an Audience list. By following these steps, you can integrate your data source with Amazon Ads.
7+
8+
## Prerequisites
9+
10+
To integrate Amazon Ads with Segment, ensure you have the following:
11+
12+
- A Segment Account: an account with the Extensible Webhooks feature enabled (private beta access).
13+
- An Amazon Ads Account: an active account or API access to Amazon Ads.
14+
- Authentication Credentials: the necessary credentials for authentication. These are OAuth endpoints, Client ID, Secret, Scopes.
15+
- Data mapping information: Knowledge of the data fields required by Amazon Ads.
16+
17+
## Getting started
18+
19+
### 1. Set up the Extensible Webhook destination
20+
21+
To set up your destination in Segment:
22+
23+
1. In your Segment workspace, go to **Catalog** > **Destinations**.
24+
2. Search for Extensible Webhook and select **Add destination**.
25+
26+
### 2. Select the data source
27+
28+
1. Choose the source from which you want to send data to Amazon Ads.
29+
2. Click **Next** to proceed.
30+
31+
### 3. Specify the instance details
32+
33+
1. Enter a recognizable name for your webhook instance (like "Segment to Amazon Integration").
34+
2. (Optional) Add a brief description of the integration.
35+
36+
### 4. Select the authentication type
37+
38+
An Amazon Client Application has to be created which requires approval. For steps on how to complete Amazon API onboarding, see the [Amazon documentation](https://advertising.amazon.com/API/docs/en-us/guides/onboarding/overview){:target="_blank"}.
39+
40+
The LwA (Login with Amazon) application that you create should have `advertising::audiences` as the scope. For Campaign management, like marking conversions, the scope should be `advertising::campaign_management`.
41+
42+
Once a LwA app has been created, you will need to add the redirect URI `https://app.segment.com/oauth-service/webhook/callback` to the list of Allowed Return URLs. For more detail on this, see the [Amazon documentation](https://advertising.amazon.com/API/docs/en-us/guides/get-started/create-authorization-grant#allow-a-return-url){:target="_blank"}.
43+
44+
Note down the Client ID and Secret, available in the Login with Amazon section on the [Amazon Developer site](https://developer.amazon.com/){:target="_blank"}. These will be used to set up authentication with Segment.
45+
46+
#### Authentication
47+
48+
To set up authentication:
49+
1. Select OAuth 2.0 from the list of options and select **Authorization Code**.
50+
2. Enter the following credential details as listed below or given in the web app:
51+
- Client ID
52+
- Client secret
53+
- Authorize URL: `https://www.amazon.com/ap/oa`
54+
- Token URL: `https://api.amazon.com/auth/o2/token`
55+
- Refresh URL: `https://api.amazon.com/auth/o2/token`
56+
- Scope: `advertising::audiences`
57+
58+
The authorization URL is available in [Amazon's authorization guide](https://advertising.amazon.com/API/docs/en-us/guides/get-started/create-authorization-grant#determine-the-url-prefix-for-your-region){:target="_blank"}, and the access/refresh token URL can also be found in [Amazon's guide on access tokens](https://advertising.amazon.com/API/docs/en-us/guides/get-started/retrieve-access-token#call-the-authorization-url-to-request-access-and-refresh-tokens){:target="_blank"}, depending on your region.
59+
60+
3. Once you create the destination instance, you will then be redirected to the Settings section. Click **Connect** to set up the OAuth connection with Amazon Ads.
61+
4. You will be redirected to Amazon Ads. Log in and click **Allow** to complete the authentication flow.
62+
63+
Once done redirected back to the destination settings page, authentication is completed and you’re now ready to send events to Amazon Ads.
64+
65+
### 5. Perform Data Mapping
66+
67+
#### Data transformation
68+
69+
Amazon Ads expects data to be in a certain format with nested fields. This format cannot be mapped with the mappings functionality and will need to be transformed within an insert function.
70+
71+
You will need to write an insert function that appends a property, for example one called “body”, to the event which would then have nested fields. For the Amazon Ads Audience API, a sample expected payload is of the following structure:
72+
73+
```
74+
{
75+
"records": [
76+
{
77+
"hashedPII": [
78+
{
79+
"firstname": "sdstdsdsaring",
80+
"address": "scdcadscstring",
81+
"phone": "sadtrdsaidng",
82+
"city": "ssatring",
83+
"state": "strccaing",
84+
"postal": "staccaring",
85+
"email": "stracaing",
86+
"lastname": "stacaddacring"
87+
}
88+
],
89+
"externalUserId": "A12346sgd",
90+
"action": "CREATE"
91+
}
92+
],
93+
"targetResource": {
94+
"connectionId": "",
95+
"targetTypes": [
96+
"DSP"
97+
]
98+
},
99+
"audienceId": 371552318001631924
100+
}
101+
```
102+
103+
The Amazon Ads Audience API's expected fields are:
104+
- `Records` is an array of objects. For the beta, Segment doesn’t support batching to iterate over this object yet. The required parameters are:
105+
- `hashedPII`: A list of SHA-256 hashed PII that will be matched with Amazon entities.
106+
- `firstname`
107+
- `lastname`
108+
- `address`
109+
- `phone`
110+
- `city`
111+
- `state`
112+
- `postal`
113+
- `email`
114+
- `externalUserId`: The ID used by external systems to identify customers.
115+
- `action`: Can be “CREATE” or “DELETE” based on whether you want to add or remove the user from the list.
116+
- `audienceID` is the ID of the Audience list to which the data should be either added or deleted. You can get the audienceID from within the Amazon Ads console or when creating an Audience from the API.
117+
118+
#### Data mapping
119+
120+
1. Create a new Mapping in the Mappings tab and select the **Send** HTTP action.
121+
2. Choose which events you want to send to Amazon Ads Audience API using the Event filters.
122+
3. Fill out mapping fields:
123+
- Specify the URL:
124+
- The API endpoint is based on region.
125+
- Include the suffix with the Audience API Endpoint: `/amc/audiences/records`
126+
- Specify the header:
127+
- `Amazon-Advertising-API-ClientId`: The Client ID from Login with Amazon Account.
128+
4. Use the mapping interface and search for the “body” parameter that was created in the insert function to select the transformed object that can be sent as the event body.
129+
5. Turn off batching for this operation.
130+
131+
### 6. Test the output and connection
132+
133+
1. Click **Test Connection** to send a sample payload.
134+
2. In Amazon Ads, verify that the test data has been received and processed correctly.
135+
136+
#### Troubleshooting
137+
138+
If the test fails:
139+
- Review the authentication details and data mappings.
140+
- Check for error messages in Segment and Amazon Ads.
141+
142+
### 7. Save and enable the destination
143+
144+
1. Once the test is successful, click **Save** to store your configuration.
145+
2. Toggle the destination to Enable to start sending live data to Amazon Ads Audience API.
146+
3. Monitor the data flow to ensure that events are being delivered as expected.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
title: Google Search Ads 360 Conversion API Integration Recipe
3+
---
4+
5+
This recipe will guide you through how to set up a custom destination for [Google Search Ads 360](https://marketingplatform.google.com/intl/en_uk/about/search-ads-360/){:target="_blank"} conversions using Twilio Segment’s [Extensible Webhooks](https://segment.com/docs/connections/destinations/catalog/actions-webhook-extensible/){:target="_blank"} feature.
6+
7+
## Prerequisites
8+
9+
To integrate Search Ads 360 with Twilio Segment, ensure you have the following:
10+
11+
- A Segment account: an account with the Extensible Webhooks feature enabled (private beta access).
12+
- A Search Ads account: an active account and API access to Google Search Ads 360.
13+
- Authentication credentials: necessary credentials for authentication, for example, API keys and tokens.
14+
- Data mapping information: knowledge of the data fields required by Search Ads 360.
15+
16+
## Getting started
17+
18+
### 1. Configure Extensible Webhook as a destination
19+
20+
1. In your Segment workspace, navigate to **Connections** > **Catalog** > **Destinations**.
21+
2. Use the search bar to search for "Extensible Webhook" and select **Add destination**.
22+
23+
### 2. Select the data source
24+
25+
1. Choose the source that you want to send data from to Google Search Ads 360.
26+
2. Click **Next** to proceed.
27+
3. Give your destination a name and create your destination.
28+
29+
### 3. Specify the instance details
30+
31+
1. Enter a recognizable name for your webhook instance, for example, Segment to Search Ads Integration.
32+
2. (Optional) Add a brief description of the integration.
33+
34+
### 4. Select the authentication type
35+
36+
As a prerequisite to authenticate APIs, you need to create OAuth credentials. Once generated, note down the Client ID and Secret. They are required to set up authentication between Segment and Google Search Ads.
37+
38+
You will also need to add the following redirect URI to the list of allowed return URLs: `https://app.segment.com/oauth-service/webhook/callback`.
39+
40+
#### Authentication
41+
42+
1. Select OAuth 2.0 and select Authorization Code.
43+
2. Enter the following credentials details from your project:
44+
- Client ID
45+
- Client secret
46+
- Authorize URL: `https://accounts.google.com/o/oauth2/v2/auth`
47+
- Token URL: `https://oauth2.googleapis.com/token`
48+
- Refresh URL: `https://oauth2.googleapis.com/token`
49+
- Scope: `https://www.googleapis.com/auth/doubleclicksearch`
50+
3. Once you have created the destination instance, you will be redirected to the Settings section. Click **Connect** to set up the OAuth connection with Google Search Ads 360.
51+
4. Log in to your Google Search Ads account and click **Allow** to complete authentication.
52+
53+
If authentication is completed successfully, you will be redirected to the destination settings page. At this point, you are ready to send events to Google Search Ads.
54+
55+
### 5. Data mapping
56+
57+
#### Data transformation
58+
59+
Google Search Ads 360 expects data to be in a certain format with nested fields. This format cannot be mapped with the mappings functionality and will need to be transformed within an insert function.
60+
61+
You will need to write an insert function that appends a property, for example one called “body”, to the event which would then have nested fields. For the Google Search Ads 360 Conversion API, an expected sample payload is of the following structure:
62+
63+
```
64+
{
65+
"kind": "doubleclicksearch#conversionList",
66+
"conversion" : [{
67+
"clickId" : "COiYmPDTv7kCFcP0KgodOzQAAA", // Replace with a click ID from your site
68+
"conversionId" : "test_20130906_04",
69+
"conversionTimestamp" : "1378710000000",
70+
"segmentationType" : "FLOODLIGHT",
71+
"segmentationName" : "Test",
72+
"type": "TRANSACTION",
73+
"revenueMicros": "10000000", // 10 million revenueMicros is equivalent to $10 of revenue
74+
"currencyCode": "USD"
75+
}]
76+
}
77+
```
78+
79+
The Google Search Ads 360 Conversion API's required fields are:
80+
- `kind` which is `doubleclicksearch#conversionList`. Conversion is an array. While in beta, Segment doesn’t support batching to iterate over this.
81+
- `clickId` which is the ID of a specific click on an ad that the customer clicked on.
82+
- `conversionId` is a unique ID that tracks the particular conversion.
83+
- `conversionTimestamp` is date and time in epoch milliseconds on when the conversion took place.
84+
- `segmentationType` should be `FLOODLIGHT`.
85+
- `segmentationName` is the floodlight activity to report this conversion to.
86+
- `type` which can be `action` or `transaction` to indicate whether the conversion had a monetary value or not.
87+
88+
#### Data mapping
89+
90+
1. Create a new Mapping in the Mappings tab and select the **Send** HTTP action.
91+
2. Choose which events you want to send to Google Search Ads 360 API using the Event filters.
92+
3. Fill out mapping fields:
93+
- Specify the URL: `https://www.googleapis.com/doubleclicksearch/v2/conversion`
94+
4. Use the mapping interface and search for the “body” parameter that was created in the insert function to select the transformed object that can be sent as the event body.
95+
5. Turn off batching for this operation.
96+
97+
### 6. Test the output and connection
98+
99+
1. Click **Test Connection** to send a sample payload.
100+
2. In Google Search Ads 360 Conversion, verify that the test data has been received and processed correctly.
101+
102+
#### Troubleshooting
103+
104+
If the test fails:
105+
- Review the authentication details and data mappings.
106+
- Check for error messages in Segment and Search Ads.
107+
108+
### 7. Save and enable the destination
109+
110+
1. Once the test is successful, click **Save** to store your configuration.
111+
2. Toggle the destination to Enable to start sending live data to Google Search Ads 360 Conversion API.
112+
3. Monitor the data flow to ensure that events are being delivered as expected.
113+
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: Microsoft Dynamics 365 (Sales Hub) Integration Recipe
3+
---
4+
5+
This recipe will guide you through how to set up a custom destination for [Microsoft Dynamics 365 (Sales)](https://www.microsoft.com/en-us/dynamics-365/products/sales){:target="_blank"} using Twilio Segment’s [Extensible Webhooks](https://segment.com/docs/connections/destinations/catalog/actions-webhook-extensible/){:target="_blank"} feature.
6+
7+
## Prerequisites
8+
9+
To integrate Microsoft Dynamics 365 with Twilio Segment, ensure you have the following:
10+
11+
- A Segment account: an account with the Extensible Webhooks feature enabled (private beta access).
12+
- An Azure application: an Azure application is required for authentication.
13+
- Authentication credentials: necessary credentials for authentication, for example, endpoints and scopes.
14+
- Data mapping information: knowledge of the data fields required by Microsoft Dynamics 365.
15+
16+
## Getting started
17+
18+
### 1. Configure Extensible Webhook as a destination
19+
20+
1. In your Segment workspace, navigate to **Connections** > **Catalog** > **Destinations**.
21+
2. Use the search bar to search for "Extensible Webhook" and select **Add destination**.
22+
23+
### 2. Select the data source
24+
25+
1. Choose the source that you want to send data from to Microsoft Dynamics 365..
26+
2. Click **Next** to proceed.
27+
3. Give your destination a name and create your destination.
28+
29+
### 3. Specify the instance details
30+
31+
1. Enter a recognizable name for your webhook instance, for example, Segment to Microsoft Dynamics Integration.
32+
2. (Optional) Add a brief description of the integration.
33+
34+
### 4. Select the authentication type
35+
36+
For authentication, you need to first create an Azure application that can authenticate users to provide access to Microsoft Dynamics API. See [Microsoft's documentation](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app?tabs=client-secret){:target="_blank"} for details on how to create an application and how to get the client secret that will later be used for authentication.
37+
38+
The redirect URI for your application is `https://app.segment.com/oauth-service/webhook/callback`.
39+
40+
To connect the Azure app with the Dynamics instance, go to the Power Platform Admin Center. Here you will need to create new app users associated with a business unit, and provide security roles.
41+
42+
Once you have successfully created an Azure web application and associated it with a Dynamics environment, you can proceed to authentication in Segment.
43+
44+
1. Navigate to the settings page of the webhook destination in Segment.
45+
2. Select **OAuth 2.0** and select **Authorization Code**.
46+
3. Enter the following credential details from your web app or as listed below:
47+
- Client ID
48+
- Client secret
49+
- Access Token URL: `https://login.microsoftonline.com/<directory_id>/oauth2/v2.0/token`. Replace `<directory_id>` with your Azure AD tenant ID. You can be find this in the Entra admin center. For detailed steps, see [Microsoft's guide](https://learn.microsoft.com/en-us/entra/fundamentals/how-to-find-tenant){:target="_blank"}.
50+
- Example URL with a sample directory UUID: `https://login.microsoftonline.com/861e4762-e528-4faf-ad95-70847a9efbe7/oauth2/v2.0/token`
51+
- Scope: `https://<dynamics>/.default`. Replace `<dynamics>` with the domain of your Dynamics 365 instance. This appears in your web browser's address bar when using your app.
52+
- Example URL for a Dynamics 365 instance: `https://org2fd4b414.crm.dynamics.com/.default`.
53+
4. Click **Connect** to set up the OAuth connection with Microsoft.
54+
55+
Authentication will take place if the configurations are correct and the access token will automatically be generated without the need for user login.
56+
57+
### 5. Data mapping
58+
59+
#### Data transformation (optional)
60+
61+
Microsoft Dynamics 365 can create and update multiple entities all at once with a nested object structure. For example, with a single API call to the `accounts` entity, you can create a new account, contact and a related opportunity in a single shot.
62+
63+
You will need to write an insert function that appends a property, for example one called “body”, to the event which would then have nested fields. For the Create New Account API, an expected sample payload is of the following structure:
64+
65+
```
66+
{
67+
"name": "Sample Account",
68+
"primarycontactid":
69+
{
70+
"firstname": "John",
71+
"lastname": "Smith"
72+
},
73+
"opportunity_customer_accounts":
74+
[
75+
{
76+
"name": "Opportunity associated to Sample Account",
77+
"Opportunity_Tasks":
78+
[
79+
{ "subject": "Task associated to opportunity" }
80+
]
81+
}
82+
]
83+
}
84+
```
85+
86+
The Create New Account API’s expected fields are listed in [Microsoft's documentation](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/reference/account?view=dataverse-latest){:target="_blank"}.
87+
88+
To create or update the Account entity only, you can skip this step and directly use mappings to map properties and keys.
89+
90+
#### Data mapping
91+
92+
1. Create a new Mapping in the Mappings tab and select the **Send** HTTP action.
93+
2. Choose which events you want to send to Google Search Ads 360 API using the Event filters.
94+
3. Fill out mapping fields:
95+
- Specify the URL: `[Organization URI]/api/data/v9.2/accounts` (this is for creating new accounts)
96+
4. Use the mapping interface and search for the “body” parameter that was created in the insert function to select the transformed object that can be sent as the event body.
97+
5. Turn off batching for this operation.
98+
99+
### 6. Test the output and connection
100+
101+
1. Click **Test Connection** to send a sample payload.
102+
2. In Microsoft Dynamics 365, verify that the test data has been received and processed correctly.
103+
104+
#### Troubleshooting
105+
106+
If the test fails:
107+
- Review the authentication details and data mappings.
108+
- Check for error messages in Segment and Search Ads.
109+
110+
### 7. Save and enable the destination
111+
112+
1. Once the test is successful, click **Save** to store your configuration.
113+
2. Toggle the destination to Enable to start sending live data to Microsoft Dynamics 365.
114+
3. Monitor the data flow to ensure that events are being delivered as expected.

0 commit comments

Comments
 (0)