# Pickle Help

## Welcome to Pickle Help!

{% content-ref url="/pages/-LFpovrgTxCtOIg4sW5y" %}
[Flows](/flows)
{% endcontent-ref %}

{% content-ref url="/pages/-LOa2lIBtsqYDlBMFVHT" %}
[Flow Logs](/flow-logs)
{% endcontent-ref %}

{% content-ref url="/pages/-LOWjAmBIM-E7EhD3U4C" %}
[Contacts](/contacts)
{% endcontent-ref %}

{% content-ref url="/pages/-LFq2f9b-bl2GYQGBgvL" %}
[API](/api)
{% endcontent-ref %}


# Flows

## What are flows?

Flows allow you to automate all sorts of phone related business logic. There are 2 main types of flows, Call Flows and SMS Flows:

#### **Call flows:**

Call flows are used to control what happens when someone calls one of your Pickle numbers. For example:

* Forwarding incoming calls to another number
* Constructing IVR menus to forward calls to different departments
* Recording calls or voicemails outside of operating hours
* Sending analytics tracking events whenever you get a call

#### **SMS Flows:**

These control what happens when someone SMS's one of your numbers but can also be used for outbound SMS campaigns. For example:

* Auto-respond when someone send an SMS to your phone number
* Send an SMS welcome when someone signs up to your website, product or service
* Send a reminder SMS when an appointment is coming up
* Set up an SMS campaign about a special offer

Check out the [examples](/flows/examples) for more ideas.

## The Basics

### Adding nodes to the flow

Add nodes to the flow by **dragging** them from the sidebar.

![Click and drag to add nodes to the canvas](/files/-LFqL-5O0p9lPVW5Pkqk)

### Connecting Nodes

Nodes are connected together by with a simple **click and drag** of the mouse.

![Click and drag to connect nodes together](/files/-LFqJjIrGwLcCtIEkNgI)

## Publishing Flows

You can save your flow continually as you work on it. It will not take effect until you publish it.


# Triggers


# Incoming SMS

The 'Incoming SMS' node is where your inbound SMS flow begins. Whenever a SMS message is received on the provided phone number, your flow will be triggered.

### Configuration

| **Property** | **Description**                       |
| ------------ | ------------------------------------- |
| Number       | The phone number. Must support flows. |

Note that each number can only be linked to one sms flow. If you attempt to create a second flow using the same number, you will get a warning telling you it is already linked. If you publish the second flow, your first flow will be unlinked.

![](/files/-LOa58NaYXUQE8KBlKze)

### Examples

Every inbound sms flow begins with an 'Incoming Call' trigger. See any example:

{% content-ref url="/pages/-LFqLkEi8z\_G9kviZwVn" %}
[Examples](/flows/examples)
{% endcontent-ref %}


# Incoming Call

The 'Incoming Call' node is where your flow begins. Whenever a phone call is received on the provided phone number, your flow will be triggered.

### Configuration

| **Property** | **Description**                       |
| ------------ | ------------------------------------- |
| Number       | The phone number. Must support flows. |

Note that each number can only be linked to one flow. If you attempt to create a second flow using the same number, you will get a warning telling you it is already linked. If you publish the second flow, your first flow will be unlinked.

![](/files/-LI8mKpOKw03oc-Ok0YK)

### Examples

Every call flow begins with an 'Incoming Call' trigger. See any example:

{% content-ref url="/pages/-LFqLkEi8z\_G9kviZwVn" %}
[Examples](/flows/examples)
{% endcontent-ref %}


# Contact Subscribed

The 'Contact Subscribed' trigger can be used to trigger outbound SMS flows.

### Running the trigger:

After adding this node to your flow, you can trigger the flow in 3 ways:

* From our API
* From our Zapier Plugin
* From the contacts page:
  * Navigate to <https://thinkpickle.com.au/dashboard/contacts>
  * Click '**View**' on a contact.
  * Click '**Subscribe to a flow**'
  * This will trigger the flow for the selected contact.

### Configuration

| **Property** | **Description**                                                                   |
| ------------ | --------------------------------------------------------------------------------- |
| Trigger ID   | This is an automatically generated ID. This will be used to identify this trigger |
| Trigger Name | This will help you identify this trigger.                                         |


