@epilot/targeting-client
Version:
JavaScript client library for the epilot Targeting API
68 lines (51 loc) • 1.98 kB
Markdown
//github.com/epilot-dev/sdk-js/workflows/CI/badge.svg)](https://github.com/epilot-dev/sdk-js/actions?query=workflow%3ACI)
[](https://www.npmjs.com/package/@epilot/targeting-client)
[](https://bundlephobia.com/package/@epilot/targeting-client)
[](https://github.com/epilot-dev/sdk-js/blob/main/LICENSE)
tbw
Uses [`openapi-client-axios`](https://github.com/openapistack/openapi-client-axios)
```bash
npm install --save @epilot/targeting-client
```
```typescript
import { getClient } from '@epilot/targeting-client';
const targetingClient = getClient();
const result = await targetingClient.changeCampaignStatus({ campaign_id: });
```
To find out if the given entity or entities are part of a campaign or campaigns, run, e.g.:
```typescript
import { getClient } from '@epilot/targeting-client';
const targetingClient = getClient();
const result = await targetingClient.matchCampaigns(null, {
"campaign_ids": [
"80d910d9-1c7f-49f2-9a31-75d5a0f4c744"
],
"entity_refs": [
{
"entity_schema": "contact",
"entity_id": "5817e702-b5d5-4c65-8856-7af0b0aa4067"
}
]
});
```
Similarly, if you want to know if the given entity or entities are part of specif targets:
```typescript
import { getClient } from '@epilot/targeting-client';
const targetingClient = getClient();
const result = await targetingClient.matchTargets(null, {
"target_ids": [
"80d910d9-1c7f-49f2-9a31-75d5a0f4c744"
],
"entity_refs": [
{
"entity_schema": "contact",
"entity_id": "5817e702-b5d5-4c65-8856-7af0b0aa4067"
}
]
});
```
[![CI](https: