> For the complete documentation index, see [llms.txt](https://docs.chatlayer.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chatlayer.ai/integrateandcode/app-integrations/salesforce.md).

# Salesforce

This Salesforce will allow you to perform the following actions:

* Get contact
* Create contact
* Create account
* Retrieve entity (type Contact)
* Create entity (type Case)
* Query SOQL - more information on [Salesforce documentation](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm)

## Add Salesforce in an action block

To add a Salesforce step:

{% stepper %}
{% step %}
From an [**Action**](/buildabot/flow-logic/dialog-state/action-bot-dialog.md) block, go to the **Integrations** tab and search for **Salesforce.**

<figure><img src="/files/ak4CBHNRdT1m14pEdyCx" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}
Select an action from the dropdown list.

<figure><img src="/files/Cgo5ykVmAKIqqOlnV1cJ" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}
The next option that will show up is the one to **Connect an account** on Salesforce. Click the button and a pop-up will appear for you to add username and password to connect:

<figure><img src="/files/QMoWmY5D7mGNITEuJ60G" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
On the Get contact action, the lookup field names are ID, name, email, phone and mobile phone.

<figure><img src="/files/ECldbQCl3jy8GnTx4PCs" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}
For Contact creation, the fields email, first name, last name, phone, mobile phone, description and country are available:

<figure><img src="/files/HPmBFWHBWATIp83QyUZU" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}
The response from the request made to Salesforce will be saved on a variable: `apps.salesforce.createContact`

<figure><img src="/files/EMxNauonUfADErgfQnD8" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}
The Create account action will allow you to add name, site, phone, billing country and description to the account that will be created through the chatbot. The response from Salesforce will be saved in the variable `apps.salesforce.createAccount`

<figure><img src="/files/rCXlTrzLgyidluJhEMOO" alt=""><figcaption></figcaption></figure>

{% endstep %}

{% step %}
For the Query SOQL action, a suggestion will appear: `SELECT Id, name FROM Contact WHERE Name LIKE '{internal.user.id}'` but you are free to edit with your own query. More information on [Salesforce documentation](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm).

<figure><img src="/files/lmBGIOkkhAuWsxCxjc6f" alt=""><figcaption></figcaption></figure>

{% endstep %}
{% endstepper %}

Now you're all set to provide the best customer support bot with Chatlayer and Salesforce!


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.chatlayer.ai/integrateandcode/app-integrations/salesforce.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
