Sending data over HTTP
Integrations are very important these days. With the Scripted Chatbot you are able to send data to an URL that is publicly available. The data can be static, as well as input given by the user.
config:
conversationOwner: null
conversationOwners:
- identifier: conversationOwner
channel: WhatsApp
scriptLanguageVersion: 1
scriptVersion: 1
defaultDelay: 200
lists:
positive-answers:
items:
- Ja
negative-answers:
source: negative-answers.yml
flows:
- id: main
description: Entry flow for the bot
steps:
- !entry
id: Entry-1
actions: []
clientActions: []
matches:
- opening
allowRestart: true
isCaseSensitive: true
doCatchAll: true
- !text
id: Text-1
actions: []
clientActions: []
message: What is your name?
- !input
id: Input-1
actions: []
clientActions: []
var: name
vars:
name.type: $$type
name.text: $$text
name.media.name: $$mediaName
name.media.uri: $$mediaUri
name.media.mimetype: $$mediaMimeType
name.location.latitude: $$locationLatitude
name.location.longitude: $$locationLongitude
name.location.label: $$locationLabel
name.location.searchquery: $$locationSearchQuery
name.location.radius: $$locationRadius
- !text
id: Text-2
actions: []
clientActions: []
message: And what is your phone number?
- !input
id: Input-2
actions: []
clientActions: []
var: phoneNumber
vars:
phoneNumber.type: $$type
phoneNumber.text: $$text
phoneNumber.media.name: $$mediaName
phoneNumber.media.uri: $$mediaUri
phoneNumber.media.mimetype: $$mediaMimeType
phoneNumber.location.latitude: $$locationLatitude
phoneNumber.location.longitude: $$locationLongitude
phoneNumber.location.label: $$locationLabel
phoneNumber.location.searchquery: $$locationSearchQuery
phoneNumber.location.radius: $$locationRadius
- !text
id: Text-3
actions: []
clientActions: []
message: All right, thank you! We will store these fields in our database.
- !webrequest
id: WebRequest-1
actions: []
clientActions: []
response:
extracts: []
retries: 0
retryDelay: 0
waitForResponse: true
request:
queryParameters: {}
headers: {}
url: https://en6upk40vikcw.x.pipedream.net
method: PUT
timeout: 60
body: |-
{
"name": "{{name}}",
"phone number": "{{phoneNumber}}",
"type of request": "test"
}
- !text
id: Text-4
actions: []
clientActions: []
message: Already done! Have a nice day.
The HTTP endpoint used in this example is publicly available. When going through the flow you can inspect what is send at https://public.requestbin.com/r/en6upk40vikcw/2OjB0ps0XjM8Up2WEgshQWxX7ft. Be aware that everyone can see this data. Don't use sensitive data in the flow before changing the URL!
Previous: examples Intro