# Contact Tagged

The 'Contact Tagged' trigger can be used to trigger outbound SMS flows.

### Running the trigger: <a href="#running-the-trigger" id="running-the-trigger"></a>

After adding this node to your flow, you can trigger the flow in many ways:

* By adding a new contact with the specified tag
* By updating an existing contact, adding the speified tag
* From our Zapier Plugin (adding a new contact)
* By using our API to [add a new contact](/api/contacts#create-contact)

### Configuration <a href="#configuration" id="configuration"></a>

| **Property** | **Description**                                                         |
| ------------ | ----------------------------------------------------------------------- |
| Tag          | The tag name. If this tag is added to a contact, the flow will trigger. |

​


# Conditions


# AB Split

The 'AB Split' node can be used to conduct A/B tests with your callers.

### Configuration

| **Property** | **Description**                                               |
| ------------ | ------------------------------------------------------------- |
| A Path       | Percentage of calls which go down this path.                  |
| B Path       | Percentage of calls which go down this path. (100 - `A Path`) |

### Examples

{% content-ref url="/pages/-LFqS5aCoaKItlqCgvHA" %}
[A/B test 2 paths](/flows/examples/a-b-test-2-paths)
{% endcontent-ref %}


# Time is

Route calls based on the time of day.

### Configuration

| **Property** | **Description**                          |
| ------------ | ---------------------------------------- |
| Operator     | 'less than', 'greater than' or 'between' |
| Value        | Time string, eg) 8:00pm                  |
| Timezone     | Australian timezone                      |

### Examples

{% content-ref url="/pages/-LFqMnJNvOOJ5Yf098MY" %}
[Redirect calls to voicemail](/flows/examples/redirect-calls-to-voicemail)
{% endcontent-ref %}


# Date-time is

Route calls based on the date and time of day. Useful for special period such as Christmas or during a TV ad.

### Configuration

| **Property** | **Description**                          |
| ------------ | ---------------------------------------- |
| Operator     | 'less than', 'greater than' or 'between' |
| Value        | Time string, eg) 30/12/2019 8:00 pm      |
| Timezone     | Australian timezone                      |

### Examples

{% content-ref url="/pages/-LFtD08\_EaxnqN7Sa9AZ" %}
[Track performance of TV ads](/flows/examples/track-performance-of-tv-ads)
{% endcontent-ref %}


# Day is

Route calls based on the day of the week.

### Configuration

| **Property** | **Description**               |
| ------------ | ----------------------------- |
| Operator     | 'is' or 'any of'              |
| Value        | Day of the week. eg) 'Monday' |
| Timezone     | Australian timezone           |

### Examples

{% content-ref url="/pages/-LFqMnJNvOOJ5Yf098MY" %}
[Redirect calls to voicemail](/flows/examples/redirect-calls-to-voicemail)
{% endcontent-ref %}


# Caller's number is

Route calls based on the caller's phone number.

### Configuration

| **Property** | **Description**                                          |
| ------------ | -------------------------------------------------------- |
| Operator     | 'less than', 'greater than', 'between', 'is' or 'any of' |
| Value        | Caller's phone number. eg) 0404 888 888                  |

### Examples

{% content-ref url="/pages/-LFqUhyoZkvwfiSW-GRK" %}
[Block a number](/flows/examples/block-a-number)
{% endcontent-ref %}


# Caller's postcode is

Route calls based on the caller's post code. This will only be known for landline numbers.

| **Property** | **Description**                                          |
| ------------ | -------------------------------------------------------- |
| Operator     | 'less than', 'greater than', 'between', 'is' or 'any of' |
| Value        | Caller's postcode. Eg) 2000                              |


# Caller's state is

Route calls based on the caller's state. This will only be known for landline callers.

### Configuration

| **Property** | **Description**                                          |
| ------------ | -------------------------------------------------------- |
| Operator     | 'less than', 'greater than', 'between', 'is' or 'any of' |
| Value        | Caller's state. 'NSW', 'VIC' etc                         |

### Examples

