# Cordial Cloud Mode Integration

<p>After you have successfully instrumented Cordial as a destination in RudderStack, follow this guide to correctly send your events to Cordial in <a href="https://www.rudderstack.com/docs/destinations/rudderstack-connection-modes/#cloud-mode" >cloud mode</a>.</p>
<p>Find the open source transformer code for this destination in the <a href="https://github.com/rudderlabs/rudder-transformer/tree/main/src/cdk/v2/destinations/cordial/" >GitHub repository</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="identify">Identify</h2><p>You can use the <a href="https://www.rudderstack.com/docs/event-spec/standard-events/identify/" ><code>identify</code></a> call to create or update a contact in Cordial. RudderStack uses the <a href="https://support.cordial.com/hc/en-us/articles/203885958-Contacts-API" >Contacts API</a> to send this data.</p>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text">Make sure to create the contact attributes in the Cordial dashboard before sending them in your <code>identify</code> events.</div>
  </div>
</blockquote>

</html>
<p>A sample <code>identify</code> call is shown:</p>
<div class="rs-code">
  <div class="rs-code__head">javascript<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-javascript" data-lang="javascript">rudderanalytics.identify(&#34;1hKOmRA4GRlm&#34;, {
  name: &#34;Alex Keener&#34;,
  email: &#34;alex@example.com&#34;,
  logins: 2,
}, {
  externalId: [{
    type: &#34;cordialContactId&#34;,
    id: &#34;12345&#34;
  }, ],
});</code></pre></div>
</div>
<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="supported-mappings">Supported mappings</h3><p>RudderStack maps the following <code>identify</code> fields to the corresponding Cordial properties:</p>
<table>
  <thead>
      <tr>
          <th>RudderStack property</th>
          <th>Cordial property</th>
          <th>Note</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>traits.email</code> <br/><code>context.traits.email</code><br /> Either <code>email</code> or <code>externalId.id</code> is required. </td>
          <td><code>channels.email.address</code></td>
          <td>-</td>
      </tr>
      <tr>
          <td><code>context.externalId.id</code> <br/> Either <code>email</code> or <code>externalId.id</code> is required. </td>
          <td><code>cID</code></td>
          <td><code>externalId.type</code> should be set to <code>cordialContactId</code> (Cordial-generated database identifier).</td>
      </tr>
      <tr>
          <td><code>traits.subscribedStatus</code> <br /> <code>context.traits.subscribeStatus</code></td>
          <td><code>channels.email.subscribeStatus</code></td>
          <td></td>
      </tr>
      <tr>
          <td><code>traits</code></td>
          <td><code>attributes</code></td>
          <td>User traits except the <code>email</code> and <code>subscribeStatus</code> fields.</td>
      </tr>
  </tbody>
</table>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="track">Track</h2><p>You can use the <a href="https://www.rudderstack.com/docs/event-spec/standard-events/track/" ><code>track</code></a> call to track and create a contact&rsquo;s activity in Cordial. RudderStack uses the <a href="https://support.cordial.com/hc/en-us/articles/203885968-Contact-activities-events-API#postContactActivities" >Contact Activities</a> API to send this data.</p>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text">Make sure to create a contact in Cordial using an <code>identify</code> call before sending the <code>track</code> events for that contact.</div>
  </div>
</blockquote>

</html>
<p>A sample <code>track</code> call is shown:</p>
<div class="rs-code">
  <div class="rs-code__head">javascript<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-javascript" data-lang="javascript">rudderanalytics.track(
  &#34;Product Reviewed&#34;, {
    review_id: &#34;86ac1cd43&#34;,
    product_id: &#34;9578257311&#34;,
    rating: 4.0,
    review_body: &#34;Good product.&#34;,
  }, {
    externalId: [{
      type: &#34;cordialContactId&#34;,
      id: &#34;12345&#34;,
    }, ],
  },
);</code></pre></div>
</div>

<blockquote class="warning">
  <div class="tip-quote">
    
    <div class="tip-text">Cordial has <a href="https://support.cordial.com/hc/en-us/articles/203885968-Contact-activities-events-API#reservedEvents:~:text=Actions%20taken%20within%20a%20message%20%28reserved%20actions%29%20will%20automatically%20generate%20an%20activity%20record.%20These%20include%3A" >reserved some event names</a> that automatically generate an activity record. Hence, do not use these names while sending your <code>track</code> events to Cordial.</div>
  </div>
</blockquote>
<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="supported-mappings-1">Supported mappings</h3><p>RudderStack maps the following <code>track</code> fields to the corresponding Cordial properties:</p>
<table>
  <thead>
      <tr>
          <th>RudderStack property</th>
          <th>Cordial property</th>
          <th>Note</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>event</code> <br/> Required</td>
          <td><code>a</code></td>
          <td>-</td>
      </tr>
      <tr>
          <td><code>context.externalId.id</code> <br /> <code>traits.email</code> <br /><code>context.traits.email</code> <br/> Required </td>
          <td><code>contact identifier</code></td>
          <td><code>externalId.type</code> should be set to <code>cordialContactId</code> (Cordial-generated database identifier).</td>
      </tr>
      <tr>
          <td><code>properties</code></td>
          <td><code>properties</code></td>
          <td>-</td>
      </tr>
      <tr>
          <td><code>timestamp</code> <br /> <code>originalTimestamp</code></td>
          <td><code>ats</code></td>
          <td>ISO 8601 date in the format <code>yyyy-MM-ddTHH:mm:ss.SSSZ</code>. <br /><br />For example: <code>2022-02-01T19:14:18.381Z</code></td>
      </tr>
  </tbody>
</table>

