The destinations query allows you to paginate through all of your destinations per account. It also allows some filtering functionality.
Here's an example:
{
actor{
account(id:YOUR_ACCOUNT_ID){
aiNotifications{
destinations{
entities{
id
name
}
error{
details
}
}
}
}
}
}
In order to paginate through your destinations, you must request the nextCursor field on your initial query.
With cursor pagination, you continue to make a request through the result set until the nextCursor that is returned from the response comes back empty. This signifies that you reached the end of your results.
Here's an example:
{
actor{
account(id:YOUR_ACCOUNT_ID){
aiNotifications{
destinations(cursor:""){
nextCursor
entities{
id
name
}
totalCount
}
}
}
}
}
The code above returns a set of results like this:
So, in your subsequent request, provide the cursor like so, until the cursor is empty:
{
actor{
account(id:YOUR_ACCOUNT_ID){
aiNotifications{
destinations(cursor:""){
nextCursor
entities{
id
name
}
totalCount
}
}
}
}
}
The API allows destination queries by name. The name filter returns exact matches and partial matches. It is case insensitive. This will only return the information for the destinations that match the name supplied.
In this example, we want to find destinations with "DevOps" in the name:
{
actor{
account(id:YOUR_ACCOUNT_ID){
aiNotifications{
destinations(filters:{name:"DevOps"}){
entities{
id
name
}
}
}
}
}
}
The API lets you query by destination ID:
{
actor{
account(id:YOUR_ACCOUNT_ID){
aiNotifications{
destinations(filters:{id:YOUR_DESTINATION_ID}){
entities{
id
name
}
}
}
}
}
}
The API lets you query by destination type. The following query will return all email destinations on the chosen account:
{
actor{
account(id:YOUR_ACCOUNT_ID){
aiNotifications{
destinations(filters:{type:EMAIL}){
entities{
id
name
}
}
}
}
}
}
Create a destination
In order to create a destination, different inputs must be supplied for each destination type. An optional two_way_integration property is available for integrations that allow two-way integration.
When you update a destination, note that you don't need to supply all of the attributes on the destination. For example, you only need to supply the name if you only intend to update the name:
mutation{
aiNotificationsUpdateDestination(
accountId:YOUR_ACCOUNT_ID
destinationId:YOUR_destination_ID
destination:{name:"Updated destination Name"}
){
destination{
id
name
}
}
}
Testing a destination
You can test destinations via the NerdGraph API. This can be done before or after creating the destination.
mutation{
aiNotificationsTestDestination(
accountId:YOUR_ACCOUNT_ID
destination:{
type:EMAIL
name:"Destination Name"
properties:[{key:"email",value:YOUR_EMAIL}]
}
){
error{
details
}
details
result
}
}
mutation{
aiNotificationsTestDestinationById(
accountId:YOUR_ACCOUNT_ID
destinationId:YOUR_DESTINATION_ID
){
error{
details
}
details
result
}
}
Delete a destination
You can delete destinations via the NerdGraph API.
mutation{
aiNotificationsDeleteDestination(
accountId:YOUR_ACCOUNT_ID
destinationId:YOUR_DESTINATION_ID
){
ids
error{
details
}
}
}
중요
If you receive a failure message stating Entity type channel is in use, you will need to identify the channels used by the destination and delete them before proceeding. To accomplish this, first find all the channels associated with the destination, then delete each channel individually.