{% content-ref url="/pages/-LFqPg3O8ZZvSClxW268" %}
[Forward calls to the closest store](/flows/examples/forward-calls-to-the-closest-store)
{% endcontent-ref %}


# Actions


# Say/Play

This allows you to play music or messages to either the caller or the callee.&#x20;

### Configuration

| **Property**    | **Description**                                                                                         |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| Number of loops | How many times should the message be played.                                                            |
| Message         | Message that will be converted to audio using speech synthesis. Supports [variables](/flows/variables). |
| Audio           | Audio recording / hold music.                                                                           |

{% hint style="info" %}
If you provide both a 'Message' and 'Audio'. Your audio will take priority.
{% endhint %}

### Examples

{% content-ref url="/pages/-LIO7KEC2iiuHCOJWuV6" %}
[Forward and whisper](/flows/examples/forward-and-whisper)
{% endcontent-ref %}

{% content-ref url="/pages/-LFqIwwNHZ75uUAmydoA" %}
[Record Voicemail](/flows/actions/record-voicemail)
{% endcontent-ref %}


# Pause

This allows you to delay the pickup of a call or pause and wait for user input. If this is the first [Action](/flows/actions) node in your flow it will delay the pickup of the call. The caller will hear the dial tone whilst paused.

### Configuration

| **Property** | **Description**           |
| ------------ | ------------------------- |
| Duration     | Time to wait (in seconds) |


# Forward Call

This can be used to forward a call to another number.

### Configuration

| **Property** | **Description**                                                                       |
| ------------ | ------------------------------------------------------------------------------------- |
| Number       | The phone number to forward to. eg) **+61404123456** or **0404123456**                |
| Record Call  | Should the call be recorded? The call recording will be accessible in your call logs. |

### Examples

{% content-ref url="/pages/-LIO7KEC2iiuHCOJWuV6" %}
[Forward and whisper](/flows/examples/forward-and-whisper)
{% endcontent-ref %}

{% content-ref url="/pages/-LFqPg3O8ZZvSClxW268" %}
[Forward calls to the closest store](/flows/examples/forward-calls-to-the-closest-store)
{% endcontent-ref %}


# Record Voicemail

This will record a voicemail which will be accessible in your call logs.

### Configuration

| **Property**            | **Description**                                                                |
| ----------------------- | ------------------------------------------------------------------------------ |
| Finish recording on key | When the user presses this key the recording will end.                         |
| Play beep               | Should a beep be played to signify recording has begun.                        |
| Transcribe              | Voice to text transcription. Transcription will be available in the call logs. |

### Example

{% content-ref url="/pages/-LFqMnJNvOOJ5Yf098MY" %}
[Redirect calls to voicemail](/flows/examples/redirect-calls-to-voicemail)
{% endcontent-ref %}


# Gather input

&#x20;Read a message out to the caller and listen for their key-pad input.

### Configuration

| **Property**    | **Description**                                                                                         |
| --------------- | ------------------------------------------------------------------------------------------------------- |
| Number of loops | How many times should the message be played.                                                            |
| Message         | Message that will be converted to audio using speech synthesis. Supports [variables](/flows/variables). |
| Audio           | Audio recording.                                                                                        |

{% hint style="info" %}
Info you provide both a 'Message' and 'Audio'. Your audio will take priority.
{% endhint %}

![](/files/-LIOKhHqQRHUfqP9LdXe)

The 'Gather input' node has output connections for every keypad button. If the user presses a button that does not have a linked node, the call will hang up.

### Examples

{% content-ref url="/pages/-LIOJ5P3Iw1rJVsq93oR" %}
[IVR Menus](/flows/examples/ivr-menus)
{% endcontent-ref %}


# Reject Call

This allows you to reject / hang up a call.  This is very useful for blocking unwanted calls.

### Configuration

| **Property**   | **Description**                                                      |
| -------------- | -------------------------------------------------------------------- |
| Rejection Tone | Changes the sound the caller hears. 'Note in Service' or 'Line Busy' |

### Example

{% content-ref url="/pages/-LFqUhyoZkvwfiSW-GRK" %}
[Block a number](/flows/examples/block-a-number)
{% endcontent-ref %}


