-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c758d3
commit 3ecde23
Showing
3 changed files
with
187 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import { Required, Optional, Tag } from '../src/js/api-helpers.js' | ||
|
||
# API documentation | ||
|
||
Each request must be authenticated with an API key using the Bearer Token method. You can obtain an API key for your account by going to your user settings page https://app.typebot.io/account. | ||
|
||
The API is a work in progress. The current version is dedicated to Automation services that wish to implement a native Typebot integration. | ||
|
||
## Endpoints | ||
|
||
### <Tag color="green">GET</Tag> /api/users/me | ||
|
||
Get authenticated user information: | ||
|
||
```bash title="Try it yourself" | ||
curl -i -X GET https://typebot.io/api/users/me \ | ||
-H 'Authorization: Bearer ${TOKEN}' | ||
``` | ||
|
||
```json title="Response 200 OK" | ||
{ "id": "userid", "email": "user@email.com" } | ||
``` | ||
|
||
### <Tag color="green">GET</Tag> /api/typebots | ||
|
||
List user's typebots: | ||
|
||
```bash title="Try it yourself" | ||
curl -i -X GET https://typebot.io/api/typebots \ | ||
-H 'Authorization: Bearer ${TOKEN}' | ||
``` | ||
|
||
```json title="Response 200 OK" | ||
{ | ||
"typebots": [ | ||
{ | ||
"name": "My typebot 1", | ||
"id": "typebot1" | ||
}, | ||
{ | ||
"name": "My typebot 2", | ||
"id": "typebot2" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### <Tag color="green">GET</Tag> /api/typebots/<Tag>typebotId</Tag>/webhookSteps | ||
|
||
List webhook steps in a typebot. These are the steps you can, later on, register your Webhook URL: | ||
|
||
```bash title="Try it yourself" | ||
curl -i -X GET https://typebot.io/api/typebots/$TYPEBOT_ID/webhookSteps \ | ||
-H 'Authorization: Bearer ${TOKEN}' | ||
``` | ||
|
||
```json title="Response 200 OK" | ||
{ | ||
"steps": [ | ||
{ | ||
"blockId": "blockId", | ||
"id": "stepId", | ||
"name": "Block #2 > stepId" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### <Tag color="green">GET</Tag> /api/typebots/<Tag>typebotId</Tag>/blocks/<Tag>blockId</Tag>/steps/<Tag>stepId</Tag>/sampleResult | ||
|
||
Get a sample of what the webhook body will look like when triggered | ||
|
||
```bash title="Try it yourself" | ||
curl -i -X GET https://typebot.io/api/typebots/$TYPEBOT_ID/blocks/$BLOCK_ID/steps/$STEP_ID/sampleResult \ | ||
-H 'Authorization: Bearer ${TOKEN}' | ||
``` | ||
|
||
```json title="Response 200 OK" | ||
{ | ||
"steps": [ | ||
{ | ||
"blockId": "blockId", | ||
"id": "stepId", | ||
"name": "Block #2 > stepId" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### <Tag color="orange">POST</Tag> /api/typebots/<Tag>typebotId</Tag>/blocks/<Tag>blockId</Tag>/steps/<Tag>stepId</Tag>/subscribeWebhook | ||
|
||
Subscribe the step to a specified webhook URL | ||
|
||
```bash title="Try it yourself" | ||
curl -i -X POST https://typebot.io/api/typebots/$TYPEBOT_ID/webhookSteps \ | ||
-H 'Authorization: Bearer ${TOKEN}'\ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"url": "https://domain.com/my-webhook"}' | ||
``` | ||
|
||
```json title="Response 200 OK" | ||
{ | ||
"message": "success" | ||
} | ||
``` | ||
|
||
#### JSON body data | ||
|
||
<hr /> | ||
|
||
**url** <Required /> | ||
|
||
The url you want to subscribe to. | ||
|
||
<hr /> | ||
|
||
### <Tag color="orange">POST</Tag> /api/typebots/<Tag>typebotId</Tag>/blocks/<Tag>blockId</Tag>/steps/<Tag>stepId</Tag>/unsubscribeWebhook | ||
|
||
Unsubscribe the current webhook on step | ||
|
||
```bash title="Try it yourself" | ||
curl -i -X POST https://typebot.io/api/typebots/$TYPEBOT_ID/webhookSteps \ | ||
-H 'Authorization: Bearer ${TOKEN}'\ | ||
``` | ||
|
||
```json title="Response 200 OK" | ||
{ | ||
"message": "success" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Taken from https://github.com/plausible/docs/blob/master/src/js/api-helpers.js 💙 | ||
import React from 'react' | ||
|
||
export const Required = () => ( | ||
<span | ||
style={{ | ||
color: '#ff8e20', | ||
fontSize: '0.7rem', | ||
fontWeight: 'bold', | ||
position: 'relative', | ||
bottom: '4px', | ||
}} | ||
> | ||
REQUIRED | ||
</span> | ||
) | ||
|
||
export const Optional = () => ( | ||
<span | ||
style={{ | ||
color: '#718096', | ||
fontSize: '0.7rem', | ||
fontWeight: 'bold', | ||
position: 'relative', | ||
bottom: '4px', | ||
}} | ||
> | ||
optional | ||
</span> | ||
) | ||
|
||
export const Tag = ({ children, color }) => { | ||
let backgroundColor = '#CBD5E0' | ||
switch (color) { | ||
case 'green': | ||
backgroundColor = '#68D391' | ||
break | ||
case 'orange': | ||
backgroundColor = '#ffa54c' | ||
break | ||
} | ||
return ( | ||
<span | ||
style={{ | ||
backgroundColor, | ||
borderRadius: '5px', | ||
padding: '0px 5px', | ||
}} | ||
> | ||
{children} | ||
</span> | ||
) | ||
} |
3ecde23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
viewer-v2 – ./apps/viewer
zap.fundviser.in
link.venturasuceder.com
bot.adventureconsulting.hu
typebot-viewer.vercel.app
criar.somaperuzzo.com
app.yvon.earth
demo.wemakebots.xyz
bot.theiofundation.org
chat.hayuri.id
viewer.typebot.io
viewer-v2-typebot-io.vercel.app
bot.pinpointinteractive.com
viewer-v2-git-main-typebot-io.vercel.app
3ecde23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
builder-v2 – ./apps/builder
builder-v2-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app
3ecde23
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./apps/docs
docs-typebot-io.vercel.app
docs-git-main-typebot-io.vercel.app
docs.typebot.io