You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/connections/destinations/catalog/help-scout/index.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,4 +30,7 @@ If you're not familiar with the Segment Specs, take a look to understand what th
30
30
31
31
You can use the Identify call to create or update customers in your Help Scout account.
32
32
33
-
A `name` and an `email` are required by Help Scout to complete the request. You can set the userId as the `email`, although this is [not recommended](/docs/connections/spec/identify/#user-id). You can also specify `firstName` and `lastName` traits instead of a single `name` trait. You can learn more about which properties Help Scout will accept [here](https://developer.helpscout.com/mailbox-api/endpoints/customers/create/).
33
+
Help Scout requires a `name` and an `email` to complete the request. You can set the userId as the `email`, although this is [not recommended](/docs/connections/spec/identify/#user-id). You can also specify `firstName` and `lastName` traits instead of a single `name` trait. You can learn more about which properties Help Scout accepts [here](https://developer.helpscout.com/mailbox-api/endpoints/customers/create/){:target="_blank"}.
34
+
35
+
> info ""
36
+
> This destination doesn't allow you to send custom properties to Help Scout. Use [Destination Functions](/docs/connections/functions/destination-functions/#create-a-destination-function) to send any non-standard properties to Help Scout.
Copy file name to clipboardExpand all lines: src/connections/functions/source-functions.md
+25-25Lines changed: 25 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,20 +12,20 @@ Source functions allow you to gather data from any third-party applications with
12
12
All functions are scoped to your workspace, so members of other workspaces cannot view or use them.
13
13
14
14
> info ""
15
-
> Functions is available to all customer plan types with a free allotment of usage hours. Read more about [Functions usage limits](/docs/connections/functions/usage/), or see [your workspace's Functions usage stats](https://app.segment.com/goto-my-workspace/settings/usage?metric=functions).
15
+
> Functions is available to all customer plan types with a free allotment of usage hours. Read more about [Functions usage limits](/docs/connections/functions/usage/), or see [your workspace's Functions usage stats](https://app.segment.com/goto-my-workspace/settings/usage?metric=functions){:target="_blank"}.
1. From your workspace, go to the Catalog and click the [Functions tab](https://app.segment.com/goto-my-workspace/functions/catalog).
22
+
1. From your workspace, go to the Catalog and click the [Functions tab](https://app.segment.com/goto-my-workspace/functions/catalog){:target="_blank"}.
23
23
2. Click **New Function**.
24
24
4. Select **Source Function** and click **Build**.
25
25
26
26
27
27
> success ""
28
-
> **Tip:** Want to see some example functions? Check out the templates available in the Functions UI, or in the open-source [Segment Functions Library](https://github.com/segmentio/functions-library). (Contributions welcome!)
28
+
> **Tip:** Want to see some example functions? Check out the templates available in the Functions UI, or in the open-source [Segment Functions Library](https://github.com/segmentio/functions-library){:target="_blank"}. (Contributions welcome!)
29
29
30
30
When you click **Build**, a code editor appears. Use the editor to write the code for your function, configure settings, and test the function's behavior.
31
31
@@ -34,7 +34,7 @@ When you click **Build**, a code editor appears. Use the editor to write the cod
34
34
## Code the source function
35
35
36
36
Source functions must have an `onRequest()` function defined.
37
-
This function is executed by Segment for each HTTP request sent to this function's webhook.
37
+
This function is executed by Segment for each HTTPS request sent to this function's webhook.
38
38
39
39
```js
40
40
asyncfunctiononRequest(request, settings) {
@@ -44,12 +44,12 @@ async function onRequest(request, settings) {
44
44
45
45
The `onRequest()` function receives two arguments:
46
46
47
-
-`request` - an object describing the incoming HTTP request.
47
+
-`request` - an object describing the incoming HTTPS request.
48
48
-`settings` - set of [settings](#create-️settings-and-secrets) for this function.
49
49
50
-
We'll learn more about settings later, let's dive into how we can process the incoming request first.
50
+
### Request processing
51
51
52
-
To parse the JSON body of the request, use `request.json()` method as in the example below.
52
+
To parse the JSON body of the request, use the `request.json()` method, as in the following example:
53
53
54
54
```js
55
55
asyncfunctiononRequest(request) {
@@ -59,7 +59,7 @@ async function onRequest(request) {
59
59
```
60
60
61
61
Use the `request.headers` object to get values of request headers.
62
-
Since it's an instance of [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers), the API is the same in both the browser and in Node.js.
62
+
Since it's an instance of [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers){:target="_blank"}, the API is the same in both the browser and in Node.js.
63
63
64
64
```js
65
65
asyncfunctiononRequest(request) {
@@ -68,7 +68,7 @@ async function onRequest(request) {
68
68
}
69
69
```
70
70
71
-
To access the URL details, refer to `request.url` object, which is an instance of [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL).
71
+
To access the URL details, refer to `request.url` object, which is an instance of [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL){:target="_blank"}.
72
72
73
73
```js
74
74
asyncfunctiononRequest(request) {
@@ -117,7 +117,7 @@ async function onRequest(request) {
117
117
118
118
##### Identify
119
119
120
-
Use [Identify calls](/docs/connections/spec/identify/) to connect user with their actions, and to record traits about them.
120
+
Use [Identify calls](/docs/connections/spec/identify/) to connect users with their actions, and to record traits about them.
121
121
122
122
123
123
```js
@@ -160,7 +160,7 @@ The `Segment.track()` method accepts an object with the following fields:
160
160
161
161
##### Group
162
162
163
-
[Group calls](/docs/connections/spec/group/) associate user with a group - be it a company, organization, account, project, team or other.
163
+
[Group calls](/docs/connections/spec/group/) associate users with a group, like a company, organization, account, project, or team.
164
164
165
165
166
166
```js
@@ -269,13 +269,13 @@ The `Segment.set()` method accepts an object with the following fields:
269
269
270
270
{% include content/functions/settings.md %}
271
271
272
-
Next, fill out this setting's value in **Test** tab, so that we can run our function and verify correct setting value is being passed.
272
+
Next, fill out this setting's value in **Test** tab, so that you can run the function and check the setting values being passed.
273
273
274
274
Note, this value is only for testing your function.
275
275
276
276
{:width="500"}
277
277
278
-
Now that we have our setting set up and test value filled in, we can add code to read its value and run our function:
278
+
Now that you've configured a setting and filled in a test value, you can add code to read its value and run the function:
279
279
280
280
```js
281
281
asyncfunctiononRequest(request, settings) {
@@ -290,21 +290,21 @@ When you deploy a source function in your workspace, you are prompted to fill ou
290
290
291
291
## Test the source function
292
292
293
-
You can test your code directly from the editor in two ways: either by receiving real HTTP requests through a webhook, or by manually constructing an HTTP request from within the editor.
293
+
You can test your code directly from the editor in two ways: either by receiving real HTTPS requests through a webhook, or by manually constructing an HTTPS request from within the editor.
294
294
295
295
The advantage of testing your source function with webhooks is that all incoming data is real, so you can test behavior while closely mimicking the production conditions.
296
296
297
297
### Testing source functions with a webhook
298
298
299
-
You can use webhooks to test the source function either by sending requests manually (using any HTTP client such as cURL or Insomnia), or by pasting the webhook into an external server that supports webhooks (such as Slack).
299
+
You can use webhooks to test the source function either by sending requests manually (using any HTTP client such as cURL or Insomnia) or by pasting the webhook into an external server that supports webhooks (such as Slack).
300
300
301
301
From the source function editor, copy the webhook URL from the "Auto-fill via Webhook" dialog. To trigger the source function, send the request using the `POST` method, with the `Content-Type` header set to `application/json` or `application/x-www-form-urlencoded`.
302
302
303
303
### Testing source functions manually
304
304
305
-
You can also manually construct headers and body of an HTTP request right inside the editor and test with this data, without using webhooks.
305
+
You can also manually construct the headers and body of an HTTPS request right inside the editor and test with this data without using webhooks.
@@ -318,13 +318,13 @@ You can also choose to **Save & Deploy** to save the changes, and then choose wh
318
318
319
319
## Source functions logs and errors
320
320
321
-
Your function might encounter errors that you missed during testing, or you might intentionally throw errors in your code (for example if the incoming request is missing required fields).
321
+
Your function might encounter errors that you missed during testing, or you might intentionally throw errors in your code (for example, if the incoming request is missing required fields).
322
322
323
-
If your function throws an error, execution halts immediately. Segment captures the incoming request, any console logs the function printed, and the error, and displays the this information in the function's **Errors** tab. You can use this tab to find and fix unexpected errors.
323
+
If your function throws an error, execution halts immediately. Segment captures the incoming request, any console logs the function printed, and the error, and displays this information in the function's **Errors** tab. You can use this tab to find and fix unexpected errors.
324
324
325
325

326
326
327
-
Functions can throw [an Error or custom Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error), and you can also add additional helpful context in logs using the [`console` API](https://developer.mozilla.org/en-US/docs/Web/API/console).
327
+
Functions can throw [an Error or custom Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error){:target="_blank"}, and you can also add additional helpful context in logs using the [`console` API](https://developer.mozilla.org/en-US/docs/Web/API/console){:target="_blank"}.
328
328
For example:
329
329
330
330
```js
@@ -348,7 +348,7 @@ async function onRequest(request, settings) {
348
348
### Error types
349
349
350
350
-**Bad Request** is any error thrown by your code not covered by the other errors.
351
-
-**Invalid Settings**: A configuration error prevented Segment from executing your code. If this error persists for more than an hour, [contact Segment Support](https://segment.com/help/contact/).
351
+
-**Invalid Settings**: A configuration error prevented Segment from executing your code. If this error persists for more than an hour, [contact Segment Support](https://segment.com/help/contact/){:target="_blank"}.
352
352
-**Message Rejected**: Your code threw `InvalidEventPayload` or `ValidationError` due to invalid input.
353
353
-**Unsupported Event Type**: Your code does not implement a specific event type (`onTrack()`, etc.) or threw a `EventNotSupported` error.
354
354
-**Retry** - Your code threw `RetryError` indicating that the function should be retried.
@@ -365,14 +365,14 @@ Segment only attempts to run your source function again if a **Retry** error occ
365
365
366
366
### Editing and deleting source functions
367
367
368
-
If you are a **Workspace Owner** or **Functions Admin**, you can manage your source function from the [Functions](https://app.segment.com/goto-my-workspace/functions/catalog) tab in the catalog.
368
+
If you are a **Workspace Owner** or **Functions Admin**, you can manage your source function from the [Functions](https://app.segment.com/goto-my-workspace/functions/catalog){:target="_blank"} tab in the catalog.
369
369
370
370
### Connecting source functions
371
371
372
372
> note ""
373
373
> You must be a **Workspace Owner** or **Source Admin** to connect an instance of your function in your workspace.
374
374
375
-
From the [Functions tab](https://app.segment.com/goto-my-workspace/functions/catalog), click **Connect Source** and follow the prompts to set it up in your workspace.
375
+
From the [Functions tab](https://app.segment.com/goto-my-workspace/functions/catalog){:target="_blank"}, click **Connect Source** and follow the prompts to set it up in your workspace.
376
376
377
377
Once configured, find the webhook URL - either on the **Overview** or **Settings → Endpoint** page.
378
378
@@ -390,4 +390,4 @@ The maximum payload size for an incoming webhook payload is 512 KiB.
390
390
391
391
##### What is the timeout for a function to execute?
392
392
393
-
The execution time limit is 5 seconds, however Segment strongly recommends that you keep execution time as low as possible. If you are making multiple external requests you can use async / await to make them concurrently, which will help keep your execution time low.
393
+
The execution time limit is five seconds, however Segment strongly recommends that you keep execution time as low as possible. If you are making multiple external requests you can use async / await to make them concurrently, which will help keep your execution time low.
0 commit comments