> ## Documentation Index
> Fetch the complete documentation index at: https://plivo.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce helper

> Integrate Plivo voice and SMS into Salesforce using the helper library

The Plivo Salesforce Helper library simplifies the process of making Plivo API Calls and generating Plivo XML.

## Prerequisites

1. [Salesforce Developer](https://developer.salesforce.com/) Account.
2. [Java SDK](https://www.oracle.com/technetwork/java/javase/downloads/index.html) >=1.6 version
3. [Apache Ant](https://ant.apache.org/bindownload.cgi) >=1.6 version
4. [Force.com Migration Tool](https://na1.salesforce.com/dwnld/SfdcAnt/salesforce_ant_34.0.zip) plugin for Ant

## Installation

1. Checkout or download the **plivo-salesforce** library from [GitHub](https://github.com/plivo/plivo-salesforce).
   ```sh theme={null}
   git clone https://github.com/plivo/plivo-salesforce.git
   ```
2. Unzip Force.com Migration Tool plugin for Ant and copy the **ant-salesforce.jar** into the **plivo-salesforce** directory you cloned in Step 1.
3. Edit **install/build.properties** to insert your Salesforce username and password. Since you will be using the API to access Salesforce, remember to append your Security Token to your password.
4. Open your command line to the **install** folder, then deploy using Ant:
   ```sh theme={null}
   ant deployPlivo
   ```

This will upload our helper library to your Salesforce Organization and give you access to all of Plivo's functionality with simple, easy to use Apex classes.

## Using the library

Getting started with the Plivo API couldn't be easier.

### Initializing the PlivoRestApi class

```java theme={null}
String api_key = 'Your Auth_ID';
String api_token = 'Your Auth_Token';
PlivoRestAPI api = new PlivoRestAPI(api_key, api_token, 'v1');
```

### Send an SMS

The snippet below shows how you can send an sms.

```java theme={null}
Map<String, String> params = new Map<String, String> ();
params.put('src','1111111111');
params.put('dst','2222222222');
params.put('text','Hello, how are you?');
PlivoMessage message = api.sendMessage(params);
```

Check out this [Getting Started](/docs/messaging/) page or the full [Message API](/docs/messaging/api/message/) documentation for more details.

### Make an Outbound Phone Call

You can make outbound phone calls to landlines, mobiles, and SIP endpoints (e.g., softphones), in any of our [200+ coverage countries](https://www.plivo.com/sms/coverage/)

```java theme={null}
Map<String, String> params = new Map<String, String> ();
params.put('src','1111111111');
params.put('dst','2222222222');
params.put('answer_url', 'https://s3.amazonaws.com/static.plivo.com/answer.xml');
params.put('answer_method','GET');
PlivoCall call = api.makeCall(params);
```

Check out this [Getting Started](/docs/voice/) page or the full [Call API](/docs/voice/api/calls#create-a-call) documentation for more details.

## Methods

Below are all the methods that are present in PlivoRestApi class.

### Account API]\(/api/account/)

| Method                           | Description                        | Mandatory Parameters |
| -------------------------------- | ---------------------------------- | -------------------- |
| **getAccount()**                 | Get details of the account         | -                    |
| **editAccount(parameters)**      | Edit details of the account        | -                    |
| **getSubaccounts(parameters)**   | Get details of all subaccounts     | subauth\_id          |
| **getSubaccount(parameters)**    | Get details of a single subaccount | -                    |
| **createSubaccount(parameters)** | Create a new subaccount            | name                 |
| **editSubaccount(parameters)**   | Edit details of a subaccount       | name                 |
| **deleteSubaccount(parameters)** | Delete a subaccount                | subauth\_id          |

### Application API

| Method                            | Description                     | Mandatory Parameters   |
| --------------------------------- | ------------------------------- | ---------------------- |
| **getApplication()**              | Get details of an application   | app\_id                |
| **editApplication(parameters)**   | Edit details of an application  | app\_id                |
| **getApplications(parameters)**   | Get details of all applications | -                      |
| **createApplication(parameters)** | Create a new application        | app\_name, answer\_url |
| **deleteApplication(parameters)** | Delete an application           | app\_id                |

### Call API

| Method                        | Description                       | Mandatory Parameters  |
| ----------------------------- | --------------------------------- | --------------------- |
| **makeCall(parameters)**      | Make an outbound call             | from, to, answer\_url |
| **makeBulkCall(parameters)**  | Make bulk calls                   | from, to, answer\_url |
| **getCDR(parameters)**        | Get details of a single call      | call\_uuid            |
| **getCDRs(parameters)**       | Get details of all calls          | -                     |
| **getLiveCall(parameters)**   | Get details of a single live call | call\_uuid            |
| **getLiveCalls()**            | Get details of all live calls     |                       |
| **hangupCall(parameters)**    | Hangup a single call              | call\_uuid            |
| **hangupAllCalls()**          | Hangup all calls                  | -                     |
| **transferCall(parameters)**  | Transfer a call                   | call\_uuid            |
| **record(parameters)**        | Start recording a call            | call\_uuid            |
| **stopRecord(parameters)**    | Stop recording a call             | call\_uuid            |
| **play(parameters)**          | Start playing music on a call     | call\_uuid, urls      |
| **stopPlay(parameters)**      | Stop playing music on a call      | call\_uuid            |
| **speak(parameters)**         | Start playing a message on a call | call\_uuid, text      |
| **stopSpeak(parameters)**     | Stop playing a message on a call  | call\_uuid            |
| **sendDigits(parameters)**    | Send digits on a call             | call\_uuid, digits    |
| **hangupRequest(parameters)** | Hangup a call request             | request\_uuid         |

### Conference API

| Method                               | Description                                      | Mandatory Parameters |
| ------------------------------------ | ------------------------------------------------ | -------------------- |
| **getLiveConferences()**             | Get details of all live conference               | -                    |
| **hangupAllConferences()**           | Hangup all conferences                           | -                    |
| **getLiveConference(parameters)**    | Get details of a single live conferenece         | conference\_name     |
| **hangupConference(parameters)**     | Hangup a single conference                       | conference\_name     |
| **hangupMember(parameters)**         | Hangup a single member in a conference           | member\_id           |
| **playMember(parameters)**           | Play music to a member in a conference           | member\_id, url      |
| **stopPlayMember(parameters)**       | Stop playing music to a member in a conference   | member\_id           |
| **speakMember(parameters)**          | Play a message to a Member in a conference       | member\_id, text     |
| **stopSpeakMember(parameters)**      | Stop playing message to a member in a conference | member\_id           |
| **deafMember(parameters)**           | Deaf a Member in a conference                    | member\_id           |
| **undeafMember(parameters)**         | Undeaf a Member in a conference                  | member\_id           |
| **muteMember(parameters)**           | Mute a member in a conference                    | -                    |
| **unmuteMember(parameters)**         | Unmute a member in a conference                  | -                    |
| **kickMember(parameters)**           | Kick a Member out of a conference                | member\_id           |
| **recordConference(parameters)**     | Start recording a conference                     | conference\_name     |
| **stopRecordConference(parameters)** | Stop recording a conference                      | conference\_name     |

### Endpoint API

| Method                         | Description                  | Mandatory Parameters      |
| ------------------------------ | ---------------------------- | ------------------------- |
| **getEndpoint(parameters)**    | Get details of an endpoint   | endpoint\_id              |
| **editEndpoint(parameters)**   | Edit details of an endpoint  | endpoint\_id              |
| **getEndpoints(parameters)**   | Get details of all endpoints | -                         |
| **createEndpoint(parameters)** | Create a new endpoint        | username, password, alias |
| **deleteEndpoint(parameters)** | Delete an endpoint           | endpoint\_id              |

### Message API

| Method                      | Description                     | Mandatory Parameters |
| --------------------------- | ------------------------------- | -------------------- |
| **sendMessage(parameters)** | Send an outbound SMS            | src, dst, text       |
| **getMessage(parameters)**  | Get details of a single message | message\_uuid        |
| **getMessages(parameters)** | Get details of all messages     | -                    |

### Number & PhoneNumber API

| Method                                  | Description                         | Mandatory Parameters |
| --------------------------------------- | ----------------------------------- | -------------------- |
| **getNumbers(parameters)**              | Get Details of all numbers          | -                    |
| **getNumber(parameters)**               | Get Details of a sigle number       | number               |
| **editNumber(parameters)**              | Edit details of a single number     | number               |
| **unRentNumber(parameters)**            | Unrent a number                     | number               |
| **linkApplicationNumber(parameters)**   | Link an application to a number     | number, app\_id      |
| **unlinkApplicationNumber(parameters)** | Unlink an application from a number | number               |
| **searchPhoneNumber(parameters)**       | Search for phone numbers            | country\_iso         |
| **buyPhoneNumber(parameters)**          | Rent a new number                   | number               |

### Pricing API

<table class="table copy">
  <thead>
    <tr>
      <th>Method</th>
      <th>Description</th>
      <th>Mandatory Parameters</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>getPricing(parameters)</td>
      <td>Get Pricing details for a specific country</td>
      <td>country\_iso</td>
    </tr>
  </tbody>
</table>

### Recording API

| Method                          | Description                        | Mandatory Parameters |
| ------------------------------- | ---------------------------------- | -------------------- |
| **getRecordings(parameters)**   | Get Details of all recordings      | -                    |
| **getRecording(parameters)**    | Get Details of a single recordings | recording\_id        |
| **deleteRecording(parameters)** | Delete a sinlge recording          | recording\_id        |

## Examples

Take a look at the Salesforce Integration [examples](https://github.com/plivo/plivo-salesforce-example) on GitHub.

## Reporting Issues

Please report issues or submit patches using the [Github Issue Tracker](https://github.com/plivo/plivo-salesforce/issues) or [Customer Plivo Support](https://support.plivo.com/).

## License

The Plivo Salesforce Helper Library is written by the Plivo Team and distributed under the MIT License.
