> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-xsiam-developer-guide/cortex-xsiam-development-guide/integrations-and-scripts/create-a-sample-integration/test-the-integration.md).

# Test the integration

1. Go to **Settings** → **Data Collection** → **Automation & Feed Integrations**, and search for Yoda. Click **Add instance**.

   ![](/files/FrroeHRW28lfBtIs7yOL)

   We will not enter an API key, but will instead use the free option with a limited number of API calls.
2. To test connectivity, click the **Test** button. If the connection is successful, you will see Success and the date/time displayed.

   ![](/files/3ci704B6vUzuhWKePQvM)
3. Click **Save & Exit**.

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><h3>Note</h3><p>If you have an integration open in two different tabs, you may encounter an error where your changes aren’t saved. In this case, take a screenshot of your changes, close both tabs, and then reopen one tab. Enter your changes again and save.</p></div>
4. To test the integration, create a new incident. At the CLI, enter `!yoda-speak-translate` and any English string for the argument, for example "Hello, my name is John Smith. We are learning about integrations."

   ![xsiam-yoda-speak-cli.png](/files/0wNnCld3rYlKpHYUWtiR)

   In the War Room, you can see the table we created with the `tableToMarkdown` function, with the results.

   ![](/files/83MmyEbZMOSP53iCPeCl)
5. View the integration output in the context.

   In this example, `YodaSpeak` is the root for `The Force`. If the translation changes the next time we run the command, the translation field will be updated.

**Include the integration script in a playbook**

You can see the power of integrations when you include them in a playbook. We will create a playbook that translates the `Details` field in an incident into Yoda Speak and then prints it to the War Room.

1. Go to the **Playbooks** page and click **+New Playbook**.
2. Name the playbook Yoda Speak.
3. In the task library, search for yoda and click **Add**.
4. You can see there is a field for text, which is a required argument. Instead of typing our text here, we want to pull the text string from incident `Details`.

   1. Click the curly brackets, then Alert details+Details.
   2. Click **Close** and then **Save**.

   ![](/files/DuGwmGf6wdh61uwGcdCH)
5. Add a print task. Click **+Create Task** and name it print. In the task library, search for `print` and select the **Print** script.
6. Once again, we want to pull our text from the incident, so click the curly brackets. Our options now include `yoda-speak-translate`.
7. Under `yoda-speak-translate`, choose **Translation** and click **Close** and then **Save**.

   ![](/files/l9BixDQfXgf1Th0V4ZVJ)
8. Connect the tasks in the playbook. Use your cursor to create lines between **Playbook Triggered** and **yoda-speak-translate** and between **yoda-speak-translate** and **print**.

   ![](/files/oA2aewzQyjWlolIdYsQ3)
9. Save the playbook.
10. Test the playbook. Click **Edit**, then click **Debugger Panel** and then click **New Mock Alert**. Select an alert with a **Description** field. Click **Run**.

    Check the **Context** in the Debugger Panel for the YodaSpeak output. See [Debugging](/cortex-xsiam-developer-guide/cortex-xsiam-development-guide/testing/debugging.md) for more details.

This example integration is now complete, and we can use it throughout Cortex XSIAM.

Real world integrations are usually more complex than our example. Like any code, integrations require maintenance and can be extended over time, for example with new features and commands.

To ensure integrations perform as expected, packs can have [unit tests](/cortex-xsiam-developer-guide/cortex-xsiam-development-guide/testing/unit-testing.md), as well as [test playbooks](/cortex-xsiam-developer-guide/cortex-xsiam-development-guide/testing/test-playbooks.md). Learn more about [contributing content](/cortex-xsiam-developer-guide/cortex-xsiam-development-guide/contributing-content.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-xsiam-developer-guide/cortex-xsiam-development-guide/integrations-and-scripts/create-a-sample-integration/test-the-integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
