> For the complete documentation index, see [llms.txt](https://developer.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.mediarithmics.io/advanced-usages/plugins/creation.md).

# Coding your plugin

The code of your plugin should implement specific routes, depending on the plugin type. In order to help you, we provide you with starter projects and our [Plugin SDK](/resources/tools-and-libraries/plugin-sdk.md).&#x20;

## Starter projects

Each plugin type has a different starter project.&#x20;

{% hint style="info" %}
You can ask your Account manager for the starter project of the plugin you wish to create if you don't already have access.
{% endhint %}

Plugins have the following general structure:

* src     *Folder containing the plugin code*
  * index.ts    *Root declaration of your plugin*
  * MyPluginImpl.ts    *Extends the correct Plugin SDK class*
  * tests   *Tests declaration*
  * ...  *Other folders and files as you wish*
* build.sh    *Build script*
* package.json
* run.sh    *Run script*

## Plugin SDK

Our[ Plugin SDK](/resources/tools-and-libraries/plugin-sdk.md) handles common operations like building the required routes. It is already being used in starter projects, and you only have to [override specific methods and ensure it returns the right response](/advanced-usages/plugins/creation/audience-segment-external-feed-methods.md).

{% hint style="info" %}
Each plugin type has its specificities. Please check the subpages to understand those specificities and the corresponding methods.
{% endhint %}

### Testing your project

Testing your project relies heavily on unit tests. You should aim at maximizing the code coverage of your tests, and mocking possible inbound queries.

To build the project and run unit tests, simply launch the build.sh script in the root folder of your project.

## Getting user properties

It is frequent to get properties about a user, like the profile of someone at the origin of an activity processed by an activity analyzer. It is recommended to use [the new GraphQL API ](/querying-your-data/graphql-queries.md)for this purpose, as all the data linked to a user is retrievable through a single query.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.mediarithmics.io/advanced-usages/plugins/creation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
