# Service Connector FAQs

Common questions Tray customers ask about what they can do with key service connectors such as Salesforce, Slack and Google Sheets

## How do I stop a Salesforce trigger being activated by Sandbox activity?

### Problem

A Salesforce trigger is being activated by Sandbox activity

### Cause

When a Salesforce Sandbox is created or refreshed, all environment outbound messages and metadata from Production are also copied over.

### Solution

Check the Outbound Messages configuration under Process Automation -> Workflow Actions -> Outbound Messages.
This can be accessed from the environment Settings, then type "outbound messages" in the quick find search box:
![quick find](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/5x4TcuWFIBi7zI2SeYiotY_quick_find.png)
This will display a page with all outbound webhook triggers:
![triggers](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/5Q8SJPDCtC51v013gzEokZ_triggers.png)
Filter for Tray triggers using the naming convention "**TrayOn...**" For example, "**TrayOnOpportunityFieldChange\_\_**" 
Check the list for whether the sandbox is configured to send webhooks to Tray. 
If your **Sandbox** environment contains a workflow automation to send data to a **Production** workflow, either deactivate or delete it.

## Salesforce Trigger: On Record Create / Update - what to do next?

### Trigger setup

You can create a workflow that listens for record creations or updates in Salesforce using the Salesforce trigger. It'll look like this:
![sfdc-trigger-on-record-create-update](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/4KCH2XdLXhjQTtRkquSZBB_sfdc-trigger-on-record-create-update.png)
Just select the record type from the drop-down menu. You also have the option to limit trigger executions to only those records and record changes created after a certain date.

