# Campaigns API

## Authentication

Authentication for queries via API has a standard format, and you must provide a valid username (email) associated with authentication token (see how to access your data). You must add the following headers to the request:

| Field             | Details                                                                                                                                              | Data Type |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| UserName          | Valid e-mail subscribed in ChatClub Platform.                                                                                                        | String    |
| AutenticaçãoToken | Authentication token generated by our platform. Find it [here](https://messaging.movile.com/messaging/user/api_configuration)​ or check our support. | String    |

## Connection Details

| **Hostname**       | apigw\.wavy.global     |
| ------------------ | ---------------------- |
| **Port**           | 443 (https)            |
| **Protocol**       | HTTPS (TLS encryption) |
| **Authentication** | username + token       |
| **Encoding**       | UTF-8                  |

## Listing Campaigns

List of campaigns already registered in the platform. You can page results or filter by campaign name.

GET <https://apigw.wavy.global/api/v1/campaigns>

### QueryString Parameters

\* Required field

| Field      | Details                                            | Type    |
| ---------- | -------------------------------------------------- | ------- |
| name       | Campaign’s name to be used as a filter for listing | String  |
| page       | Page to be listed                                  | Integer |
| page\_size | Total campaigns per page                           | Integer |

Positive response

HEADERS:

```
page-number: 1
per-page: 10
total: 2
total-pages: 1
```

### Informing the total number of campaigns there are and Displaying right below:

```
{
 "status": {
 "error": false
 },
 "campaigns": [
 {
 "name": "My first campaign",
 "id": 1,
 "alias": "first"
 },
 {
 "name": "My second campaign",
 "id": 2,
 "alias": "second"
 }
 ]
}
```

### Showing

![](https://1892724945-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fsinch-documentation-global%2F-MlGhsmOlT1CwS5Md1dR%2F-MlGmR-L9lp46KD_pyzt%2F0.gif?generation=1633459749638643\&alt=media)

## Requesting for a Campaign

Requests for the data of a campaign by registration ID

You need to know the registration ID in advance

GET <https://apigw.wavy.global/api/v1/campaign/{id}>

## Creating a Campaign

Example of campaign creation:

Creating a new campaign with name and alias. The campaign alias should be a simple name to make it easier to use with the API. It is recommended to be short and do not use special characters.

POST <https://apigw.wavy.global/api/v1/campaigns>

### JSON Parameters

\* Required field

| Field  | Details                                   | Type   |
| ------ | ----------------------------------------- | ------ |
| name\* | Campaign name                             | String |
| alias  | Campaign identifier to be used in the API | String |

`Call`

```

{
 "campaign" : {
 "name": "My Campaign2019",
 "alias": "mycampaign2019"
 }
 }
Response
{
 "status": {
 "error": false
 },
 "campaign": {
 "name": "My Campaign",
 "id": 1234,
 "alias": "mycampaign"
 }
}
```

!\[Graphical user interface

Description automatically generated]\(<https://1892724945-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fsinch-documentation-global%2F-MlGhsmOlT1CwS5Md1dR%2F-MlGmR-MEovVYrF_1GGM%2F1.gif?generation=1633459749638737\\&alt=media>)

## Changing a Campaign

Changing a campaign by modifying its name and/or alias.

PUT <https://apigw.wavy.global/api/v1/campaigns/{id}>

You must include the {id} of the campaign you wish to change

### JSON Parameters

\* Required field

| Field  | Details                                   | Type   |
| ------ | ----------------------------------------- | ------ |
| name\* | Campaign name                             | String |
| alias  | Campaign identifier to be used in the API | String |

Call

```
{
 "campaign" : {
 "name": "My Campaign",
 "alias": "mycampaign"
 }
 }
Response
{
 "status": {
 "error": false
 },
 "campaign": {
 "name": "My Campaign",
 "id": 1234,
 "alias": "mycampaign"
 }
}

```

## Deleting a Campaign

Deleting a campaign by its ID.

DELETE <https://apigw.wavy.global/api/v1/campaigns/{id}>

You must include the {id} of the campaign you wish to change