# Send Analytics Event

This action allows you to send custom analytics events to [Segment](https://segment.com/). You can then setup Segment to forward this event to any of your other analytics providers such as Google Analytics, Facebook,  Mixpanel, Heap etc. The full list can be found [here](https://segment.com/catalog#integrati).

### Configuration

| **Property**     | **Description**                               |
| ---------------- | --------------------------------------------- |
| Event Name       | The segment event name                        |
| Event Properties | Custom segment properties                     |
| Source ID        | Segment Source ID (get this from segment.com) |
| Write Key        | Segment Write Key (get this from segment.com) |

### Finding your Source ID and Write Key

1. Login to segment.com
2. Navigate to **Settings > API Keys** your Source ID and Write Key should be listed here.

![](/files/-LFptapQ4osNl9bUhY4Q)

&#x20; 3\. Paste these settings into the node configuration panel.

![](/files/-LFpu43yU2O_K35PZcH4)

### Event Name and Properties

You will also need to configure an **Event Name** and optional **Event Properties**. These will be used to send a segment [track request](https://segment.com/docs/spec/track/). This will be of the form:

```
{
  "type": "track",
  "event": your-event-name-here,
  "properties": your-custom-event-properties
}
```

### Use Cases

#### Send a 'phone-call' analytics event

![](/files/-LFpwlhHLsIWDadxFOUc)

#### Send a 'voicemail' analytics event when it outside of operating hours

![](/files/-LFpy-BYRX8bpd52BbPe)


# Send Email

This allows you to trigger a notification email, sending details about a call to your email. Often useful to notify you of a voicemail.

### Configuration

| **Property** | **Description**                                             |
| ------------ | ----------------------------------------------------------- |
| Recipient    | Email address of the recipient.                             |
| Subject      | Email subject line. Supports [variables](/flows/variables). |
| Message      | Email message. Supports [variables](/flows/variables).      |


# Send SMS Message

This allows you to send an SMS.

### Configuration

| **Property** | **Description**                                                                                                                                                                                                   |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| From         | The sending phone number. You must have a Mobile number on your account.                                                                                                                                          |
| To           | <p>Destination phone number. Supports <a href="/pages/-LG2ULIMiL3Y-K4JALoO">variables</a>. <br>You'll often want to set <code>--contact.phoneNumber--</code> to send it to a contact's primary phone number. </p> |
| Message      | <p>Message content. Supports <a href="/pages/-LG2ULIMiL3Y-K4JALoO">variables</a>. For example:</p><p><code>Hello --contact.firstName--, thanks for contacting us.</code> </p>                                     |


# Examples


# Redirect calls to voicemail

Need to redirect calls to voicemail outside of operating hours? The following flow demonstrates how that can be achieved.

![](/files/-LFqOqA_7pC7RMWjQbcP)

Note how this flow combined both [Time is](/flows/conditions/time-is) and [Day is](/flows/conditions/day-is) conditions to make forward the calls to voicemail if it is outside of 9-5 Monday to Friday. A more advanced flow may make use of the [Date-time is](/flows/conditions/date-time-is) condition to forward calls to voicemail during special holiday periods such as new years day.


# IVR Menus

&#x20;Ask the caller what they want and route the call accordingly.

![](/files/-LIOJFAotUcsjLNoNXNs)

You can very easily create nested menus by connection [Gather Input](/flows/actions/gather-input) nodes together.


# Forward calls to the closest store

Need to redirect calls to different locations based on the caller's postcode or state? The following flow demonstrates how that can be achieved.

![](/files/-LFqR57rfyyLaOmRHZoD)

Note how multiple [Caller's state is](/flows/conditions/callers-state-is) conditions are chained. Also, it is important to consider that the state is unknown for mobile numbers. In this example, all mobile numbers and callers from overseas or outside QLD, NSW, VIC will be directed to 02 9999 8888.


# A/B test 2 paths

You can also use flows to A/B test various parts of your phone system. The following flow give a very basic demo of how this can be achieved.

![](/files/-LFqTBJQ0pZCPQoED_iz)

Note how the [AB Split](/flows/conditions/ab-split) condition is used to randomly send a caller down 1 of 2 paths. In this example we have a simple[ Say/Play](/flows/actions/say-play) but you would likely have a string of IVR menus using [Gather Input](/flows/actions/gather-input). Finally, you can fire a [Send Analytics Event](/flows/actions/send-analytics-event) action to your analytics provider so you can record the results of your A/B test.


# Block a number

The following flow demonstrates how you can block certain numbers from calling you.

![](/files/-LFqWQOeKawcWQWSWSyW)

If the caller's number is either '0404 123 456' or '0404 222 333' the number will be rejected without charging you. The caller will receive a 'rejected' dial tone as described by the [Reject Call](/flows/actions/reject-call) action.


# Track performance of TV ads

Need to track if someone calls your number during a TV ad? You can do this in two ways, by spinning up a new number or adding a [Date-time](/flows/conditions/date-time-is) is condition to your flow. For example:

![](/files/-LFtEORdLJkuzfl0a_mi)

Note how the [Send Analytics Event](/flows/actions/send-analytics-event) action will run if the call is made during the period the ad is running. This allows you to send the data to your analytics provider for analysis.


# Forward and whisper

When you are forwarding calls to your mobile number or landline, you'll often want to add a call whisper.  This involves playing a message to the callee while the caller continues to hear ringing. It can provide additional information such as the source or purpose of the call to the callee before the call begins and even allow the callee to accept or reject the call based on that information.

![](/files/-LIO7c2O7BID5iVE5Jcj)

Any nodes you connect after a 'Forward Call' block will run silently before the call is forwarded.


# Variables

Many inputs such as the [Say/Play](/flows/actions/say-play) message and [Send Analytics Event](/flows/actions/send-analytics-event) accept variables which will be substituted when possible. Variables are always wrapped in `--`. For example, you could set the Say/Play message to be:

```
You have received a call from --call.From-- with state --call.FromState--
```

These variables will be substituted and the become something like:

```
You have received a call from +61499998888 with state NSW
```

#### Missing variables

Not all variables are always present. For example, if the caller calls from a mobile phone we won't know the `--call.FromCity--`, in this case, the variable will be replaced will be ignored.

## Supported Variables

The available variables change depending on your flow type and trigger.&#x20;

### All Flows:

All flows will have contact variables available for use. These are particularly useful for sending personalised greetings, SMS and emails. Note that these variables will not always be present. We recommend you [sync your users/CRM data](/contacts/adding-contacts#recommended-method) into our contact system so you'll always have access to this data.

| Name                 | Always Present? | Description                                                                        |
| -------------------- | --------------- | ---------------------------------------------------------------------------------- |
| contact.id           | Yes             | Pickle Contact ID                                                                  |
| contact.userId       | No              | User ID in your CRM or database                                                    |
| contact.firstName    | No              | First Name                                                                         |
| contact.lastName     | No              | Last Name                                                                          |
| contact.company      | No              | Company Name                                                                       |
| contact.email        | No              | Email address                                                                      |
| contact.phoneNumber  | No              | Primary phone number                                                               |
| contact.phoneNumbers | No              | Array of other phone numbers. `contact.phoneNumbers[0]` will be the primary number |
| contact.customFields | No              | Custom fields, eg) `contact.customFields.example`                                  |
| contact.tags         | No              | Array of tags, eg) `contact.tags[0]` for the first tag                             |

### Incoming Call Flows:

If you have a Call flow triggered with an '[Incoming Call](/flows/triggers/incoming-call)' trigger:

| **Name**           | **Always present?** | **Description**                           |         |             |           |          |        |               |
| ------------------ | ------------------- | ----------------------------------------- | ------- | ----------- | --------- | -------- | ------ | ------------- |
| call.CallSid       | All incoming calls  | Unique id for the call.                   |         |             |           |          |        |               |
| call.From          | All incoming calls  | From phone number. eg: +61499998888       |         |             |           |          |        |               |
| call.To            | All incoming calls  | To phone number                           |         |             |           |          |        |               |
| call.CallStatus    | All incoming calls  | <p>queued                                 | ringing | in-progress | completed | <br>busy | failed | no-answer</p> |
| call.ForwardedFrom | No                  | Phone number that forwarded this call     |         |             |           |          |        |               |
| call.FromCity      | No                  | The city of the caller                    |         |             |           |          |        |               |
| call.FromState     | No                  | The state or province of the caller       |         |             |           |          |        |               |
| call.FromZip       | No                  | The postal code of the caller             |         |             |           |          |        |               |
| call.FromCountry   | No                  | The country of the caller                 |         |             |           |          |        |               |
| call.ToCity        | No                  | The city of the called party              |         |             |           |          |        |               |
| call.ToState       | No                  | The state or province of the called party |         |             |           |          |        |               |
| call.ToZip         | No                  | The postal code of the caller             |         |             |           |          |        |               |
| call.ToCountry     | No                  | The country of the called party           |         |             |           |          |        |               |

### Incoming SMS Flows:

If you have an SMS flow triggered with an '[lncoming SMS](/flows/triggers/incoming-sms)' trigger:

| **Name**            | **Always present?** | **Description**                                           |
| ------------------- | ------------------- | --------------------------------------------------------- |
| message.MessageSid  | All incoming SMS    | Unique id for the message.                                |
| message.From        | All incoming SMS    | From phone number. eg: +61499998888                       |
| message.To          | All incoming SMS    | To phone number                                           |
| message.Body        | All incoming SMS    | The text body of the message. Up to 1600 characters long. |
| message.NumMedia    | All incoming SMS    | Number of MMS attachments                                 |
| message.FromCity    | No                  | The city of the sender                                    |
| message.FromState   | No                  | The state or province of the sender                       |
| message.FromZip     | No                  | The postal code of the sender                             |
| message.FromCountry | No                  | The country of the sender                                 |

## Inspecting real variables using Flow Logs

After your flow has run once, you'll be able to view the flow log from the flow [log section](/flow-logs#viewing-flow-logs). This will show exactly what the values were for the variables described above. For example:

![](/files/-LOa2eb45rd2tBnNy2Ia)

{% hint style="warning" %}
The variable name shown in Flow Logs have been transformed to make them more readable. For example, `numMedia` becomes `Num Media`. You'll need to use the camel-case version - `numMedia`.
{% endhint %}


# Flow Logs

## What are flow logs?

Flows logs document every time your flow has run. For example, if you have a call flow, every time someone calls your phone number you'll see a new flow log documenting how they progressed through your flow.

This can be very useful for debugging any unexpected behavior or finding out which [variables](/flows/variables) are accessible.

## Viewing flow logs:

* Navigate to [https://thinkpickle.com.au/dashboard/flows](https://thinkpickle.com.au/dashboard/flows/f5d15107-81e3-4598-a7a0-9687883952ec)
* Click '**View**' to open the flow
* In the top toolbar, click '**Logs**'
* This will bring up all the logs for your flow.
* You'll be able to open up each log and see the details of what occurred when that flow ran.


# Numbers

Coming soon.


# Contacts

### What are Contacts?

Your contacts are are anyone that might call or SMS message any of your Pickle numbers. You'll be able to trigger outbound SMS flows to anyone in your contact list. Importantly, you can use their contact information to customise how your Call and SMS flows run.

### Adding Contacts

{% content-ref url="/pages/-LOWjJK1b4-pAd2-u8Cq" %}
[Adding Contacts](/contacts/adding-contacts)
{% endcontent-ref %}


# Adding Contacts

Each time one of your numbers receives a call or sms, we'll add a new contact record for you in order to keep track of all their interactions with your phone numbers. You'll probably want to add other contact information such as their name, company, email etc. Thankfully, all of this can be done automatically whenever a new user signs up to your website or is added to your CRM.

## Recommended method

In order to keep your Pickle contacts in sync with your CRM or user database, we recommend the following.

* Initial [bulk import](/contacts/adding-contacts#bulk-import) of your existing contacts
* **AND**
* [Zapier ](/contacts/adding-contacts#zapier)**OR** our [Contact Create API](/api/contacts) for any new users or lead

## Methods

### Manually

* Navigate to <https://thinkpickle.com.au/dashboard/contacts>
* Click the '**Create Contact**' button

### Bulk Import

* Navigate to <https://thinkpickle.com.au/dashboard/contacts>
* Click '**Import**'
* Download the example CSV
* Export data from your user database or CRM and transform it into the CSV format
* Open your CSV as a text file and past it into the import box
* Click '**Parse and Import**'

{% hint style="info" %}
&#x20;If existing contacts are found with the same '**phoneNumber**', these will be merged.
{% endhint %}

### Zapier

Zapier allows you to connect Pickle with your CRM or analytics provider.

* Sign up to [zapier.com](https://zapier.com)
* Add Think Pickle to a new zap by following this link: \
  <https://zapier.com/platform/public-invite/6866/d9494396af049cf4ecd4c1e3811a481e/>
* Create a '**Trigger**' that triggers when a new lead or user is added to your CRM or database
* Use the Pickle '**Create or Update a Contact**' zapier action to copy your lead or user's data over to a Pickle contact.
* Note, you'll probably want to merge this data with any existing Pickle contacts if their phone numbers match. This means you'll be able to link inbound calls with new users.

![Zapier makes it easy to sync your user database or CRM to Pickle Contacts](/files/-LOWmaH5VSXAvJ28vg_b)

### Api

You can create new contacts via our http API.

{% content-ref url="/pages/-LOWnLMaQzWHtIbqMfgZ" %}
[Contacts](/api/contacts)
{% endcontent-ref %}


# API

### Need to do something more advanced?&#x20;

We have a powerful API for controlling all aspects of your phone system. Some common commands are documented here. For anything more, please contact us directly.

{% content-ref url="/pages/-LOWnjbZEkvEB2OFcHP5" %}
[Auth](/api/auth)
{% endcontent-ref %}

{% content-ref url="/pages/-LOWnLMaQzWHtIbqMfgZ" %}
[Contacts](/api/contacts)
{% endcontent-ref %}

{% hint style="danger" %}
Our API may change. Please contact us before use.
{% endhint %}


# Auth

## Login and get Session Token

<mark style="color:green;">`POST`</mark> `https://portal.iphub.com.au/api/v1/auth/login`

This endpoint will return a session token. This must be used with our other APIs in the Authorization header

#### Query Parameters

| Name     | Type   | Description   |
| -------- | ------ | ------------- |
| username | string | Your email    |
| password | string | Your password |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```javascript
{
    "expiredAt": "2018-10-11T18:34:17+11:00",
    "token": "XXXXXXXXX-YOUR_SESSION_TOKEN_HERE_XXXXXXXXXXXX",
    "ttl": 3600,
    "user": {// user account}
}
```

{% endtab %}
{% endtabs %}


# Contacts

## Create Contact

<mark style="color:green;">`POST`</mark> `https://api.iphub.com.au/api/v1/contacts`

Creates a contact or updates an existing contact.

#### Query Parameters

| Name           | Type   | Description      |         |                                                                                                                 |
| -------------- | ------ | ---------------- | ------- | --------------------------------------------------------------------------------------------------------------- |
| updateExisting | string | <p>'phoneNumber' | 'email' | 'userId'<br><br>If a contact is found with the matching field above, it will be updated instead of created.</p> |

#### Headers

| Name          | Type   | Description                                                 |
| ------------- | ------ | ----------------------------------------------------------- |
| Authorization | string | Authentication token of the form \`bearer ${sessionToken}\` |

#### Request Body

| Name         | Type   | Description                                                            |
| ------------ | ------ | ---------------------------------------------------------------------- |
| firstName    | string | First Name                                                             |
| lastName     | string | Last Name                                                              |
| company      | string | Company                                                                |
| email        | string | Email                                                                  |
| phoneNumbers | array  | <p>Array of phone numbers eg)<br>\['+61404123456', '+61433222444']</p> |
| customFields | object | <p>Key Value object of custom fields<br>{'example': 'some\_value'}</p> |
| userId       | string | User ID in your database or CRM                                        |
| tags         | array  | Array of custom tags. This can be used to trigger flows.               |

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

```
{
    id: string
}
```

{% endtab %}
{% endtabs %}


