curl --request POST \
--url https://api.livechatinc.com/v3.6/configuration/action/create_greeting \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "normal",
"active": true,
"name": "Welcome greeting",
"group": 0,
"rules": [
{
"condition": "and",
"type": "visit_time_page",
"operator": "greater_or_equal",
"value": "5"
}
],
"properties": {
"addon": "message_input",
"is_exit_intent": "false"
},
"rich_message": {
"template_id": "cards",
"elements": [
{
"title": "Welcome to our website!",
"subtitle": "How can we help you today?",
"image": {
"url": "https://example.com/images/welcome.png",
"alternative_text": "Welcome"
},
"buttons": [
{
"postback_id": "button_0",
"role": "primary",
"text": "Chat with us",
"type": "message",
"value": "Chat with us"
}
]
}
]
}
}
'import requests
url = "https://api.livechatinc.com/v3.6/configuration/action/create_greeting"
payload = {
"type": "normal",
"active": True,
"name": "Welcome greeting",
"group": 0,
"rules": [
{
"condition": "and",
"type": "visit_time_page",
"operator": "greater_or_equal",
"value": "5"
}
],
"properties": {
"addon": "message_input",
"is_exit_intent": "false"
},
"rich_message": {
"template_id": "cards",
"elements": [
{
"title": "Welcome to our website!",
"subtitle": "How can we help you today?",
"image": {
"url": "https://example.com/images/welcome.png",
"alternative_text": "Welcome"
},
"buttons": [
{
"postback_id": "button_0",
"role": "primary",
"text": "Chat with us",
"type": "message",
"value": "Chat with us"
}
]
}
]
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'normal',
active: true,
name: 'Welcome greeting',
group: 0,
rules: [
{
condition: 'and',
type: 'visit_time_page',
operator: 'greater_or_equal',
value: '5'
}
],
properties: {addon: 'message_input', is_exit_intent: 'false'},
rich_message: {
template_id: 'cards',
elements: [
{
title: 'Welcome to our website!',
subtitle: 'How can we help you today?',
image: {url: 'https://example.com/images/welcome.png', alternative_text: 'Welcome'},
buttons: [
{
postback_id: 'button_0',
role: 'primary',
text: 'Chat with us',
type: 'message',
value: 'Chat with us'
}
]
}
]
}
})
};
fetch('https://api.livechatinc.com/v3.6/configuration/action/create_greeting', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.livechatinc.com/v3.6/configuration/action/create_greeting",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'normal',
'active' => true,
'name' => 'Welcome greeting',
'group' => 0,
'rules' => [
[
'condition' => 'and',
'type' => 'visit_time_page',
'operator' => 'greater_or_equal',
'value' => '5'
]
],
'properties' => [
'addon' => 'message_input',
'is_exit_intent' => 'false'
],
'rich_message' => [
'template_id' => 'cards',
'elements' => [
[
'title' => 'Welcome to our website!',
'subtitle' => 'How can we help you today?',
'image' => [
'url' => 'https://example.com/images/welcome.png',
'alternative_text' => 'Welcome'
],
'buttons' => [
[
'postback_id' => 'button_0',
'role' => 'primary',
'text' => 'Chat with us',
'type' => 'message',
'value' => 'Chat with us'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.livechatinc.com/v3.6/configuration/action/create_greeting"
payload := strings.NewReader("{\n \"type\": \"normal\",\n \"active\": true,\n \"name\": \"Welcome greeting\",\n \"group\": 0,\n \"rules\": [\n {\n \"condition\": \"and\",\n \"type\": \"visit_time_page\",\n \"operator\": \"greater_or_equal\",\n \"value\": \"5\"\n }\n ],\n \"properties\": {\n \"addon\": \"message_input\",\n \"is_exit_intent\": \"false\"\n },\n \"rich_message\": {\n \"template_id\": \"cards\",\n \"elements\": [\n {\n \"title\": \"Welcome to our website!\",\n \"subtitle\": \"How can we help you today?\",\n \"image\": {\n \"url\": \"https://example.com/images/welcome.png\",\n \"alternative_text\": \"Welcome\"\n },\n \"buttons\": [\n {\n \"postback_id\": \"button_0\",\n \"role\": \"primary\",\n \"text\": \"Chat with us\",\n \"type\": \"message\",\n \"value\": \"Chat with us\"\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.livechatinc.com/v3.6/configuration/action/create_greeting")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"normal\",\n \"active\": true,\n \"name\": \"Welcome greeting\",\n \"group\": 0,\n \"rules\": [\n {\n \"condition\": \"and\",\n \"type\": \"visit_time_page\",\n \"operator\": \"greater_or_equal\",\n \"value\": \"5\"\n }\n ],\n \"properties\": {\n \"addon\": \"message_input\",\n \"is_exit_intent\": \"false\"\n },\n \"rich_message\": {\n \"template_id\": \"cards\",\n \"elements\": [\n {\n \"title\": \"Welcome to our website!\",\n \"subtitle\": \"How can we help you today?\",\n \"image\": {\n \"url\": \"https://example.com/images/welcome.png\",\n \"alternative_text\": \"Welcome\"\n },\n \"buttons\": [\n {\n \"postback_id\": \"button_0\",\n \"role\": \"primary\",\n \"text\": \"Chat with us\",\n \"type\": \"message\",\n \"value\": \"Chat with us\"\n }\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.livechatinc.com/v3.6/configuration/action/create_greeting")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"normal\",\n \"active\": true,\n \"name\": \"Welcome greeting\",\n \"group\": 0,\n \"rules\": [\n {\n \"condition\": \"and\",\n \"type\": \"visit_time_page\",\n \"operator\": \"greater_or_equal\",\n \"value\": \"5\"\n }\n ],\n \"properties\": {\n \"addon\": \"message_input\",\n \"is_exit_intent\": \"false\"\n },\n \"rich_message\": {\n \"template_id\": \"cards\",\n \"elements\": [\n {\n \"title\": \"Welcome to our website!\",\n \"subtitle\": \"How can we help you today?\",\n \"image\": {\n \"url\": \"https://example.com/images/welcome.png\",\n \"alternative_text\": \"Welcome\"\n },\n \"buttons\": [\n {\n \"postback_id\": \"button_0\",\n \"role\": \"primary\",\n \"text\": \"Chat with us\",\n \"type\": \"message\",\n \"value\": \"Chat with us\"\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 123
}Create greeting
Creates a new greeting.
curl --request POST \
--url https://api.livechatinc.com/v3.6/configuration/action/create_greeting \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "normal",
"active": true,
"name": "Welcome greeting",
"group": 0,
"rules": [
{
"condition": "and",
"type": "visit_time_page",
"operator": "greater_or_equal",
"value": "5"
}
],
"properties": {
"addon": "message_input",
"is_exit_intent": "false"
},
"rich_message": {
"template_id": "cards",
"elements": [
{
"title": "Welcome to our website!",
"subtitle": "How can we help you today?",
"image": {
"url": "https://example.com/images/welcome.png",
"alternative_text": "Welcome"
},
"buttons": [
{
"postback_id": "button_0",
"role": "primary",
"text": "Chat with us",
"type": "message",
"value": "Chat with us"
}
]
}
]
}
}
'import requests
url = "https://api.livechatinc.com/v3.6/configuration/action/create_greeting"
payload = {
"type": "normal",
"active": True,
"name": "Welcome greeting",
"group": 0,
"rules": [
{
"condition": "and",
"type": "visit_time_page",
"operator": "greater_or_equal",
"value": "5"
}
],
"properties": {
"addon": "message_input",
"is_exit_intent": "false"
},
"rich_message": {
"template_id": "cards",
"elements": [
{
"title": "Welcome to our website!",
"subtitle": "How can we help you today?",
"image": {
"url": "https://example.com/images/welcome.png",
"alternative_text": "Welcome"
},
"buttons": [
{
"postback_id": "button_0",
"role": "primary",
"text": "Chat with us",
"type": "message",
"value": "Chat with us"
}
]
}
]
}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'normal',
active: true,
name: 'Welcome greeting',
group: 0,
rules: [
{
condition: 'and',
type: 'visit_time_page',
operator: 'greater_or_equal',
value: '5'
}
],
properties: {addon: 'message_input', is_exit_intent: 'false'},
rich_message: {
template_id: 'cards',
elements: [
{
title: 'Welcome to our website!',
subtitle: 'How can we help you today?',
image: {url: 'https://example.com/images/welcome.png', alternative_text: 'Welcome'},
buttons: [
{
postback_id: 'button_0',
role: 'primary',
text: 'Chat with us',
type: 'message',
value: 'Chat with us'
}
]
}
]
}
})
};
fetch('https://api.livechatinc.com/v3.6/configuration/action/create_greeting', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.livechatinc.com/v3.6/configuration/action/create_greeting",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'normal',
'active' => true,
'name' => 'Welcome greeting',
'group' => 0,
'rules' => [
[
'condition' => 'and',
'type' => 'visit_time_page',
'operator' => 'greater_or_equal',
'value' => '5'
]
],
'properties' => [
'addon' => 'message_input',
'is_exit_intent' => 'false'
],
'rich_message' => [
'template_id' => 'cards',
'elements' => [
[
'title' => 'Welcome to our website!',
'subtitle' => 'How can we help you today?',
'image' => [
'url' => 'https://example.com/images/welcome.png',
'alternative_text' => 'Welcome'
],
'buttons' => [
[
'postback_id' => 'button_0',
'role' => 'primary',
'text' => 'Chat with us',
'type' => 'message',
'value' => 'Chat with us'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.livechatinc.com/v3.6/configuration/action/create_greeting"
payload := strings.NewReader("{\n \"type\": \"normal\",\n \"active\": true,\n \"name\": \"Welcome greeting\",\n \"group\": 0,\n \"rules\": [\n {\n \"condition\": \"and\",\n \"type\": \"visit_time_page\",\n \"operator\": \"greater_or_equal\",\n \"value\": \"5\"\n }\n ],\n \"properties\": {\n \"addon\": \"message_input\",\n \"is_exit_intent\": \"false\"\n },\n \"rich_message\": {\n \"template_id\": \"cards\",\n \"elements\": [\n {\n \"title\": \"Welcome to our website!\",\n \"subtitle\": \"How can we help you today?\",\n \"image\": {\n \"url\": \"https://example.com/images/welcome.png\",\n \"alternative_text\": \"Welcome\"\n },\n \"buttons\": [\n {\n \"postback_id\": \"button_0\",\n \"role\": \"primary\",\n \"text\": \"Chat with us\",\n \"type\": \"message\",\n \"value\": \"Chat with us\"\n }\n ]\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.livechatinc.com/v3.6/configuration/action/create_greeting")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"normal\",\n \"active\": true,\n \"name\": \"Welcome greeting\",\n \"group\": 0,\n \"rules\": [\n {\n \"condition\": \"and\",\n \"type\": \"visit_time_page\",\n \"operator\": \"greater_or_equal\",\n \"value\": \"5\"\n }\n ],\n \"properties\": {\n \"addon\": \"message_input\",\n \"is_exit_intent\": \"false\"\n },\n \"rich_message\": {\n \"template_id\": \"cards\",\n \"elements\": [\n {\n \"title\": \"Welcome to our website!\",\n \"subtitle\": \"How can we help you today?\",\n \"image\": {\n \"url\": \"https://example.com/images/welcome.png\",\n \"alternative_text\": \"Welcome\"\n },\n \"buttons\": [\n {\n \"postback_id\": \"button_0\",\n \"role\": \"primary\",\n \"text\": \"Chat with us\",\n \"type\": \"message\",\n \"value\": \"Chat with us\"\n }\n ]\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.livechatinc.com/v3.6/configuration/action/create_greeting")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"normal\",\n \"active\": true,\n \"name\": \"Welcome greeting\",\n \"group\": 0,\n \"rules\": [\n {\n \"condition\": \"and\",\n \"type\": \"visit_time_page\",\n \"operator\": \"greater_or_equal\",\n \"value\": \"5\"\n }\n ],\n \"properties\": {\n \"addon\": \"message_input\",\n \"is_exit_intent\": \"false\"\n },\n \"rich_message\": {\n \"template_id\": \"cards\",\n \"elements\": [\n {\n \"title\": \"Welcome to our website!\",\n \"subtitle\": \"How can we help you today?\",\n \"image\": {\n \"url\": \"https://example.com/images/welcome.png\",\n \"alternative_text\": \"Welcome\"\n },\n \"buttons\": [\n {\n \"postback_id\": \"button_0\",\n \"role\": \"primary\",\n \"text\": \"Chat with us\",\n \"type\": \"message\",\n \"value\": \"Chat with us\"\n }\n ]\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": 123
}greetings:rwAuthorizations
Use your account ID as the username and your personal access token (PAT) as the password, or pass a Base64-encoded value directly in the Authorization header. For more information, see the personal access tokens guide.
Body
The greeting type.
normal— displayed on every visit.announcement— displayed once per visitor.
normal, announcement The greeting status. If set to true: the greeting is active.
The greeting name.
The group ID the greeting belongs to.
An array of action rules that define when the greeting should be triggered rules.
10Show child attributes
Show child attributes
The RFC 3339 date-time format indicating when the greeting becomes active.
The RFC 3339 date-time format indicating when the greeting stops being active.
The additional properties for the greeting as key-value pairs. Possible keys:
addon— the addon-related property.is_exit_intent— the exit intent detection flag.greeting-message_text— the plain text message content.greeting-message_json_key— the JSON key for message content.greeting-message_phrase_key— the phrase key for message content.
Show child attributes
Show child attributes
The rich message content of the greeting.
Show child attributes
Show child attributes
Response
Greeting created successfully.
The ID of the newly created greeting.
Was this page helpful?