# Introduction

Welcome to the CrowdPower docs. We look forward to helping you grow your business with lifecycle automations to keep and convert your customers.

CrowdPower was built by founders — for founders — to help put your marketing and growth on autopilot while you focus on building a great product your customers love. These docs will educate you on CrowdPower’s core concepts and API endpoints.

If you have any further questions, we’re happy to help over chat, email, or Slack Connect for 1-1 assistance.

**Here are some great starting points:**

Briefly learn about about each facet of the platform.

{% content-ref url="/pages/-MVwuquGrwVHuZnhf0A0" %}
[The Basics](/getting-started/the-basics)
{% endcontent-ref %}

Learn how to send customer data to CrowdPower with a few lines of code.

{% content-ref url="/pages/-MVmfyVjcnRM3OkrefZY" %}
[JavaScript Tag](/getting-started/javascript-tag)
{% endcontent-ref %}

Learn how to set up CrowdPower to send email.

{% content-ref url="/pages/-MVmfTh9M0-PL7qEKmgo" %}
[Basic Email Setup](/getting-started/email-setup)
{% endcontent-ref %}

Learn about all the ways to import customer data.

{% content-ref url="/pages/-MVmf6qfK1UDkc1gEKPf" %}
[Importing Customers](/getting-started/importing-customers)
{% endcontent-ref %}


# The Basics

CrowdPower is a customer data platform with an engagement layer that runs on top of it. This is a brief overview on how it works.

### 1. Customers

