The GraphQL API gives you full creative control of AnnounceKit to build customized solutions for your application.
The API can be explored by using the GraphiQL IDE.
The GraphQL API has a single endpoint that returns flexible data structures, and it remains constant no matter what operation you perform.
https://announcekit.app/gq/v2
To communicate with the GraphQL API, you need to supply Basic Authentication token in request Header
, or you can use your login Cookies
(sesid, sesid.sig).
After singing-in to Dashboard, you can use GraphiQL IDE without supplying Basic Authentication token or any Cookies.
API Reference is automatically generated from GraphQL schema and can be explored from GraphiQL IDE’s Documentation Explorer section.
Creating AnnounceKit post using GrapQL API is very easy.
Initially, make sure that you have created a project and authenticated to the GraphQL API.
Firstly, You need the id
of the project. You’ll use it to retrieve labels and create a post.
{
me {
active_project {
id
name
}
}
}
As a result, you get the id
and name
of the project. Please check the name
field to make sure that you have the correct project.
{
"data": {
"me": {
"active_project": {
"id": "2672",
"name": "Awesome App"
}
}
}
}
If you want to attach labels to the post, you need id
of the label. Labels in the post are optional.
{
labels(project_id: 2672) {
id
name
}
}
Here you get a list of the labels that you have created and the default ones. You’ll use these id
fields in the following step.
{
"data": {
"labels": [
{
"id": "5442",
"name": "fix"
},
{
"id": "5443",
"name": "announcement"
},
{
"id": "5444",
"name": "improvement"
}
]
}
}
At this step, you’ll combine all the values that you get and finally create a post.
These arguments are required project_id
, and contents
. The contents
argument is an array of PostContent object which consists of title
, body
, locale_id
.
You can use some basic HTML tags in the body
argument. By default, a post will be created as a draft, so if you want to publish it, please set is_draft
argument as false
.
Please check API Reference for all mutation savePost
arguments and detailed usage.
mutation {
savePost(project_id: 2672, contents: [{title: "Hello World", body: "<h2>Hello World</h2>", locale_id: "en"}], is_draft: false) {
id
}
}
As a query result, you get the id
of the created post.
Feel free to write us in chat, or email to support@announcekit.app if you need any assistance or have questions.