Create
Create an announcement template.
POST
/
v2
/
announcement_templates
Create
curl --request POST \
--url https://api.incident.io/v2/announcement_templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actions": [
{
"action_type": "announcement_post_actions_homepage",
"emoji": "slack",
"rank": 1
}
],
"fields": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"emoji": "fire",
"field_type": "announcement_post_fields_status",
"incident_role_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"rank": 1,
"rich_text": {
"contents": "If you work on **payments**, please join {{incident.reference}}",
"type": "markdown"
}
}
],
"name": "Major incidents",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
]
}
'import requests
url = "https://api.incident.io/v2/announcement_templates"
payload = {
"actions": [
{
"action_type": "announcement_post_actions_homepage",
"emoji": "slack",
"rank": 1
}
],
"fields": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"emoji": "fire",
"field_type": "announcement_post_fields_status",
"incident_role_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"rank": 1,
"rich_text": {
"contents": "If you work on **payments**, please join {{incident.reference}}",
"type": "markdown"
}
}
],
"name": "Major incidents",
"owning_team_ids": ["01G0J1EXE7AXZ2C93K61WBPYEH"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
actions: [{action_type: 'announcement_post_actions_homepage', emoji: 'slack', rank: 1}],
fields: [
{
custom_field_id: '01FCNDV6P870EA6S7TK1DSYDG0',
emoji: 'fire',
field_type: 'announcement_post_fields_status',
incident_role_id: '01FCNDV6P870EA6S7TK1DSYDG0',
incident_timestamp_id: '01FCNDV6P870EA6S7TK1DSYDG0',
rank: 1,
rich_text: {
contents: 'If you work on **payments**, please join {{incident.reference}}',
type: 'markdown'
}
}
],
name: 'Major incidents',
owning_team_ids: ['01G0J1EXE7AXZ2C93K61WBPYEH']
})
};
fetch('https://api.incident.io/v2/announcement_templates', 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.incident.io/v2/announcement_templates",
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([
'actions' => [
[
'action_type' => 'announcement_post_actions_homepage',
'emoji' => 'slack',
'rank' => 1
]
],
'fields' => [
[
'custom_field_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'emoji' => 'fire',
'field_type' => 'announcement_post_fields_status',
'incident_role_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'incident_timestamp_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'rank' => 1,
'rich_text' => [
'contents' => 'If you work on **payments**, please join {{incident.reference}}',
'type' => 'markdown'
]
]
],
'name' => 'Major incidents',
'owning_team_ids' => [
'01G0J1EXE7AXZ2C93K61WBPYEH'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.incident.io/v2/announcement_templates"
payload := strings.NewReader("{\n \"actions\": [\n {\n \"action_type\": \"announcement_post_actions_homepage\",\n \"emoji\": \"slack\",\n \"rank\": 1\n }\n ],\n \"fields\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"emoji\": \"fire\",\n \"field_type\": \"announcement_post_fields_status\",\n \"incident_role_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"rank\": 1,\n \"rich_text\": {\n \"contents\": \"If you work on **payments**, please join {{incident.reference}}\",\n \"type\": \"markdown\"\n }\n }\n ],\n \"name\": \"Major incidents\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.incident.io/v2/announcement_templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"actions\": [\n {\n \"action_type\": \"announcement_post_actions_homepage\",\n \"emoji\": \"slack\",\n \"rank\": 1\n }\n ],\n \"fields\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"emoji\": \"fire\",\n \"field_type\": \"announcement_post_fields_status\",\n \"incident_role_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"rank\": 1,\n \"rich_text\": {\n \"contents\": \"If you work on **payments**, please join {{incident.reference}}\",\n \"type\": \"markdown\"\n }\n }\n ],\n \"name\": \"Major incidents\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/announcement_templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actions\": [\n {\n \"action_type\": \"announcement_post_actions_homepage\",\n \"emoji\": \"slack\",\n \"rank\": 1\n }\n ],\n \"fields\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"emoji\": \"fire\",\n \"field_type\": \"announcement_post_fields_status\",\n \"incident_role_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"rank\": 1,\n \"rich_text\": {\n \"contents\": \"If you work on **payments**, please join {{incident.reference}}\",\n \"type\": \"markdown\"\n }\n }\n ],\n \"name\": \"Major incidents\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"announcement_template": {
"actions": [
{
"action_type": "announcement_post_actions_homepage",
"emoji": "slack",
"rank": 1,
"title": "Join channel"
}
],
"fields": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"emoji": "fire",
"field_type": "announcement_post_fields_status",
"incident_role_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"rank": 1,
"rich_text": {
"contents": "If you work on **payments**, please join {{incident.reference}}",
"type": "markdown"
},
"title": "Severity"
}
],
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"is_default": false,
"name": "Major incidents",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
]
}
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}🔑 Requires the
announcement_templates.create scope.Authorizations
API key from your incident.io dashboard (Settings → API keys)
Body
application/json
Name of this announcement template, unique within the organisation
Example:
"Major incidents"
Actions shown on the announcement post
Show child attributes
Show child attributes
Example:
[
{
"action_type": "announcement_post_actions_homepage",
"emoji": "slack",
"rank": 1
}
]
Fields shown on the announcement post
Show child attributes
Show child attributes
Example:
[
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"emoji": "fire",
"field_type": "announcement_post_fields_status",
"incident_role_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"rank": 1,
"rich_text": {
"contents": "If you work on **payments**, please join {{incident.reference}}",
"type": "markdown"
}
}
]
IDs of the teams that own this template
Example:
["01G0J1EXE7AXZ2C93K61WBPYEH"]
Response
Created response.
An announcement template controls which fields and actions appear on an announcement post.
Show child attributes
Show child attributes
Was this page helpful?
Create
curl --request POST \
--url https://api.incident.io/v2/announcement_templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"actions": [
{
"action_type": "announcement_post_actions_homepage",
"emoji": "slack",
"rank": 1
}
],
"fields": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"emoji": "fire",
"field_type": "announcement_post_fields_status",
"incident_role_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"rank": 1,
"rich_text": {
"contents": "If you work on **payments**, please join {{incident.reference}}",
"type": "markdown"
}
}
],
"name": "Major incidents",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
]
}
'import requests
url = "https://api.incident.io/v2/announcement_templates"
payload = {
"actions": [
{
"action_type": "announcement_post_actions_homepage",
"emoji": "slack",
"rank": 1
}
],
"fields": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"emoji": "fire",
"field_type": "announcement_post_fields_status",
"incident_role_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"rank": 1,
"rich_text": {
"contents": "If you work on **payments**, please join {{incident.reference}}",
"type": "markdown"
}
}
],
"name": "Major incidents",
"owning_team_ids": ["01G0J1EXE7AXZ2C93K61WBPYEH"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
actions: [{action_type: 'announcement_post_actions_homepage', emoji: 'slack', rank: 1}],
fields: [
{
custom_field_id: '01FCNDV6P870EA6S7TK1DSYDG0',
emoji: 'fire',
field_type: 'announcement_post_fields_status',
incident_role_id: '01FCNDV6P870EA6S7TK1DSYDG0',
incident_timestamp_id: '01FCNDV6P870EA6S7TK1DSYDG0',
rank: 1,
rich_text: {
contents: 'If you work on **payments**, please join {{incident.reference}}',
type: 'markdown'
}
}
],
name: 'Major incidents',
owning_team_ids: ['01G0J1EXE7AXZ2C93K61WBPYEH']
})
};
fetch('https://api.incident.io/v2/announcement_templates', 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.incident.io/v2/announcement_templates",
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([
'actions' => [
[
'action_type' => 'announcement_post_actions_homepage',
'emoji' => 'slack',
'rank' => 1
]
],
'fields' => [
[
'custom_field_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'emoji' => 'fire',
'field_type' => 'announcement_post_fields_status',
'incident_role_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'incident_timestamp_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'rank' => 1,
'rich_text' => [
'contents' => 'If you work on **payments**, please join {{incident.reference}}',
'type' => 'markdown'
]
]
],
'name' => 'Major incidents',
'owning_team_ids' => [
'01G0J1EXE7AXZ2C93K61WBPYEH'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.incident.io/v2/announcement_templates"
payload := strings.NewReader("{\n \"actions\": [\n {\n \"action_type\": \"announcement_post_actions_homepage\",\n \"emoji\": \"slack\",\n \"rank\": 1\n }\n ],\n \"fields\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"emoji\": \"fire\",\n \"field_type\": \"announcement_post_fields_status\",\n \"incident_role_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"rank\": 1,\n \"rich_text\": {\n \"contents\": \"If you work on **payments**, please join {{incident.reference}}\",\n \"type\": \"markdown\"\n }\n }\n ],\n \"name\": \"Major incidents\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.incident.io/v2/announcement_templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"actions\": [\n {\n \"action_type\": \"announcement_post_actions_homepage\",\n \"emoji\": \"slack\",\n \"rank\": 1\n }\n ],\n \"fields\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"emoji\": \"fire\",\n \"field_type\": \"announcement_post_fields_status\",\n \"incident_role_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"rank\": 1,\n \"rich_text\": {\n \"contents\": \"If you work on **payments**, please join {{incident.reference}}\",\n \"type\": \"markdown\"\n }\n }\n ],\n \"name\": \"Major incidents\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/announcement_templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"actions\": [\n {\n \"action_type\": \"announcement_post_actions_homepage\",\n \"emoji\": \"slack\",\n \"rank\": 1\n }\n ],\n \"fields\": [\n {\n \"custom_field_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"emoji\": \"fire\",\n \"field_type\": \"announcement_post_fields_status\",\n \"incident_role_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"rank\": 1,\n \"rich_text\": {\n \"contents\": \"If you work on **payments**, please join {{incident.reference}}\",\n \"type\": \"markdown\"\n }\n }\n ],\n \"name\": \"Major incidents\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"announcement_template": {
"actions": [
{
"action_type": "announcement_post_actions_homepage",
"emoji": "slack",
"rank": 1,
"title": "Join channel"
}
],
"fields": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"emoji": "fire",
"field_type": "announcement_post_fields_status",
"incident_role_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"rank": 1,
"rich_text": {
"contents": "If you work on **payments**, please join {{incident.reference}}",
"type": "markdown"
},
"title": "Severity"
}
],
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"is_default": false,
"name": "Major incidents",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
]
}
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}