# Automating Connectors via Saved Object API

**URL:** <https://discuss.elastic.co/t/automating-connectors-via-saved-object-api/320896>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [December 9, 2022, 4:03pm UTC](https://discuss.elastic.co/t/automating-connectors-via-saved-object-api/320896 "2022-12-09T16:03:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hayden\_WB](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hayden_wb/32/100898_2.png) [@Hayden\_WB](https://discuss.elastic.co/u/Hayden_WB)\
**Post date:** [December 9, 2022, 4:03pm UTC](https://discuss.elastic.co/t/automating-connectors-via-saved-object-api/320896/1 "2022-12-09T16:03:53Z")

</div>

Hi folks!

I'm attempting to automate Dashboards and Alerts for a team within my company. This involves creating a MS Teams Connector. I have written a bash script that posts the Connector NDJSON to the Saved Objects endpoint via curl.

I had some problems initially, as Saved Objects exported from Kibana do not contain secrets or sensitive information. Here's an example of the exported Connector (formatted for readability):

```auto
{
  "attributes": {
    "actionTypeId": ".teams",
    "config": {},
    "isMissingSecrets": true,
    "name": "MS Teams Connector"
  },
  "coreMigrationVersion": "8.4.3",
  "id": "redacted",
  "migrationVersion": {
    "action": "8.3.0"
  },
  "references": [],
  "type": "action",
  "updated_at": "2022-12-07T12:09:25.255Z",
  "version": "redacted"
}
{
  "excludedObjects": [],
  "excludedObjectsCount": 0,
  "exportedCount": 1,
  "missingRefCount": 0,
  "missingReferences": []
}

```

Uploading this exported NDJSON resulted in the following error in the Kibana GUI:

`1 connector has sensitive information that require updates.`

After some digging around, [I found the following PR on elastic/kibana](https://github.com/elastic/kibana/pull/138019) which hinted at a secrets field which was missing from my exported NDJSON.

I modified my existing NDJSON body and added the following:

```auto
{
  "attributes": {
    [...]
    "secrets": {
      "webhookUrl": "redacted"
    },
    "isMissingSecrets": false,
    [...]
  },
  [...]
}
{
  [...]
}

```

And this succeeds. The Connector has the webhook.

My question is, is this the intended approach? As I can find little documentation in the REST API documentation focusing on this. If someone has a link to some documentation on this, I'd be ever so happy!

---

<div class="post-metadata">

**Author:** ![Ersin\_Erdal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ersin_erdal/32/114575_2.png) [@Ersin\_Erdal](https://discuss.elastic.co/u/Ersin_Erdal)\
**Post date:** [December 12, 2022, 4:02pm UTC](https://discuss.elastic.co/t/automating-connectors-via-saved-object-api/320896/2 "2022-12-12T16:02:34Z")

</div>

Hi @Hayden_WB

Below Doc could help you.

> **[Create connector API | Kibana Guide \[8.5\] | Elastic](https://www.elastic.co/guide/en/kibana/current/create-connector-api.html)**
>
> Conceptual and step-by-step procedures for using runtime fields, scripted fields, and field formatters.

---

<div class="post-metadata">

**Author:** ![Hayden\_WB](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hayden_wb/32/100898_2.png) [@Hayden\_WB](https://discuss.elastic.co/u/Hayden_WB)\
**Post date:** [December 12, 2022, 5:32pm UTC](https://discuss.elastic.co/t/automating-connectors-via-saved-object-api/320896/3 "2022-12-12T17:32:10Z")

</div>

Ersin, yes! Perfect, thanks for this - am on an older version, but can see the docs are there for \< 8.5 for the various connectors.

Thanks so much!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 9, 2023, 5:33pm UTC](https://discuss.elastic.co/t/automating-connectors-via-saved-object-api/320896/4 "2023-01-09T17:33:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