Your customers are stored in CrowdPower in the [customers](https://app.crowdpower.io/customers) section. Each customer is assigned a unique ID on the platform, but in most cases, you'll be sending in YOUR unique ID for each customer. This makes updating customer records a breeze. When you send customer data to CrowdPower, that customer will be retrieved by your unique identifier for them, or an email address if the `user_id` is not provided. If a customer can't be found, a new one is created.

### 2. Segments

[Segments](https://app.crowdpower.io/segments) are a way of automatically grouping your customers by a set of rules. You can use segments to send messages to specific groups of people.

### 3. Events

[Events](https://app.crowdpower.io/events) are key actions your customers take, like when they sign up or purchase a plan. Events can be generic or specific to your product. When you create an event for a customer, the event is added to your project, and then added to the event timeline on the customer's profile.

### 4. Traits

[Traits](https://app.crowdpower.io/traits) are attributes assigned to a customer. These attributes can be anything, like the name of a plan the customer is currently on. When you create a trait for a customer, the trait is added to your project, and then added to the customer's profile.

### 5. Tags

[Tags](https://app.crowdpower.io/tags) are used to identify and group customers. You can tag customers and then use these tags to target messages to specific people.

### 6. Automations

[Automations](https://app.crowdpower.io/automations) are used to automatically send messages to customers (or perform one more actions) when a trigger is fired. A trigger could be fired when a customer performs an event, enters a segment, or visits a page. Once this happens, the automation begins for the customer, and it runs through a series of actions until the automation ends. The most common automation is an onboarding campaign — where a customer signs up (trigger) and a series of emails are sent (actions).

### 7. Broadcasts

[Broadcasts](https://app.crowdpower.io/broadcasts) are used to email announcements to your customers. They are meant to be used sparingly when you release new features or have something important to say. When a customer unsubscribes from a broadcast, they are unsubscribing from all of them.

### 8. Templates

[Templates](https://app.crowdpower.io/templates) are pre-designed ready-to-use emails that can be used in your automations and broadcasts. The default template is the starting point for every new email you create.

### 9. Integrations

We have a number of native [integrations](https://app.crowdpower.io/settings/integrations) that work with CrowdPower, as well as an app on [Zapier](https://zapier.com/apps/crowdpower). Integrations can add new events, segments, traits, and automation actions to your project. The most common use cases are automation actions, like SMS.


# JavaScript Tag

The CrowdPower JavaScript Tag is a web beacon that monitors and records user activity and sends it securely to your CrowdPower project.

{% hint style="warning" %}
Variables throughout this documentation are denoted with brackets. For example: '\<name>'. You must provide this information from your application **without** the brackets. For example: 'Peter Gibbons'.
{% endhint %}

To initialize the JavaScript tag, paste this code before the closing body tag on your website. You can retrieve your project’s public key in [Settings](https://app.crowdpower.io/settings).

```javascript
<cp-root></cp-root>
<script>
  window.cp=window.cp||function(){(cp.q=cp.q||[]).push(arguments)};
  window.cp('init', '<project_public_key>');
</script>
<script async src="https://tag.crowdpower.io/js/app.js"></script>
```

Once the JavaScript tag is installed, you will be able to send customer data to CrowdPower using the methods outlined in the following pages.


# Identify Customer

Creates a new customer or updates an existing customer record.

When a customer signs up or logs into your website, you should call the `identify` method first. This will create or update the customer record in CrowdPower. You will also want to call this method whenever something about the customer record changes — like if they are now a paying customer, or they updated their profile on your website.

```javascript
<script>
  window.cp('identify', {
    user_id: '<user_id>', // Unique user ID (required)
    email: '<email>', // Email address
    name: '<name>', // Full name (splits into first and last name)
  });
</script>
```

You may also include these additional properties...

```javascript
<script>
  window.cp('identify', {
    ...
    first_name: '<first_name>', // First name, prioritized over name
    last_name: '<last_name>', // Last name, prioritized over name
    signed_up_at: '<signed_up_at>', // Signup date as a unix timestamp
    custom_attributes: {
      '<key>': '<value>', // Optional custom attributes
    }
  });
</script>
```

{% hint style="info" %}
The preferred method for sending in custom attributes is to use snake\_case for keys, and UNIX timestamps (in seconds) for date values.

Custom attributes can be formatted in the [Traits](https://app.crowdpower.io/traits) section to be displayed to you as a string, boolean, or date.
{% endhint %}


# Create Customer Event

Creates a new project event, if one does not exist, and a new event for the customer’s timeline.

When a customer performs an action on your website, you should call the `event` method. This will add a new event in your project the first time it is called, and add a new event in the customer’s timeline on their CrowdPower profile. You can pass along key/value pairs (properties) to go along with the event. These properties should relate to the action the customer just performed. For example, if the customer purchased a plan, the action may be called *Purchased Plan*, and a property may be called *plan\_name*.

```javascript
<script>
  window.cp('event', {
    'action': '<action>',
    'properties': {
      '<key>': '<value>', // Optional properties
    }
  });
</script>
```

{% hint style="info" %}
The preferred method for sending in properties is to use snake\_case for keys, and UNIX timestamps (in seconds) for date values.

Properties can be formatted in the [Events](https://app.crowdpower.io/events) section to be displayed to you as a string, boolean, or date.
{% endhint %}


# Create Customer Charge

Creates a new charge for the customer and updates their charge summary.

If you would like to manually record charges vs. connecting your Stripe account, you can call the `charge` method. This method takes 1 argument, which is the amount that was charged in the smallest currency unit. CrowdPower has a built in way of keeping track of charge summaries, which can be used to target specific customers in your automations.

```javascript
<script>
  window.cp('charge', {
    amount: '<amount>', // Amount in smallest currency unit
  });
</script>
```


# Create Customer Tag

Applies a tag to a customer. If a tag does not exist with the name, it will make a new one.

You can tag your customers manually in the CrowdPower console, but if you would like to tag a customer automatically with the JavaScript Tag, you can do so using the following method. If no tag exists in your project, it will create a new one for you, and then apply it to the customer.

```javascript
<script>
  window.cp('tag', {
    name: '<tag_name>', // The name of the tag
  });
</script>
```


# Create Page View

Logs a page view for a customer.

The CrowdPower tag automatically records page views for identified customers, but if you’re running a single-page app (SPA), you may need to call the `page` method manually from your router file.

If you are running a multi-page app, like Wordpress, you can skip this step.

```javascript
<script>
  window.cp('page');
</script>
```


# Prompt for Push

Request to send web push notifications to the authenticated user.

In order to send browser-based push notifications to your customers, you will need to request permission to do so. This command will display a system prompt for the user to grant access. You will also need to have the CrowdPower [service-worker.js](https://app.crowdpower.io/service-worker.js) file installed in the root of your website.

```javascript
<script>
  window.cp('push');
</script>
```

{% hint style="warning" %}
Before requesting for permission to send push notifications, you **must** install the CrowdPower Service Worker in the root of your website; typically the /public directory.&#x20;

[Download Service Worker](https://app.crowdpower.io/service-worker.js)
{% endhint %}


# Beacon API

Your project has public, secret, and application keys that can be used to access all API endpoints. These keys never expire, but they can be rolled at any time.

### Beacon API

The Beacon API is the same API used by the CrowdPower JavaScript tag to identify customers and record events, and page views. This means your project’s public key can be used to access these endpoints — as well as a secret or application key. You can find your keys in [Settings](https://app.crowdpower.io/settings).

To authorize, send in your key as an Authorization header:

```javascript
Authorization: "Bearer <project_secret_key>"
```

You may also pass the key in as a request parameter:

```javascript
api_key: "<project_secret_key>"
```


# Identify Customer

Creates a new customer or updates an existing customer record.

## Create Customer

<mark style="color:green;">`POST`</mark> `https://beacon.crowdpower.io/customers`

#### Request Body

| Name                                       | Type    | Description                                                                          |
| ------------------------------------------ | ------- | ------------------------------------------------------------------------------------ |
| user\_id<mark style="color:red;">\*</mark> | string  | A unique ID for the user.                                                            |
| name                                       | string  | The user’s name. If provided, will be split up into first and last name.             |
| first\_name                                | string  | The user’s first name. Prioritized over name field, if both are included in request. |
| last\_name                                 | string  | The user’s last name. Prioritized over name field, if both are included in request.  |
| email                                      | string  | The user’s email address. Required if user\_id is not present.                       |
| phone                                      | string  | The user’s phone number. For best results use E.164 formatting.                      |
| signed\_up\_at                             | integer | When the user signed up to your service. UNIX timestamp in seconds.                  |
| ip                                         | string  | The user’s IP address.                                                               |
| custom\_attributes                         | object  | Information about the user, sent as key/value pairs. Use snake\_case for key names.  |
| update\_session                            | boolean | Whether or not to update the user’s session. Defaults to true.                       |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "code": 200,
  "data": null
}
```

{% endtab %}
{% endtabs %}

## Create Multiple Customers

<mark style="color:green;">`POST`</mark> `https://beacon.crowdpower.io/customers/bulk`

#### Path Parameters

| Name                                        | Type  | Description                   |
| ------------------------------------------- | ----- | ----------------------------- |
| customers<mark style="color:red;">\*</mark> | array | An array of customer objects. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "code": 200,
  "data": null
}
```

{% endtab %}
{% endtabs %}


# Create Customer Event

Creates a new project event, if one does not exist, and a new event for the customer’s timeline.

## Create Customer Event

<mark style="color:green;">`POST`</mark> `https://beacon.crowdpower.io/events`

#### Request Body

| Name                                       | Type    | Description                                                                            |
| ------------------------------------------ | ------- | -------------------------------------------------------------------------------------- |
| user\_id<mark style="color:red;">\*</mark> | string  | The unique ID for the user.                                                            |
| action<mark style="color:red;">\*</mark>   | string  | The action the user performed.                                                         |
| properties                                 | object  | Information about the event, sent as key/value pairs. Use snake\_case for key names.   |
| created\_at                                | integer | When the event happened. Automatically set if not provided. UNIX timestamp in seconds. |
| email                                      | string  | The user’s email address. Required if user\_id is not present.                         |
| update\_session                            | boolean | Whether or not to update the user’s session. Defaults to true.                         |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "code": 200,
  "data": null
}
```

{% endtab %}
{% endtabs %}

## Create Multiple Customer Events

<mark style="color:green;">`POST`</mark> `https://beacon.crowdpower.io/events/bulk`

#### Request Body

| Name                                       | Type   | Description                                                    |
| ------------------------------------------ | ------ | -------------------------------------------------------------- |
| user\_id<mark style="color:red;">\*</mark> | string | The unique ID for the user.                                    |
| events<mark style="color:red;">\*</mark>   | array  | An array of event objects.                                     |
| email                                      | string | The user’s email address. Required if user\_id is not present. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "code": 200,
  "data": null
}
```

{% endtab %}
{% endtabs %}


# Create Customer Charge

Creates a new charge for the customer and updates their charge summary.

## Create Customer Charge

<mark style="color:green;">`POST`</mark> `https://beacon.crowdpower.io/charges`

#### Request Body

| Name                                       | Type    | Description                                                                              |
| ------------------------------------------ | ------- | ---------------------------------------------------------------------------------------- |
| user\_id<mark style="color:red;">\*</mark> | string  | The unique ID for the user.                                                              |
| amount<mark style="color:red;">\*</mark>   | integer | The amount charged in the smallest currency unit.                                        |
| created\_at                                | integer | When the charge happened. Automatically set, if not provided. UNIX timestamp in seconds. |
| email                                      | string  | The user’s email address. Required if user\_id is not present.                           |
| update\_session                            | boolean | Whether or not to update the user’s session. Defaults to true.                           |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "code": 200,
  "data": null
}
```

{% endtab %}
{% endtabs %}

## Create Multiple Customer Charges

<mark style="color:green;">`POST`</mark> `https://beacon.crowdpower.io/charges/bulk`

#### Request Body

| Name                                       | Type   | Description                                                    |
| ------------------------------------------ | ------ | -------------------------------------------------------------- |
| user\_id<mark style="color:red;">\*</mark> | string | The unique ID for the user.                                    |
| charges<mark style="color:red;">\*</mark>  | array  | An array of charge objects.                                    |
| email                                      | string | The user’s email address. Required if user\_id is not present. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "code": 200,
  "data": null
}
```

{% endtab %}
{% endtabs %}


# Create Customer Tag

Applies a tag to a customer. If a tag does not exist with the name, it will make a new one.

## Create Customer Tag

<mark style="color:green;">`POST`</mark> `https://beacon.crowdpower.io/tags`

#### Request Body

| Name                                       | Type    | Description                                                    |
| ------------------------------------------ | ------- | -------------------------------------------------------------- |
| user\_id<mark style="color:red;">\*</mark> | string  | The unique ID for the user.                                    |
| name<mark style="color:red;">\*</mark>     | string  | The name of the tag.                                           |
| email                                      | string  | The user’s email address. Required if user\_id is not present. |
| update\_session                            | boolean | Whether or not to update the user’s session. Defaults to true. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "code": 200,
  "data": null
}
```

{% endtab %}
{% endtabs %}

## Create Multiple Customer Tags

<mark style="color:green;">`POST`</mark> `https://beacon.crowdpower.io/tags/bulk`

#### Request Body

| Name                                       | Type   | Description                                                    |
| ------------------------------------------ | ------ | -------------------------------------------------------------- |
| user\_id<mark style="color:red;">\*</mark> | string | The unique ID for the user.                                    |
| tags<mark style="color:red;">\*</mark>     | array  | An array of tag objects.                                       |
| email                                      | string | The user’s email address. Required if user\_id is not present. |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}


# Track

The track endpoint is a newer endpoint that can be used to create or update customers, and also send events, charges, and tags in for them using one single API call.

## Create Customers, Events, Charges, Tags

<mark style="color:green;">`POST`</mark> `https://beacon.crowdpower.io/track`

#### Request Body

| Name                                        | Type  | Description                   |
| ------------------------------------------- | ----- | ----------------------------- |
| customers<mark style="color:red;">\*</mark> | array | An array of customer objects. |
| customers.\*.events                         | array | An array of event objects.    |
| customers.\*.charges                        | array | An array of charge objects.   |
| customers.\*.tags                           | array | An array of tag objects.      |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "success": true,
  "code": 200,
  "data": null
}
```

{% endtab %}
{% endtabs %}


# Importing Customers

There are a number of ways you can import customer data into CrowdPower, both directly through our APIs and web app, or through 3rd party platforms.

### JavaScript Tag

The best way to import your customer data is with the CrowdPower JavaScript Tag. With just a few lines of code, you’ll be able to send in customers, events, page views, and charges.

{% content-ref url="/pages/-MVmfyVjcnRM3OkrefZY" %}
[JavaScript Tag](/getting-started/javascript-tag)
{% endcontent-ref %}

### Beacon API

You can also send in customer data with our server-side API. The Beacon API is what the JavaScript Tag uses behind the scenes. You can ping all of the endpoints that the tag uses from your server, as well.

{% content-ref url="/pages/-MVmc8T0PYnKmgWyPBms" %}
[Identify Customer](/getting-started/beacon-api/identify-customer)
{% endcontent-ref %}

### Segment

[Segment](https://segment.com) is a Customer Data Platform by [Twilio](https://twilio.com) that can aggregate your data and distribute it to CrowdPower, as well as several other services. With Segment, you don’t need to worry about integrating with multiple services. Sending data into CrowdPower is as simple as flipping a switch. Get started with our integration on Segment, [here](https://app.crowdpower.io/install/segment).

### Stripe

As a Verified Stripe Partner, we have a deep integration with Stripe that pulls in customer data and updates events based on Stripe billing activity. This integration is a useful complement to other methods of importing customers, as it keeps their subscription and charges synced with the platform. Get started with our integration with Stripe, [here](https://app.crowdpower.io/install/stripe).

{% content-ref url="/pages/-MVwk2Oqhp1t5NBgGv2Z" %}
[Stripe](/integrations/stripe)
{% endcontent-ref %}

### Zapier

[Zapier](https://zapier.com) is a service that connects one app to another. You can use it to automatically send in customer data from a Google Sheet, or a 3rd party CRM, to CrowdPower whenever a new record is added. Get started with our integration on Zapier, [here](https://app.crowdpower.io/install/zapier).

### CSV Import

If you have a CSV file, you can import customers in bulk. Click the import (+) option on the [Customers](https://app.crowdpower.io/customers) page, and click on the Upload CSV tab. The CSV upload can create or update existing customers, along with traits.

### Email Import

If you need to quickly add a customer via their email address, you can do so with the import (+) option on the [Customers](https://app.crowdpower.io/customers) page. Simply type in 1 or more email addresses and new, blank customers will be created.


# Basic Email Setup

CrowdPower uses your own domain name to send emails to your customers. We'll walk you through the process of configuring email.

### Sending Domain

In order to send emails through CrowdPower, you’ll need to add a sending domain. The process is simple and straightforward. As long as you own a domain name, and you have access to your DNS records, you’re good to go. Just head over to the [Sending Domain](https://app.crowdpower.io/settings/domain) page and add the domain name you would like to use. This will be the domain name for all senders of all emails sent from your CrowdPower project.

Once added, the domain name belongs to your company on CrowdPower and cannot be taken by any other company. You may use it across projects in your company, or add different domains for each project.

{% hint style="warning" %}
It is important that you DO NOT spam your customers. Not only will it negatively impact your domain’s reputation, but it could result in temporarily disabling your account.

We have a zero tolerance policy on spam, and intentionally spamming customers will result in a permanent ban.&#x20;
{% endhint %}

### Verifying Your Domain

Once you add your sending domain, you'll see some DNS records. Add these DNS records to your DNS zone file. If you need help with this step, feel free to contact us and we'll walk you through it. Once the records have been added, click the Verify button. Your edits may take up to 15 minutes to verify. Once your domain has been successfully verified, you're ready to send your first email.

### Senders

Once you connect a domain name, we create your first sender. You can always change the name or [make new senders](https://app.crowdpower.io/settings/senders). When composing an email, you'll get to select which sender to use for it. The one default sender on your account is the one that will be pre-selected when composing any new email. It will also be used to send test emails for templates.


# Advanced Email Setup

Send emails from your own mail server.

### SMTP Setup

You can connect your own mail server to CrowdPower to send email from your own server and bypass any sending limits you may have on your account. To do this, edit the [SMTP settings](https://app.crowdpower.io/settings/domain/advanced) in your project.

You'll need to provide the following credentials:

* **Host** - The host address of the SMTP server
* **Port** - The SMTP port (25, 465, 587, 2525)
* **Username** - The username for the SMTP server
* **Password** - The password for the SMTP server

{% hint style="info" %}
SMTP sending is not currently available for sending Broadcasts.
{% endhint %}

### SMTP Senders

To send email from your own mail server from CrowdPower, you'll need to add an SMTP sender after setting your SMTP credentials. The SMTP sender lets our systems know that if you're sending an email with this sender, use your server instead of ours.

{% hint style="info" %}
After you're done configuring SMTP, you may want to send a test to yourself before turning on any automations or sending any broadcasts.
{% endhint %}


# Smart Sending

Worried about sending too many messages to the same customer? With Smart Sending, we make sure they won’t be inundated with messages.

To make sure each customer isn't getting inundated with messages, we created a feature called Smart Sending. When Smart Sending is turned on, an email will not get sent to the customer if one was already sent to them in the send window across all automations and broadcasts in your project.

The send window can be adjusted in [Options](https://app.crowdpower.io/settings/options). By default, all new projects have a window of 3 days, and Smart Sending is enabled on all new automations and broadcasts.


# Working with Sessions

Sessions are tracked automatically for each customer if sent to CrowdPower via the JavaScript tag or Beacon API.

### Session Traits

There are 2 key traits that appear on each customer record pertaining to sessions:

* **Last Seen** - The date the customer was last tracked by the JavaScript Tag or Beacon API.
* **Sessions** - The total number of sessions logged for the customer over time.

{% hint style="info" %}
A 3rd trait, **First Seen**, is the date the customer was first added to CrowdPower, and will always be populated. It is not related to sessions.
{% endhint %}

### Session Timeout

All sessions are based on a **30-minute** window by default. The session count is incremented only if the customer is inactive for more than 30 minutes before coming back to your website. You can adjust this window in[ Settings](https://app.crowdpower.io/settings/options).

### Updating Sessions

Sessions are updated by default, but you can prevent this from happening by passing in the **update\_session** key on all Beacon API calls. Set the value to false to prevent logging new sessions. This could be useful if you're sending historical data in.

```javascript
{
    update_session: false
}
```

{% hint style="warning" %}
The update\_session key cannot be used with the Segment integration.
{% endhint %}


# Working with Traits

Traits are attributes applied to each customer on CrowdPower.

### About Traits

[Traits](https://app.crowdpower.io/traits) are attributes assigned to a customer. These attributes can be anything, like the name of a plan the customer is currently on. When you create a trait for a customer, the trait is added to your project, and then added to the customer's profile.

### Custom Attributes

When sending in custom information about a customer, you can pass in a set of key/value pairs called `custom_attributes`. You can do this easily with the JavaScript tag or from your server with the Beacon API. When sending in data, here are some guidelines to follow:

1. Keys should be formatted as snake\_case, but we do not require it.
2. Keys must be strings.
3. Keys are case sensitive.
4. Keys may not include spaces or punctuation, other than a dash or underscore.
5. Keys may not exceed 50 characters.
6. Values must be strings, booleans, or numbers.
7. Date values should be sent as UNIX timestamps (in seconds).

{% hint style="warning" %}
If you're sending custom attributes from a third party service, like Segment or Zapier, make sure the keys follow these guidelines or the API will return an error.
{% endhint %}

### Formatting Traits

Once you send your data to CrowdPower, you may want to format how that data is displayed to you. You can do this in the [Traits](https://app.crowdpower.io/traits) section. This section lists all the traits available to your project. Click on any trait to edit it. You'll see 2 options for formatting traits.

The **type** tells CrowdPower to treat the value as a string, number, boolean, or date.

The **format** tells CrowdPower to to display the type in a particular way. For example, a date may be formatted as just the date, the date and time, or a relative time.

Here are all the ways you can format traits:

| Type    | Format        |
| ------- | ------------- |
| string  | text          |
| string  | email         |
| string  | url           |
| number  | numeric       |
| number  | currency      |
| boolean | yes/no        |
| boolean | true/false    |
| boolean | on/off        |
| date    | date only     |
| date    | date + time   |
| date    | relative time |

### Renaming Traits

Once inserted, a trait has a field that cannot be changed. That field is the key you originally provided in the API call. You can change how the field is displayed to you by editing the name. Once changed, it will update across all of your customers.

### Deleting Traits

You can delete custom traits, and they'll be removed from all customer profiles. However, if the trait is sent back in again, it will reappear. You can also change the visibility of a trait, if you do not wish to see it in customer profiles, lists, or segments.


# Working with Phone Numbers

Phone numbers can be used as customer traits or event properties, and optionally used in automations to send SMS messages via 3rd party integrations.

When sending phone numbers into CrowdPower, it is best to use the E.164 standard. E.164 is the international telephone numbering plan that ensures each device on the Public Switched Telephone Network (PSTN) has a globally unique number. This number makes sure phone calls and text messages can be correctly routed to phones in different countries.

E.164 numbers are formatted: **\[+] \[country code] \[area code and number]** and can have a maximum of 15 digits.

An example of a US number in E.164 format is: **+15165555555**


# Personalizing Messages

You can personalize the body of your emails with variables that use customer traits or automation trigger properties as inputs. CrowdPower uses [Liquid](https://shopify.github.io/liquid/) — an open-source template language creating my Shopify — to customize your email body copy for each customer that receives it. In fact, you can use Liquid rules on pretty much any block of copy an automation action uses, including messages in Slack and Discord alerts.

Our email builder, along with some text inputs include a "Variable" dropdown menu that can assist you in adding variables to your copy, but the Liquid template language is actually quite robust. There are a number of things you can do with the language, like add conditionals to your copy, or transform numbers with mathematical formulas.

### Filters

Filters take an input value, apply a filter to it, and then return a result. They may also be chained together to transform an input in a number of steps. The following are some examples of filters you can apply to your variables:

<table><thead><tr><th width="225.04126919616974">Filter</th><th width="322.24213310097883">Input</th><th>Output</th></tr></thead><tbody><tr><td>capitalize</td><td>{{ "hello" | capitalize }}</td><td>Hello</td></tr><tr><td>date</td><td>{{ 1634497325 | date: "%Y" }}</td><td>2021</td></tr><tr><td>default</td><td>{{ "" | default: "Hello" }}</td><td>Hello</td></tr><tr><td>divided_by</td><td>{{ 4 | divided_by: 2 }}</td><td>2</td></tr><tr><td>downcase</td><td>{{ "Hello" | downcase }}</td><td>hello</td></tr><tr><td>minus</td><td>{{ 3 | minus: 2 }}</td><td>1</td></tr><tr><td>number_to_currency</td><td>{{ 100 | number_to_currency: "USD" }}</td><td>$1.00</td></tr><tr><td>number_to_formatted</td><td>{{ 1000 | number_to_formatted }}</td><td>1,000</td></tr><tr><td>plus</td><td>{{ 3 | plus: 2 }}</td><td>5</td></tr><tr><td>round</td><td>{{ 3.6 | round }}</td><td>4</td></tr><tr><td>strip</td><td>{{ " Hello " | strip }}</td><td>Hello</td></tr><tr><td>times</td><td>{{ 3 | times: 2 }}</td><td>6</td></tr><tr><td>truncate</td><td>{{ "Hello" | truncate: 2 }}</td><td>He...</td></tr><tr><td>upcase</td><td>{{ "Hello" | upcase }}</td><td>HELLO</td></tr></tbody></table>

### Conditionals

You can use if/else conditionals in your body copy. Liquid includes many logical and comparison operators. You can use operators to create logic with [control flow](https://shopify.github.io/liquid/tags/control-flow/) tags. For example:

```
{% if customer.plan == "Pro" %}
    Thanks for becoming a Pro subscriber!
{% endif %}
```

The following are operators you can use in your control flow tags:

<table><thead><tr><th width="150">Operator</th><th>Description</th></tr></thead><tbody><tr><td>==</td><td>equals</td></tr><tr><td>!=</td><td>does not equal</td></tr><tr><td>></td><td>greater than</td></tr><tr><td>&#x3C;</td><td>less than</td></tr><tr><td>>=</td><td>greater than or equal to</td></tr><tr><td>&#x3C;=</td><td>less than or equal to</td></tr><tr><td>or</td><td>logical or</td></tr><tr><td>and</td><td>logical and</td></tr></tbody></table>

### Defaults

The default filter sets a default value for any variable with no assigned value. The filter will show its value if the input is `nil`, `false`, or `empty`. It is a good idea to use this filter on all of your variables.

### Further Reading

This is just a small sample of the personalization you can accomplish with the Liquid template language. For complete reference, visit the Liquid docs [here](https://shopify.github.io/liquid/filters/round/).


# Push Notifications

You can send push notifications with Chrome and all modern browsers using the CrowdPower Service Worker and JavaScript Tag.

### Installation

To get started with web push notifications, follow these steps:

1. Download the [CrowdPower Service Worker](https://app.crowdpower.io/service-worker.js).
2. Install the service worker in the root of your website; typically the /public directory.
3. Install the [CrowdPower JavaScript Tag](/getting-started/javascript-tag).
4. Execute the **push** command to request for permission to send push notifications. This only needs to be called once per customer. For example, upon sign up.

### Usage

To send a push notification to a customer, simply add the Push Notification action to an automation. If the customer has granted access to send them push notifications, they will receive it. Push notifications may have a **title**, **body**, and **URL**, and may include dynamic information about the customer, using variables.


# Unsubscribe Groups

### About Unsubscribe Groups

Unsubscribe groups are used to allow your customers to unsubscribe from certain types of emails, but not others, like critical account notifications. When a customer clicks the unsubscribe link in your email, they'll be taken to a page that will immediately unsubscribe them from the group that was used in your email settings. Additionally, they will have the option of unsubscribing from all email correspondence from CrowdPower.

By using multiple unsubscribe groups for your email communications, you may avoid losing email communication with a customer that no longer wishes to get feature announcements, but still wishes to receive account notifications, for example.

### Editing Unsubscribe Groups

You can add new unsubscribe groups in [Settings](https://app.crowdpower.io/settings/unsub-groups). Your project should already have 2 groups. When you compose an email, one of these groups will be pre-selected.

* **Notifications** - Default for automations.
* **Announcements** - Default for broadcasts.


# Discord

Get alerts in Discord based on customer behavior.

With our native Discord integration, you can send alerts to yourself or your team when a customer takes an action on your website, like signs up or purchases a plan. The connection uses OAuth, so it's as easy as clicking a button and authorizing the app for your team on Discord.

### Automations

Once connected, you can add the Discord action to an automation. A simple example would be to trigger an automation when a customer performs a "Sign Up" event. Once triggered, you can fire the Discord action to send you an alert containing information about who performed the event. And with variables, you can include any customer trait or trigger property along with the payload in the Message field.

{% hint style="info" %}
Currently, this integration uses the channel configured for the webhook to send alerts to.
{% endhint %}

### Installation

Connect your Discord account in [Integrations](https://app.crowdpower.io/settings/integrations).


# Slack

Get alerts in Slack based on customer behavior.

With our native Slack integration, you can send alerts to yourself or your team when a customer takes an action on your website, like signs up or purchases a plan. The connection uses OAuth, so it's as easy as clicking a button and authorizing the app for your organization on Slack.

### Automations

Once connected, you can add the Slack action to an automation. A simple example would be to trigger an automation when a customer performs a "Sign Up" event. Once triggered, you can fire the Slack action to send you an alert containing information about who performed the event. And with variables, you can include any customer trait or trigger property along with the payload in the Message field.

{% hint style="info" %}
You can select any channel in your Slack organization to receive the alert. When selecting a private channel, make sure the CrowdPower app has been invited to the channel on Slack.
{% endhint %}

### Installation

Connect your Slack account in [Integrations](https://app.crowdpower.io/settings/integrations).


# Stripe

Sync customer data and message your customers based on Stripe billing events.

{% hint style="info" %}
CrowdPower is a [Stripe Verified Partner](https://stripe.com/partners/crowdpower) and listed in Stripe’s app directory.
{% endhint %}

With our native Stripe integration, you can sync your Stripe customers with your customer data on CrowdPower. Stripe will send in events, like when a new Subscription is created or a charge is made, and you can use those events to trigger automations.

The connection uses OAuth, so it's as easy as clicking a button and authorizing the app for your business on Stripe. Once connected, we'll begin the process of syncing your account. Depending on how many customers you have in Stripe, this may take a while.

When you first sync with Stripe, it will import your customers into CrowdPower, along with their subscription and charge data. If the customers already exist by email address, they will be updated, otherwise new ones will be created. The sync will not populate customer event feeds as that will happen going forward when new events are sent to CrowdPower from Stripe.

### Segments

The integration will add new segments to your project.

* **Active Stripe Subscribers** - Customers with an active subscription.
* **New Stripe Customers** - Customers created in the past month.

### Events

The integration will add new events to your project and send in billing events as they occur. These events will appear in customer profiles and can be used to trigger automations.

* **Stripe Subscription Created** - Occurs when a customer is signed up for a new plan.
* **Stripe Subscription Updated** - Occurs when a customer switches plans.
* **Stripe Subscription Deleted** - Occurs when a customer's subscription ends.
* **Stripe Subscription Trial Will End** - Occurs three days before a subscription's trial period is scheduled to end, or when a trial is ended immediately (using `trial_end=now`).
* **Stripe Charge Succeeded** - Occurs when a new charge is created, and is successful.
* **Stripe Charge Failed** - Occurs when a failed charge attempt occurs.
* **Stripe Charge Refunded** - Occurs when a charge is refunded, including partial refunds.
* **Stripe Invoice Upcoming** - Occurs X number of days before a subscription is scheduled to create an invoice that is automatically charged—where X is determined by your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic).

You can read more about Stripe webhook events on their API docs, [here](https://stripe.com/docs/api/events/types).

### Traits

The integration will add new traits to your project that will be included on customer profiles.

<table><thead><tr><th width="332.763702697606">Name</th><th>Field</th></tr></thead><tbody><tr><td>Stripe Customer ID</td><td>stripe.customer_id</td></tr><tr><td>Stripe Created</td><td>stripe.created_at</td></tr><tr><td>Stripe Name</td><td>stripe.name</td></tr><tr><td>Stripe Email</td><td>stripe.email</td></tr><tr><td>Stripe Phone</td><td>stripe.phone</td></tr><tr><td>Stripe Description</td><td>stripe.description</td></tr><tr><td>Stripe Address 1</td><td>stripe.address1</td></tr><tr><td>Stripe Address 2</td><td>stripe.address2</td></tr><tr><td>Stripe State</td><td>stripe.state</td></tr><tr><td>Stripe City</td><td>stripe.city</td></tr><tr><td>Stripe Postal Code</td><td>stripe.postal_code</td></tr><tr><td>Stripe Country</td><td>stripe.country</td></tr><tr><td>Stripe Active Subscription</td><td>stripe.active_subscription</td></tr><tr><td>Stripe Metadata</td><td>stripe.metadata.{key}</td></tr></tbody></table>

### Installation

Connect your Stripe account in [Integrations](https://app.crowdpower.io/settings/integrations).


# Zapier

### Zapier Integration

[Zapier](https://zapier.com/) is a powerful service that connects one app to another app using what they call "Zaps". A Zap consists of a trigger and one or more actions. We built a way to use a CrowdPower campaign action as a trigger on Zapier, which could then be used to send customer data to 3,000+ 3rd party apps on Zapier. Here's an example:

1. You set up an automation on CrowdPower
2. You add a trigger that starts the automation when someone signs up to your website
3. You add an action to send an email to welcome the new customer

Here's where it gets interesting...

You can now add the **Zapier action**, which will tell Zapier to do something now that the customer has reached this point in your CrowdPower automation. What can it do? Pretty much anything. You can add the customer to a Google spreadsheet, a Trello list, a 3rd party CRM, etc. It's up to you.

If this sounds appealing, here's what you need to do get started:

### On Zapier

1. Create a free Zapier account
2. Create a new Zap
3. Select CrowdPower for the trigger
4. The trigger event will be "Campaign Action"
5. Connect your account by entering your project's secret key ([or create a new application key](https://app.crowdpower.io/settings/api-keys))
6. Select one of your campaigns from the list
7. You can skip the test, and proceed to adding actions
8. Follow the steps to add your actions (which will receive the data from your trigger)
9. Turn your Zap on when finished

### On CrowdPower

1. Go to the campaign you selected on Zapier to be used as your trigger
2. Add the Zapier action to your automation
3. Give your action a name (for reference)
4. Optionally pass in a message that can be sent to another app

### Conclusion

Once you turn your CrowdPower automation on, if a customer reaches the Zapier step, it is flagged to be picked up by Zapier - which polls for new data every 15 minutes. Similar to sending an email, we're sending the data to Zapier to do something with it.

With this integration, there is no limit to what you can do with CrowdPower automations. We're excited to see what you come up with.


