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

# Salesforce

> Connect Salesforce and use available lookups and actions.

Connect Salesforce to let the AI retrieve customer and case details (lookups)
and perform approved updates (actions).

## On this page

* [Connect](#connect)
* [Frequently asked questions](#frequently-asked-questions)
* [Supported tools](#supported-tools)
  * [Lookups](#lookups)
  * [Actions](#actions)

## Connect

<Steps>
  <Step title="Log in as a Salesforce admin and go to Setup">
    You need permissions to access Platform Tools on Salesforce in the Setup page.
  </Step>

  <Step title="Open External Client App Manager">
    Navigate to `Apps` → `External Client Apps` → `External Client App Manager`

    <img src="https://mintcdn.com/typewise/ht7a5v6EXYgQrv7K/images/documentation/integrations/salesforce-oauth/external-client-app-manager.webp?fit=max&auto=format&n=ht7a5v6EXYgQrv7K&q=85&s=c353380627bc0c5bddcc454f4ada044a" alt="External Client App Manager" width="2058" height="856" data-path="images/documentation/integrations/salesforce-oauth/external-client-app-manager.webp" />
  </Step>

  <Step title="Create a new External Client App">
    <img
      src="https://mintcdn.com/typewise/ht7a5v6EXYgQrv7K/images/documentation/integrations/salesforce-oauth/external-new-client-app.webp?fit=max&auto=format&n=ht7a5v6EXYgQrv7K&q=85&s=57e1542f9538fa4734e4d88856fd5cca"
      alt="Create new
app"
      width="1745"
      height="1072"
      data-path="images/documentation/integrations/salesforce-oauth/external-new-client-app.webp"
    />
  </Step>

  <Step title="Fill out the necessary information">
    * Enter a Name (for example, “Typewise OAuth”)
    * Provide your preferred Email address
    * You can leave the rest of the basic information blank
    * Under API → `Enable OAuth`
    * Enter a random callback URL (this won't be used)
    * Select and add the necessary scopes. Make sure to add the `api` scope.
    * Make sure `Enable Client Credentials Flow` is selected
    * Ensure all other checkboxes are disabled

          <img src="https://mintcdn.com/typewise/ht7a5v6EXYgQrv7K/images/documentation/integrations/salesforce-oauth/external-client-manager.webp?fit=max&auto=format&n=ht7a5v6EXYgQrv7K&q=85&s=334f7268880361f7b3a3f5929ac841d2" alt="Fill details" width="2042" height="1122" data-path="images/documentation/integrations/salesforce-oauth/external-client-manager.webp" />

          <img src="https://mintcdn.com/typewise/ht7a5v6EXYgQrv7K/images/documentation/integrations/salesforce-oauth/external-oauth.webp?fit=max&auto=format&n=ht7a5v6EXYgQrv7K&q=85&s=7ef4d7e53df8888bed18775443ab98f3" alt="Scopes" width="2012" height="1340" data-path="images/documentation/integrations/salesforce-oauth/external-oauth.webp" />

    Once you're done, click `Create` to create the client.
  </Step>

  <Step title="Enable client credentials flow and assign user">
    After creating the new app:

    * Navigate to the newly created app
    * Under policies, enable client credentials flow
    * Assign a user to run as (this user will be attributed to all actions/reads performed by this app)

          <img src="https://mintcdn.com/typewise/ht7a5v6EXYgQrv7K/images/documentation/integrations/salesforce-oauth/external-credentials-flow.webp?fit=max&auto=format&n=ht7a5v6EXYgQrv7K&q=85&s=95852a6b716d5bf43f8b86cc525b560a" alt="Enable flow" width="2044" height="1216" data-path="images/documentation/integrations/salesforce-oauth/external-credentials-flow.webp" />
  </Step>

  <Step title="View and share the generated credentials">
    You’ll need the consumer key and secret to enable the integration.

    <img src="https://mintcdn.com/typewise/ht7a5v6EXYgQrv7K/images/documentation/integrations/salesforce-oauth/external-consumer-key.webp?fit=max&auto=format&n=ht7a5v6EXYgQrv7K&q=85&s=88f850e8425afddd86485b957a118f6c" alt="Credentials" width="2040" height="1170" data-path="images/documentation/integrations/salesforce-oauth/external-consumer-key.webp" />
  </Step>
</Steps>

## Frequently asked questions

### How do I whitelist the Typewise platform if I have IP restrictions in place?

If you have organizational or user login IP restrictions, then you need to
whitelist Typewise’s IP addresses to ensure we can authenticate and connect to
Salesforce.

<Steps>
  <Step title="Relax IP restrictions for the OAuth app">
    Under the newly created app, navigate to policies. Inside the App
    Authorization section, make sure **IP Relaxation** is set to **Relax IP
    restrictions** <img src="https://mintcdn.com/typewise/aZ9AArvIMh1cVCTu/images/documentation/integrations/salesforce-oauth/external-ip-relaxation.png?fit=max&auto=format&n=aZ9AArvIMh1cVCTu&q=85&s=c5b5f6cdcaca6845439a1a6ac898ee73" alt="IP
    Relaxation" width="5106" height="2698" data-path="images/documentation/integrations/salesforce-oauth/external-ip-relaxation.png" />
  </Step>

  <Step title="Navigate to the user profile">
    Go to Administration → Users. Click on the Profile assigned to the user that
    you selected as the run as user. <img src="https://mintcdn.com/typewise/aZ9AArvIMh1cVCTu/images/documentation/integrations/salesforce-oauth/external-user-profile.png?fit=max&auto=format&n=aZ9AArvIMh1cVCTu&q=85&s=893a2b8396d16600045d85d47867408c" alt="User
    Profile" width="5096" height="2678" data-path="images/documentation/integrations/salesforce-oauth/external-user-profile.png" />
  </Step>

  <Step title="Whitelist Typewise IPs">
    Once the Profile settings open, scroll down to the **Login IP Ranges**
    section. <img src="https://mintcdn.com/typewise/aZ9AArvIMh1cVCTu/images/documentation/integrations/salesforce-oauth/external-login-ip-ranges.png?fit=max&auto=format&n=aZ9AArvIMh1cVCTu&q=85&s=e643eb04a4ac7a88f9884b9d1cf57fdc" alt="Login IP
    Ranges" width="5106" height="2676" data-path="images/documentation/integrations/salesforce-oauth/external-login-ip-ranges.png" />
    Add the following IP addresses to the list: `json 3.69.200.242 3.78.134.40
            3.123.85.62 16.63.211.71 16.63.85.45 ` <img src="https://mintcdn.com/typewise/aZ9AArvIMh1cVCTu/images/documentation/integrations/salesforce-oauth/external-whitelist-ip-addresses.png?fit=max&auto=format&n=aZ9AArvIMh1cVCTu&q=85&s=384ff779dec2241492253422f8b3bcaf" alt="Whitelist IP
    addresses" width="5092" height="1060" data-path="images/documentation/integrations/salesforce-oauth/external-whitelist-ip-addresses.png" />
    <Tip>Use the same IP as the start and end IP addresses.</Tip>

    <Warning>
      If you plan to use this user’s profile for other profiles, make sure to
      add your own IP address to maintain access.
    </Warning>
  </Step>
</Steps>

You should now be able to successfully connect to Salesforce.

***

## Supported tools

The following is a selection of commonly used tools available through the
Salesforce integration. Additional lookups and actions are available. Contact us
if you need a tool that isn't listed here.

### Lookups

<AccordionGroup>
  <Accordion title="get_case_by_id">
    Retrieve all fields of a Salesforce case by its ID.

    | Parameter | Description                     | Required | Default |
    | :-------- | :------------------------------ | :------: | :------ |
    | `case_id` | The ID of the case to retrieve. |    Yes   |         |
  </Accordion>

  <Accordion title="get_case_description_by_id">
    Retrieve only the `Description` field of a Salesforce case by its ID.

    | Parameter | Description                  | Required | Default |
    | :-------- | :--------------------------- | :------: | :------ |
    | `case_id` | The ID of the case to query. |    Yes   |         |
  </Accordion>

  <Accordion title="get_customer_details">
    Retrieve customer details including name, email, phone, and mailing address.

    | Parameter    | Description                                            | Required | Default |
    | :----------- | :----------------------------------------------------- | :------: | :------ |
    | `user_email` | Email address of the customer to retrieve details for. |    Yes   |         |
  </Accordion>

  <Accordion title="get_all_open_tickets">
    Get all open Salesforce cases for a customer (excluding `Closed` / `Resolved`).

    | Parameter    | Description                                            | Required | Default |
    | :----------- | :----------------------------------------------------- | :------: | :------ |
    | `user_email` | Email address of the customer to retrieve tickets for. |    Yes   |         |
    | `limit`      | Maximum number of results to return.                   |    No    | `100`   |
  </Accordion>

  <Accordion title="get_ticket_status">
    Get the status and key information of a Salesforce case.

    | Parameter         | Description                                                | Required | Default |
    | :---------------- | :--------------------------------------------------------- | :------: | :------ |
    | `case_identifier` | The Case ID (starts with `500`) or Case Number to look up. |    Yes   |         |
  </Accordion>

  <Accordion title="More lookups available">
    Additional Salesforce lookup tools are available. Contact us to enable lookups not listed here.
  </Accordion>
</AccordionGroup>

### Actions

<AccordionGroup>
  <Accordion title="update_customer_details">
    Update a customer's Salesforce Contact fields. You must provide `user_email` and at least one field to update.

    | Parameter             | Description                              | Required | Default |
    | :-------------------- | :--------------------------------------- | :------: | :------ |
    | `user_email`          | Email address of the customer to update. |    Yes   |         |
    | `first_name`          | First name.                              |    No    |         |
    | `last_name`           | Last name.                               |    No    |         |
    | `phone`               | Primary phone number.                    |    No    |         |
    | `mobile_phone`        | Mobile phone number.                     |    No    |         |
    | `mailing_street`      | Mailing street address.                  |    No    |         |
    | `mailing_city`        | Mailing city.                            |    No    |         |
    | `mailing_state`       | Mailing state or province.               |    No    |         |
    | `mailing_postal_code` | Mailing postal or ZIP code.              |    No    |         |
    | `mailing_country`     | Mailing country.                         |    No    |         |
  </Accordion>

  <Accordion title="create_customer_profile">
    Create a new customer profile (Contact) in Salesforce.

    | Parameter             | Description                                 | Required | Default |
    | :-------------------- | :------------------------------------------ | :------: | :------ |
    | `user_email`          | Email address for the new customer profile. |    Yes   |         |
    | `last_name`           | Customer’s last name.                       |    Yes   |         |
    | `first_name`          | Customer’s first name.                      |    No    |         |
    | `phone`               | Primary phone number.                       |    No    |         |
    | `mobile_phone`        | Mobile phone number.                        |    No    |         |
    | `mailing_street`      | Mailing street address.                     |    No    |         |
    | `mailing_city`        | Mailing city.                               |    No    |         |
    | `mailing_state`       | Mailing state/province.                     |    No    |         |
    | `mailing_postal_code` | Mailing postal/ZIP code.                    |    No    |         |
    | `mailing_country`     | Mailing country.                            |    No    |         |
  </Accordion>

  <Accordion title="write_post_to_ticket">
    Write a comment to an existing Salesforce case.

    | Parameter         | Description                                                         | Required | Default |
    | :---------------- | :------------------------------------------------------------------ | :------: | :------ |
    | `case_identifier` | The Case ID (starts with `500`) or Case Number to add a comment to. |    Yes   |         |
    | `comment_text`    | The comment text to add.                                            |    Yes   |         |
    | `is_public`       | Whether the comment should be public.                               |    No    | `true`  |
  </Accordion>

  <Accordion title="More actions available">
    Additional Salesforce action tools are available. Contact us to enable actions not listed here.
  </Accordion>
</AccordionGroup>
