Skip to content

Commit 527e908

Browse files
authored
Webhook Docs (#45)
* Move microsurvey into steps directory * Move microsurvey technical reference under Microsurvey directory * Iron out steps. * Update url links. * Add webhooks * Move over webhooks technical reference. * Add beacons technical docs * Update title for all steps. * Add webhooks product docs.
1 parent 97acf9d commit 527e908

File tree

15 files changed

+218
-57
lines changed

15 files changed

+218
-57
lines changed

docs/references/sdks/web/advanced/index.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ See the [`TriggerConfig`](/references/sdks/web/reference/samelogic-js.TriggerCon
8585

8686
### Steps
8787

88-
Steps are processes that are executed within your workflow. For more detailed information, see [Steps](/workflows/steps).
88+
Steps are processes that are executed within your workflow. For more detailed information, see [Steps](/steps).
8989

9090
Steps contain four main pieces of information:
9191

9292
1. `name` - this can be used by dependent steps to determine dependency or used in data mapping.
9393
2. `needs` - this property determines what step it depends on. It uses a combination of `name` and the name of the `event` that the step exposes.
9494
3. `uses` - this can be the official name and version of the step or a url to a custom step.
95-
4. `props` - this is the input of the step. Data can be passed in directly, or mapping information can be passed in. See the [Data Mapping](/workflows/steps/data_mapping) for more details.
95+
4. `props` - this is the input of the step. Data can be passed in directly, or mapping information can be passed in. See the [Data Mapping](/workflows/data_mapping) for more details.
9696

9797
Please refer to the documentation for each step to see what the schema of the `props` are like and what events are exposed.
9898

docs/steps/beacons/overview.mdx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
id: overview
3+
title: Beacons Overview
4+
slug: /steps/beacons
5+
---
6+
7+
Beacons are excellent tools for drawing attention to specified elements.

docs/steps/beacons/reference.mdx

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
id: reference
3+
title: Reference
4+
slug: /steps/beacons/technical
5+
hide_title: true
6+
---
7+
8+
# Beacons Technical Reference
9+
10+
### Properties:
11+
12+
- `anchorElCssSelector` -
13+
Css selector used to set the element the beacon gets attached to. If the selector matches multiple elements, the first one is chosen.
14+
- `radius` -
15+
This controls the radius of the Beacon.
16+
- `anchor` -
17+
Specifies the side or corner of the element you want the beacon to be positioned. Possible values are:
18+
- `left`
19+
- `right`
20+
- `top`
21+
- `bottom`
22+
- `bottom-left`
23+
- `bottom-right`
24+
- `top-left`
25+
- `top-right`
26+
- `anchorOffset` -
27+
Sets the offset of the beacon from the anchor position to the center of the element. Anchor value is measured in pixels.
28+
- `background` -
29+
Sets the background style of the Beacon. Any css `background` style works here.
30+
- `pulse` -
31+
Enables or disable the Beacon's pulsing animation.
32+
- `hoverAnimation` -
33+
Sets the hover animation. Possible values:
34+
- `none`
35+
- `ripple-out`
36+
- `outline-out`.
37+
38+
### Events:
39+
40+
#### `OnClick`
41+
42+
- No data is passed from this event.
43+
44+
### Examples
45+
46+
#### Basic Usage
47+
48+
```json
49+
{
50+
"name": "beacon",
51+
"uses": "https://unpkg.com/@samelogic-steps/beacons@0.9.3/dist/runner.js",
52+
"props": {
53+
"radius": 20,
54+
"anchor": "center",
55+
"anchorOffset": 0,
56+
"background": "#00beff",
57+
"pulse": true,
58+
"hoverAnimation": "ripple-out",
59+
"anchorElCssSelector": "#target-element"
60+
}
61+
}
62+
```

docs/microsurveys/overview.mdx renamed to docs/steps/microsurveys/overview.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
id: overview
33
title: Microsurvey Overview
4-
slug: /microsurveys
4+
slug: /steps/microsurveys
55
---
66

7-
Microsurveys is a powerful in-app survey displayed during any user flow or activity to collect contextual feedback sent to any app of your choice.
7+
Microsurveys is a powerful in-app survey displayed during any user flow or activity to collect contextual feedback sent to any app of your choice. Microsurveys are great for collecting qualitative and quantitative feedback about specific features from users.
88

99
![Docusaurus](./microsurvey-popup.png)
1010

docs/references/steps/microsurvey.mdx renamed to docs/steps/microsurveys/reference.mdx

+28-21
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
id: microsurvey
3-
title: Microsurvey
4-
slug: /references/steps/microsurvey
2+
id: reference
3+
title: Reference
4+
slug: /steps/microsurveys/technical
55
hide_title: true
66
---
77

8-
# Mirosurvey
9-
Microsurveys are great for collecting qualitative and quantitative feedback about specific features from users.
8+
# Microsurveys Technical Reference
109

1110
### Properties:
11+
1212
- `anchorElCssSelector` -
13-
This is the element the microsurvey gets attached to.
13+
This is the element the microsurvey gets attached to.
1414
- `form` -
15-
Form used to describe the questions in the survey. Form properties include:
15+
Form used to describe the questions in the survey. Form properties include:
1616
- `title`
1717
- `type`
1818
- `fields`
@@ -22,26 +22,28 @@ Form used to describe the questions in the survey. Form properties include:
2222
#### Fields
2323

2424
`Fields` Properties:
25-
Form fields can be one of two types: `Long Text` or `Multiple Choice`. Field properties:
25+
Form fields can be one of two types: `Long Text` or `Multiple Choice`. Field properties:
26+
2627
- `ref`
2728
- `title` - The title that gets displayed for the fields
2829
- `type` - defines the step type. Values are `long_text` and `multiple_choice`
2930
- `properties` - Optional parameter defining the properties of the steps based on its type.
3031

31-
3232
#### Long Text Field:
33+
3334
```json
3435
{
35-
ref: "long_text_ref",
36-
title: "Welcome to my microsurvey",
37-
type: "long_text",
38-
properties: {
39-
description: "Some placeholder text here.."
40-
}
36+
"ref": "long_text_ref",
37+
"title": "Welcome to my microsurvey",
38+
"type": "long_text",
39+
"properties": {
40+
"description": "Some placeholder text here.."
41+
}
4142
}
4243
```
4344

4445
#### Multiple Choice Field:
46+
4547
```js
4648
{
4749
ref: "multiple_choice_ref",
@@ -62,20 +64,25 @@ Form fields can be one of two types: `Long Text` or `Multiple Choice`. Field pr
6264
}
6365
}
6466
```
67+
6568
### Events:
69+
6670
#### `OnSubmit`
67-
- `answers` -
68-
dictionary containing the refs of the fields mapped to their answers. For example:
71+
72+
- `answers` -
73+
dictionary containing the refs of the fields mapped to their answers. For example:
74+
6975
```json
7076
{
71-
"mulitple_choice": "lemonade",
72-
"long_text": "It's refreshing"
77+
"mulitple_choice": "lemonade",
78+
"long_text": "It's refreshing"
7379
}
7480
```
7581

76-
7782
### Examples
83+
7884
#### Basic Example
85+
7986
```json
8087
{
8188
"name": "microsurvey",
@@ -117,4 +124,4 @@ dictionary containing the refs of the fields mapped to their answers. For exampl
117124
}
118125
}
119126
}
120-
```
127+
```

docs/steps/overview.mdx

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
id: overview
3+
title: Steps Overview
4+
slug: /steps
5+
---
6+
7+
Steps are **asynchronous** and long-running processes that are executed within your workflow. Steps can be connected to create complex workflows.
8+
9+
The initialization of a step can happen via a trigger or other step events.
10+
Steps contain events that are fired based on their specification. Please refer to their docs for more details on what events they expose and under what criteria they are fired.
11+
12+
:::info
13+
You can build your custom steps and host them wherever you want.
14+
:::

docs/steps/webhooks/overview.mdx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
id: overview
3+
title: Webhooks Overview
4+
slug: /steps/webhooks
5+
---
6+
7+
Webhooks are used to send data to any URL. Data from events can be piped in, serialized, and sent in the form of an HTTP request.
8+
9+
The main property that we care about is the `body`. This property is usually mapped to event data that triggered the step. The string is then serialized into a JSON object and sent in the `body` of the http request.
10+
11+
We currently recommend using webhooks to send data to a zapier endpoint for starting out. This can be connected to a [Zapier Webhook](https://zapier.com/page/webhooks/).

docs/steps/webhooks/reference.mdx

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
id: reference
3+
title: Reference
4+
slug: /steps/webhooks/technical
5+
hide_title: true
6+
---
7+
8+
# Webhooks Technical Reference
9+
10+
### Properties:
11+
12+
- `body` -
13+
The payload being sent to the endpoint.
14+
- `method` -
15+
The http verb used to send the payload, i.e. `GET`, `POST`, `PUT`, `DELETE`, etc
16+
- `url` -
17+
A valid http url.
18+
19+
### Events:
20+
21+
#### `OnSuccess`
22+
23+
- `data` -
24+
Response from endpoint.
25+
- `status` -
26+
HTTP response status.
27+
28+
#### `OnFailure`
29+
30+
- `data` -
31+
Response from endpoint.
32+
- `status` -
33+
HTTP response status.
34+
- `message` -
35+
Reason for failure.
36+
37+
### Examples
38+
39+
#### Basic Usage
40+
41+
```json
42+
{
43+
"name": "request",
44+
"uses": "https://unpkg.com/@samelogic-steps/webhooks@0.9.1/dist/runner.js",
45+
"props": {
46+
"url": "https://www.myendpoint.com/uploadhere",
47+
"method": "post",
48+
"body": "Hello World!"
49+
}
50+
}
51+
```
52+
53+
#### Passing Data From Steps
54+
55+
In this example, the results from a `microsurvey` step is being piped to an http endpoint once the microsurvey has been completed.
56+
57+
```json
58+
{
59+
"name": "request",
60+
"needs": {
61+
"name": "microsurvey",
62+
"event": "OnSubmit"
63+
},
64+
"uses": "https://unpkg.com/@samelogic-steps/webhooks@0.9.1/dist/runner.js",
65+
"props": {
66+
"url": "https://www.myendpoint.com/uploadhere",
67+
"method": "post",
68+
"body": "{{microsurvey.OnSubmit.data}}"
69+
}
70+
}
71+
```
72+
73+
:::info
74+
Note that the `{{microsurvey.OnSubmit.data}}` is used to pass data from a previous microsurvey step to the body property.
75+
:::

docs/workflows/steps/data_mapping.mdx renamed to docs/workflows/data_mapping.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
id: data_mapping
33
title: Data Mapping
44
sidebar_label: Data Mapping
5-
slug: /workflows/steps/data_mapping
5+
slug: /workflows/data_mapping
66
---

docs/workflows/overview.mdx

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,4 @@ Triggers are defined as a list of events that occur in the application to start
1212

1313
### Steps
1414

15-
Steps are defined as a group of actions that are executed after a workflow is triggered.
16-
17-
Steps are **asynchronous**. The initialization of a step can happen via a trigger or other step events.
18-
Steps contain events that are fired based on their specification. Please refer to their docs for more details on what events they expose and under what criteria they are fired.
15+
Steps are defined as a group of actions that are executed after a workflow is triggered. Please see [Steps Overview documentation](./steps)

docs/workflows/steps/index.mdx

-12
This file was deleted.

sidebars.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@ module.exports = {
33
Introduction: ["overview/getting-started"],
44
Tutorials: ["tutorials/getting-started", "tutorials/churn/index"],
55
"How To Guides": ["howto/getting-started"],
6-
76
Workflows: [
87
"workflows/overview",
9-
{
10-
Steps: ["workflows/steps/index", "workflows/steps/data_mapping"],
11-
},
12-
138
{
149
Triggers: [
1510
"workflows/triggers/overview",
@@ -19,14 +14,23 @@ module.exports = {
1914
"workflows/triggers/hover_on",
2015
],
2116
},
17+
"workflows/data_mapping",
2218
],
23-
Microsurveys: [
24-
"microsurveys/overview",
19+
Steps: [
20+
"steps/overview",
2521
{
26-
Fields: [
27-
"microsurveys/fields/long_text",
28-
"microsurveys/fields/multiple_choice",
22+
Beacons: ["steps/beacons/overview", "steps/beacons/reference"],
23+
Microsurveys: [
24+
"steps/microsurveys/overview",
25+
{
26+
Fields: [
27+
"steps/microsurveys/fields/long_text",
28+
"steps/microsurveys/fields/multiple_choice",
29+
],
30+
},
31+
"steps/microsurveys/reference",
2932
],
33+
Webhooks: ["steps/webhooks/overview", "steps/webhooks/reference"],
3034
},
3135
],
3236
"Technical References": [
@@ -58,11 +62,7 @@ module.exports = {
5862
type: "category",
5963
label: "Steps",
6064
collapsed: false,
61-
items: [
62-
"references/steps/beacon",
63-
"references/steps/microsurvey",
64-
"references/steps/webhook"
65-
]
65+
items: ["references/steps/beacon", "references/steps/webhook"],
6666
},
6767
],
6868
"Release Notes": ["release_notes/releases"],

0 commit comments

Comments
 (0)