Modified: unomi/website/manual/latest/index.html URL: http://svn.apache.org/viewvc/unomi/website/manual/latest/index.html?rev=1918319&r1=1918318&r2=1918319&view=diff ============================================================================== --- unomi/website/manual/latest/index.html (original) +++ unomi/website/manual/latest/index.html Fri Jun 14 09:47:06 2024 @@ -160,6 +160,15 @@ <li><a href="#_enabling_the_api">6.2. Enabling the API</a></li> <li><a href="#_endpoints">6.3. Endpoints</a></li> <li><a href="#_graphql_schema">6.4. GraphQL Schema</a></li> +<li><a href="#_graphql_request_examples">6.5. Graphql request examples</a> +<ul class="sectlevel3"> +<li><a href="#_retrieving_your_first_profile">6.5.1. Retrieving your first profile</a></li> +<li><a href="#_updating_profile">6.5.2. Updating profile</a></li> +<li><a href="#_restricted_methods">6.5.3. Restricted methods</a></li> +<li><a href="#_deleting_profile">6.5.4. Deleting profile</a></li> +<li><a href="#_where_to_go_from_here_2">6.5.5. Where to go from here</a></li> +</ul> +</li> </ul> </li> <li><a href="#_migrations">7. Migrations</a> @@ -440,11 +449,6 @@ <li><a href="#_executing_the_unit_tests">15.2.6. Executing the unit tests</a></li> </ul> </li> -<li><a href="#_mailchimp_connector">15.3. MailChimp Connector</a> -<ul class="sectlevel3"> -<li><a href="#_getting_started_2">15.3.1. Getting started</a></li> -</ul> -</li> </ul> </li> <li><a href="#_developers">16. Developers</a> @@ -4032,6 +4036,296 @@ environment variable (if using Docker fo you might need to adjust the URL to point GraphQL Playground to the <code>/graphql</code> endpoint.</p> </div> </div> +<div class="sect2"> +<h3 id="_graphql_request_examples">6.5. Graphql request examples</h3> +<div class="paragraph"> +<p>You can use embedded GraphiQL interface available at <a href="http://localhost:8181/graphql-ui" class="bare">http://localhost:8181/graphql-ui</a> or use any other GraphQL client using that url for requests.</p> +</div> +<div class="sect3"> +<h4 id="_retrieving_your_first_profile">6.5.1. Retrieving your first profile</h4> +<div class="paragraph"> +<p>Profile can be retrieved using <code>getProfile</code> query</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-graphql" data-lang="graphql">query($profileID: CDP_ProfileIDInput!, $createIfMissing: Boolean) { + cdp { + getProfile(profileID: $profileID, createIfMissing: $createIfMissing) { + firstName + lastName + gender + cdp_profileIDs { + client { + ID + title + } + id + } + } + } +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>This query accepts two variables that need to be provided in the <code>Query variables</code> section:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-json" data-lang="json">{ + "profileID": { + "client":{ + "id": "defaultClientId" + }, + "id": 1001 + }, + "createIfMissing": true +}</code></pre> +</div> +</div> +<div class="admonitionblock note"> +<table> +<tr> +<td class="icon"> +<div class="title">Note</div> +</td> +<td class="content"> +If you don’t want profile to be created if missing, set <code>createIfMissing</code> to <code>false</code>. +</td> +</tr> +</table> +</div> +<div class="paragraph"> +<p>The response will look like this:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-json" data-lang="json">{ + "data": { + "cdp": { + "getProfile": { + "firstName": null, + "lastName": null, + "gender": null, + "cdp_profileIDs": [ + { + "client": { + "ID": "defaultClientId", + "title": "Default Client" + }, + "id": "1001" + } + ] + } + } + } +}</code></pre> +</div> +</div> +</div> +<div class="sect3"> +<h4 id="_updating_profile">6.5.2. Updating profile</h4> +<div class="paragraph"> +<p>Now let’s update our profile with some data. +It can be done using <code>processEvents</code> mutation:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-graphql" data-lang="graphql">mutation($events: [CDP_EventInput]!) { + cdp { + processEvents(events: $events) + } +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>This mutation accepts one variable that needs to be provided in the <code>Query variables</code> section:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-json" data-lang="json">{ + "events": [ + { + "cdp_objectID": 1001, + "cdp_profileID": { + "client": { + "id": "defaultClientId" + }, + "id": 1001 + }, + "cdp_profileUpdateEvent": { + "firstName": "John", + "lastName": "Doe", + "gender": "Male" + } + } + ] +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>The response will have the number of processed events:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-json" data-lang="json">{ + "data": { + "cdp": { + "processEvents": 1 + } + } +}</code></pre> +</div> +</div> +<div class="admonitionblock note"> +<table> +<tr> +<td class="icon"> +<div class="title">Note</div> +</td> +<td class="content"> +<code>processEvents</code> accepts a number of other event types that are listed on <code>CDP_EventInput</code> type. +</td> +</tr> +</table> +</div> +<div class="paragraph"> +<p>If you run the <code>getProfile</code> query again, you will see that the profile has been updated.</p> +</div> +</div> +<div class="sect3"> +<h4 id="_restricted_methods">6.5.3. Restricted methods</h4> +<div class="paragraph"> +<p>Some methods are restricted to authenticated users only. +One example is <code>findProfiles</code> query:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-graphql" data-lang="graphql">query { + cdp { + findProfiles { + totalCount + edges { + node { + cdp_profileIDs { + client{ + title + ID + } + id + } + } + } + } + } +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>And if you run it now, you will get an error.</p> +</div> +<div class="paragraph"> +<p>To make this query work you need to supply authorization token in the <code>HTTP headers</code> section:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-json" data-lang="json">{ + "authorization": "Basic a2FyYWY6a2FyYWY=" +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>The above header adds <code>Basic</code> authorization scheme with base64 encoded <code>karaf:karaf</code> value to the request.</p> +</div> +<div class="paragraph"> +<p>The result will now show the list of profiles:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-json" data-lang="json">{ + "data": { + "cdp": { + "findProfiles": { + "totalCount": 1, + "edges": [ + { + "node": { + "cdp_profileIDs": [ + { + "client": { + "title": "Default Client", + "ID": "defaultClientId" + }, + "id": "1001" + } + ] + } + } + ] + } + } + } +}</code></pre> +</div> +</div> +</div> +<div class="sect3"> +<h4 id="_deleting_profile">6.5.4. Deleting profile</h4> +<div class="paragraph"> +<p>Profile can be deleted using <code>deleteProfile</code> mutation:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-graphql" data-lang="graphql">mutation($profileID: CDP_ProfileIDInput!) { + cdp { + deleteProfile(profileID: $profileID) + } +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>This mutation accepts one variable that needs to be provided in the <code>Query variables</code> section:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-json" data-lang="json">{ + "profileID": { + "client":{ + "id": "defaultClientId" + }, + "id": 1001 + } +}</code></pre> +</div> +</div> +<div class="paragraph"> +<p>The response will show the result of the operation:</p> +</div> +<div class="listingblock"> +<div class="content"> +<pre class="highlight"><code class="language-json" data-lang="json">{ + "data": { + "cdp": { + "deleteProfile": true + } + } +}</code></pre> +</div> +</div> +</div> +<div class="sect3"> +<h4 id="_where_to_go_from_here_2">6.5.5. Where to go from here</h4> +<div class="ulist"> +<ul> +<li> +<p>You can find more <a href="#_useful_apache_unomi_urls">useful Apache Unomi URLs</a> that can be used in the same way as the above examples.</p> +</li> +<li> +<p>Read <a href="https://graphql.org/learn/">GraphQL documentation</a> to learn more about GraphQL syntax.</p> +</li> +</ul> +</div> +</div> +</div> </div> </div> <div class="sect1"> @@ -8284,7 +8578,7 @@ Consent events may be sent directly by a <h5 id="_example_25">Example</h5> <div class="paragraph"> <p>In this example, a user-generated a consent modification when visiting the home page, possibly by interacting with a consent form that captured his preferences. -Different consent types were present on the page and he decided to GRANT the âmailchimpâ consent.</p> +Different consent types were present on the page and he decided to GRANT the âtrackingâ consent.</p> </div> <div class="imageblock"> <div class="content"> @@ -8323,12 +8617,6 @@ Different consent types were present on "description": "If approved we are allowed to track the visitor" }, { - "typeIdentifier": "mailchimp", - "activated": true, - "title": "Mailchimp", - "description": "desc" - }, - { "typeIdentifier": "newsletter1", "activated": true, "title": "Newsletter 1", @@ -8352,12 +8640,12 @@ Different consent types were present on "target": { "itemType": "consent", "scope": "digitall", - "itemId": "mailchimp" + "itemId": "tracking" }, "properties": { "consent": { "scope": "digitall", - "typeIdentifier": "mailchimp", + "typeIdentifier": "tracking", "status": "GRANTED", "statusDate": "2020-01-31T20:10:00.463Z", "revokeDate": "2022-01-30T20:10:00.463Z" @@ -9706,9 +9994,6 @@ return EventService.PROFILE_UPDATED;</co <li> <p><a href="#_salesforce_connector">Salesforce CRM connector</a></p> </li> -<li> -<p><a href="#_mailchimp_connector">Mailchimp connector</a></p> -</li> </ul> </div> <div class="sect3"> @@ -10013,134 +10298,6 @@ mvn clean install -DsfdcProperties=../te </div> </div> </div> -<div class="sect2"> -<h3 id="_mailchimp_connector">15.3. MailChimp Connector</h3> -<div class="paragraph"> -<p>This extension has 3 actions:</p> -</div> -<div class="ulist"> -<ul> -<li> -<p>Add a visitor into a defined Mailchimp list.</p> -</li> -<li> -<p>Remove a visitor from a defined Mailchimp list.</p> -</li> -<li> -<p>Unsubscribe a visitor from a defined Mailchimp list.</p> -</li> -</ul> -</div> -<div class="sect3"> -<h4 id="_getting_started_2">15.3.1. Getting started</h4> -<div class="olist arabic"> -<ol class="arabic"> -<li> -<p>Create a new MailChimp account: <a href="https://login.mailchimp.com/signup/" class="bare">https://login.mailchimp.com/signup/</a></p> -</li> -<li> -<p>Generate a new API Key, or get the default: <a href="https://usX.admin.mailchimp.com/account/api/" class="bare">https://usX.admin.mailchimp.com/account/api/</a></p> -</li> -<li> -<p>Configure the MailChimp Connector Basic in the <code>etc/unomi.custom.system.properties</code> file and add/change the following settings:</p> -<div class="listingblock"> -<div class="content"> -<pre class="highlight"><code>org.apache.unomi.mailchimp.apiKey=${env:UNOMI_MAILCHIMP_APIKEY:-yourApiKey} -org.apache.unomi.mailchimp.url.subDomain=${env:UNOMI_MAILCHIMP_URL_SUBDOMAIN:-us16}</code></pre> -</div> -</div> -</li> -<li> -<p>Before starting configure the mapping between Apache Unomi profile properties and MailChimp member properties.<br> -The mapping can’t be use with multitued properties. You need to setup your MailChimp properties first in the MailChimp administration.</p> -<div class="listingblock"> -<div class="content"> -<pre class="highlight"><code> Go to: lists/ - Select the triggered list - Settings</code></pre> -</div> -</div> -<div class="paragraph"> -<p>Then in the cfg file <code>org.apache.unomi.mailchimp.list.merge-fields.activate={Boolean} if you like to activate the mapping feature.</code></p> -</div> -<div class="paragraph"> -<p>This is the property to configure for the mapping, the format is as shown. <code>org.apache.unomi.mailchimp.list.merge-fields.mapping={Apache Unomi property ID}<⇒{MailChimp Tag name}</code></p> -</div> -<div class="admonitionblock note"> -<table> -<tr> -<td class="icon"> -<div class="title">Note</div> -</td> -<td class="content"> -<div class="paragraph"> -<p>there is a particular format for the address <code>{Apache Unomi property ID}<⇒{MailChimp Tag name}<⇒{MailChimp tag sub entry}</code></p> -</div> -</td> -</tr> -</table> -</div> -<div class="paragraph"> -<p>MailChimp supported type are:</p> -</div> -<div class="ulist"> -<ul> -<li> -<p>Date <code>The format is (DD/MM/YYYY) or (MM/DD/YYYY)</code></p> -</li> -<li> -<p>Birthday <code>The format is (DD/MM) or (MM/DD)</code></p> -</li> -<li> -<p>Website or Text <code>They are text</code></p> -</li> -<li> -<p>Number <code>The number will be parse into a Integer</code></p> -</li> -<li> -<p>Phone <code>The North American format is not supported, use international</code></p> -</li> -<li> -<p>Address</p> -<div class="admonitionblock note"> -<table> -<tr> -<td class="icon"> -<div class="title">Note</div> -</td> -<td class="content"> -<div class="paragraph"> -<p>Street, City, Country and Zip are mandatory properties, otherwise the address property will be skipped.</p> -</div> -</td> -</tr> -</table> -</div> -</li> -</ul> -</div> -<div class="listingblock"> -<div class="content"> -<pre class="highlight"><code> address<=>ADDRESS<=>addr1, - city<=>ADDRESS<=>city, - zipCode<=>ADDRESS<=>zip, - countryName<=>ADDRESS<=>country</code></pre> -</div> -</div> -</li> -<li> -<p>Deploy into Apache Unomi using the following commands from the Apache Karaf shell:<br></p> -</li> -</ol> -</div> -<div class="listingblock"> -<div class="content"> -<pre> feature:repo-add mvn:org.apache.unomi/unomi-mailchimp-connector-karaf-kar/${project.version}/xml/features - feature:install unomi-mailchimp-connector-karaf-kar</pre> -</div> -</div> -</div> -</div> </div> </div> <div class="sect1"> @@ -11495,7 +11652,7 @@ They allow to modify an item, that would </div> <div id="footer"> <div id="footer-text"> -Last updated 2023-11-18 13:11:21 +0100 +Last updated 2024-06-11 15:47:38 +0200 </div> </div> </body>
