curl --request POST \
--url https://api.getfernand.com/snippets \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"title": "Welcome Message",
"actions": [
{
"name": "status",
"data": {
"status": "closed"
}
},
{
"name": "reply",
"data": {
"content": "Thank you for contacting us!"
}
}
]
}
'import requests
url = "https://api.getfernand.com/snippets"
payload = {
"title": "Welcome Message",
"actions": [
{
"name": "status",
"data": { "status": "closed" }
},
{
"name": "reply",
"data": { "content": "Thank you for contacting us!" }
}
]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'Welcome Message',
actions: [
{name: 'status', data: {status: 'closed'}},
{name: 'reply', data: {content: 'Thank you for contacting us!'}}
]
})
};
fetch('https://api.getfernand.com/snippets', 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.getfernand.com/snippets",
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([
'title' => 'Welcome Message',
'actions' => [
[
'name' => 'status',
'data' => [
'status' => 'closed'
]
],
[
'name' => 'reply',
'data' => [
'content' => 'Thank you for contacting us!'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.getfernand.com/snippets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"Welcome Message\",\n \"actions\": [\n {\n \"name\": \"status\",\n \"data\": {\n \"status\": \"closed\"\n }\n },\n {\n \"name\": \"reply\",\n \"data\": {\n \"content\": \"Thank you for contacting us!\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getfernand.com/snippets"
payload := strings.NewReader("{\n \"title\": \"Welcome Message\",\n \"actions\": [\n {\n \"name\": \"status\",\n \"data\": {\n \"status\": \"closed\"\n }\n },\n {\n \"name\": \"reply\",\n \"data\": {\n \"content\": \"Thank you for contacting us!\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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))
}using RestSharp;
var options = new RestClientOptions("https://api.getfernand.com/snippets");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-API-Key", "<api-key>");
request.AddJsonBody("{\n \"title\": \"Welcome Message\",\n \"actions\": [\n {\n \"name\": \"status\",\n \"data\": {\n \"status\": \"closed\"\n }\n },\n {\n \"name\": \"reply\",\n \"data\": {\n \"content\": \"Thank you for contacting us!\"\n }\n }\n ]\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.post("https://api.getfernand.com/snippets")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Welcome Message\",\n \"actions\": [\n {\n \"name\": \"status\",\n \"data\": {\n \"status\": \"closed\"\n }\n },\n {\n \"name\": \"reply\",\n \"data\": {\n \"content\": \"Thank you for contacting us!\"\n }\n }\n ]\n}")
.asString();{
"id": 42,
"title": "Welcome Message",
"created": "2024-01-15T10:30:00Z",
"applied_count": 15,
"categories": [
1,
3
],
"actions": [
{
"id": 1,
"name": "status",
"data": {
"status": "closed"
},
"sort": 0
}
],
"shortcut": "welcome",
"last_applied_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}Create a new snippet
curl --request POST \
--url https://api.getfernand.com/snippets \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"title": "Welcome Message",
"actions": [
{
"name": "status",
"data": {
"status": "closed"
}
},
{
"name": "reply",
"data": {
"content": "Thank you for contacting us!"
}
}
]
}
'import requests
url = "https://api.getfernand.com/snippets"
payload = {
"title": "Welcome Message",
"actions": [
{
"name": "status",
"data": { "status": "closed" }
},
{
"name": "reply",
"data": { "content": "Thank you for contacting us!" }
}
]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'Welcome Message',
actions: [
{name: 'status', data: {status: 'closed'}},
{name: 'reply', data: {content: 'Thank you for contacting us!'}}
]
})
};
fetch('https://api.getfernand.com/snippets', 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.getfernand.com/snippets",
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([
'title' => 'Welcome Message',
'actions' => [
[
'name' => 'status',
'data' => [
'status' => 'closed'
]
],
[
'name' => 'reply',
'data' => [
'content' => 'Thank you for contacting us!'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.getfernand.com/snippets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"Welcome Message\",\n \"actions\": [\n {\n \"name\": \"status\",\n \"data\": {\n \"status\": \"closed\"\n }\n },\n {\n \"name\": \"reply\",\n \"data\": {\n \"content\": \"Thank you for contacting us!\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getfernand.com/snippets"
payload := strings.NewReader("{\n \"title\": \"Welcome Message\",\n \"actions\": [\n {\n \"name\": \"status\",\n \"data\": {\n \"status\": \"closed\"\n }\n },\n {\n \"name\": \"reply\",\n \"data\": {\n \"content\": \"Thank you for contacting us!\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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))
}using RestSharp;
var options = new RestClientOptions("https://api.getfernand.com/snippets");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-API-Key", "<api-key>");
request.AddJsonBody("{\n \"title\": \"Welcome Message\",\n \"actions\": [\n {\n \"name\": \"status\",\n \"data\": {\n \"status\": \"closed\"\n }\n },\n {\n \"name\": \"reply\",\n \"data\": {\n \"content\": \"Thank you for contacting us!\"\n }\n }\n ]\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.post("https://api.getfernand.com/snippets")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Welcome Message\",\n \"actions\": [\n {\n \"name\": \"status\",\n \"data\": {\n \"status\": \"closed\"\n }\n },\n {\n \"name\": \"reply\",\n \"data\": {\n \"content\": \"Thank you for contacting us!\"\n }\n }\n ]\n}")
.asString();{
"id": 42,
"title": "Welcome Message",
"created": "2024-01-15T10:30:00Z",
"applied_count": 15,
"categories": [
1,
3
],
"actions": [
{
"id": 1,
"name": "status",
"data": {
"status": "closed"
},
"sort": 0
}
],
"shortcut": "welcome",
"last_applied_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}Authorizations
Body
Title of the snippet (required).
50"Welcome Message"
Array of actions to apply when snippet is used (1-10 actions required).
1 - 10 elementsShow child attributes
Show child attributes
[
{
"name": "status",
"data": { "status": "closed" }
},
{
"name": "reply",
"data": { "content": "Thank you for contacting us!" }
}
]
Optional keyboard shortcut (lowercase, numbers, and dashes only).
40^[a-z0-9-]*$"welcome"
Array of category IDs to assign this snippet to.
[1, 3]
Response
Snippet created successfully.
Unique identifier for the snippet
42
Title of the snippet
250"Welcome Message"
Timestamp when the snippet was created (UTC)
"2024-01-15T10:30:00Z"
Number of times this snippet has been applied
15
Array of category IDs this snippet belongs to (0 represents root category)
[1, 3]
Array of actions to be applied when the snippet is used
Show child attributes
Show child attributes
[
{
"id": 1,
"name": "status",
"data": { "status": "closed" },
"sort": 0
}
]
Optional keyboard shortcut to quickly insert the snippet (lowercase, numbers, and dashes only)
40^[a-z0-9-]*$"welcome"
Timestamp when the snippet was last applied to a conversation (UTC)
Was this page helpful?