Take a look at our instructions on setting up the Salesforce trigger here: [Salesforce Trigger.](https://tray.ai/documentation/connectors/service/salesforce)

### Trigger output

Once the trigger executes, you can inspect the body of the output, and you'll likely see something like this:
![sfdc-trigger-output](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/4ecuPnfPxYJbgrsTJ8bOe0_sfdc-trigger-output.png)
This isn't the most useful set of information for the remainder of your workflow, so you'll now most likely want to do a lookup to pull up this record for processing in your workflow

### Add Salesforce 'Find Records' step

Add a Salesforce connector immediately after your Salesforce trigger:
![sfdc-find-records](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/4hG4kWbdtCymC9PnDnO9mj_sfdc-find-records.png)
Set the Salesforce connector to the operation 'Find records.' You'll want to add a condition to find the record with an ID equal to the ID that comes in with the trigger. In this example, we are looking for a 'Case' record:
![sfdc-find-records-2](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/5BW54Z0pyGWQLjnOqrMtZF_sfdc-find-records-2.png)

### Specify fields to return

The fields are used to specify which fields you want to be returned with the records; in other words, the information you want to receive. Select 'Add to fields' to add the fields you want to receive with your record.
![sfdc-find-records-3](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/71poVsxrGNwettl0muphJb_sfdc-find-records-3.png)

## How do I get all the messages in a Slack channel?

### Intro

You can GET all the messages in a Slack channel with Tray's HTTP-client connector. The Slack documentation for retrieving messages is here: <https://api.slack.com/messaging/retrieving>.
The two parts to look at specifically are "Retrieving Conversation History" and "Retrieving Individual Messages".

### 1 - add and authenticate HTTP client step

Drag an HTTP-client connector onto your canvas and authenticate it with your Slack authentication.
This will load the Slack logo into the HTTP-client connector (for improved visibility) and make it easy to access the required authentication token without compromising security.
Verify that you have your Slack authentication set up with the proper scopes. You'll need ***channels:read***\*\* \*\*and ***channels:history*** for this implementation:
![slack-get-all-messages-add-http-client](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/2qpZrQYm91cn2aJ59J1EWk_slack-get-all-messages-add-http-client.png)

### 2 - set input data and headers

Set up the connector's 'Input data' by inserting the URL to get a channel's message history and an Authorization header set to Bearer and the JSON-path to your authentication token:
![slack-get-all-messages-set-input-data-and-headers](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/7fXr1T27qITrvOpkxxGAiK_slack-get-all-messages-set-input-data-and-headers.png)

### 3 - add channel id as query parameter

To get all of the previous messages in a channel, add a query parameter for the channel Id
![slack-get-all-messages-add-channel-id](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/4YuVoGLcoueaWmMND44JeJ_slack-get-all-messages-add-channel-id.png)

### 4 - add limits to number of messages returned

To restrict the number of messages returned, Slack offers additional query parameters:

* latest - the \*\*ts \*\*value of the latest message you want returned. The \*\*ts \*\*stands for 'timestamp' and represents the time of the message in Unix time (for more on Unix time, see [here](https://www.unixtimestamp.com/index.php)). Slack also uses the \*\*ts \*\*value to serve as a unique id for each message.
* oldest - the \*\*ts \*\*value of the oldest message you want returned.
* limit - the number of messages you want returned.
  Here's an example of a query parameter specifying the oldest message in Unix time:
  ![slack-get-all-messages-add-limits](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/4nPEr6yH6tSHPPgJxcfbWl_slack-get-all-messages-add-limits.png)
  Here's an overview of how you could set up a workflow to GET all the messages in a channel from the last 12 hours:
  ![slack-get-all-messages-example-12-hrs](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/6azZyyWZDYyMsyTHG4cdp8_slack-get-all-messages-example-12-hrs.png)

## How do I create a Google Sheets trigger?

### 1 - create and configure a new Google Sheet document

*If you have an existing sheet you would like to use, you can skip this step*
The first step is to create a new Google Sheet document. You can do this by navigating to Google Sheets and selecting the **Blank** option under **Start a new spreadsheet**. 

### 2 - create a script project

This step is where the bulk of the work will be completed. In this example, we are going to trigger a webhook to Tray when a sheet is edited and include the sheet name, updated cell, new value and the user.
To create a script project, follow the steps below.

1. Open your Google Sheet.
2. Select Extensions > Apps Script.
3. At the top left of the script editor, click Untitled project.
4. Give your project a name and click Rename.
   ![app script](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/2NrGpq2oc0ltoWcdaTGtKw_app_script.png)

### 3 - paste onEdit script

After opening the script editor, paste in the below code and select Save:

```json
function onEdit(e)\{

   var range = e.range;
   var user = e.user;

   var formData = \{
     'CELL_UPDATED': range.getA1Notation(),
     'NEW_VALUE': range.getValue(),
     'SHEET':range.getSheet().getName(),
     'USER': user
\\};

   var options = \{
     'method' : 'post',
     'payload' : formData
\};

   UrlFetchApp.fetch('[YOUR_WEBHOOK_URL]', options); <-- See Step 3 below for webhook URL
}
```

### 4 - add triggers

Hover over the menu on the left and select **Triggers:**
![select-triggers](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/182pM3nQs9wjQHxOGid7H6_select-triggers.png)
At the bottom right of the Trigger screen, select the **Add Trigger** button. This will display the below screen. Ensure the options are set as below. You can choose to send the notifications immediately, hourly, daily or weekly. Select Save:
![trigger setup](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/2YpM2DDienJSBTdHyeMFgq_trigger_setup.png)

### 5 - deploy the web app

The final step within the Apps Script console is to deploy the web app.
Select **Deploy** > **New Deployment** from the top right of the console. Choose your access level and select **Deploy**. 
![deploy-web-app](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/3SnbBwGGvgyZtr25rvZ66r_deploy-web-app.png)

### 6 - set up the webhook trigger

The final step in the configuration is to create a new workflow within Tray. Follow the steps below to complete the process.

1. Create a new workflow with a webhook as the trigger
2. Enable the workflow to generate a public URL
3. Copy the public URL from the trigger:
   ![copy-public-url](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/6Fmb9mwlNansy3yczhfyky_copy-public-url.png)
   Now paste this URL into the code snippet from above and save the changes in your app's script project.
   And you are done!

## How do I use Pendo's 'Aggregation' operation?

### Video walkthrough

Pendo's 'Aggregation' operation is powerful but somewhat challenging to set up because of the deeply nested request body. You can find their documentation [here](https://developers.pendo.io/docs/?bash#aggregation).
Here's a video walkthrough to help you set it up properly:

## I see an available connector, why can't I find it in the app?

### Explanation

Tray offers hundreds of pre-built connectors and also offers a 'universal toolkit' to make any connection available via API request or webhook.
You may see marketing information that shows a connector is available via one of our universal connectors, like this example for Avalara below:
![avalara](https://tray.ai/documentation/images/help/frequently-asked-questions/service-connector-faqs/2MuvIXq7ccZDCF9mI9Wh2Y_avalara.png)
The 'Universal Connectors' are:
[HTTP client connector](https://tray.ai/documentation/connectors/core/http-client)
[GraphQL client connector](https://tray.ai/documentation/connectors/core/graphql)
[Connector Builder](https://tray.ai/documentation/platform/connectivity/connector-builder)
[Webhook Trigger](https://tray.ai/documentation/connectors/triggers/webhook-trigger)

These are connectors that allow you to connect to any REST, SOAP, or GraphQL API and receive webhooks from any service that can send POST requests to a URL. If you don't see a pre-built connector for a service, you can still make a connector using these tools.

## Why does my HTTP connector show the wrong logo?

### Explanation

Seeing the wrong company logo on your HTTP connector step? The issue is with the authentication. Check the following:

* If you copied your HTTP connector over from a different place, its existing authentication information will still be tied to it. Remember to change the authentication to the service you are connecting to.
* If it does not reset after changing the authentication, refresh your page and [clear your cookies](https://www.google.com/search?q=how+to+clear+cookies\&oq=how+to+clear+cookies), and the image on your HTTP connector should have changed.
