# Webhook Events

This reference provides a comprehensive list of webhook event types supported by Firstup, including example payloads, event descriptions, and their typical use cases.

## Creating a Subscription

Webhook subscriptions are configured using the Webhooks Endpoints. When creating a subscription you must provide a url you wish to receive webhooks at, and a list of events you wish to receive webhooks for. The access token used when creating a subscription must also have the `webhooks.write` [auth scope](https://developers.firstup.io/authorization/authenticationandauthorization).


```
POST /v2/webhooks/subscriptions HTTP/1.1
Host: https://partner.socialchorus.com
Content-Type: application/json
Authorization: Bearer ACCESS_TOKEN

{
  "url": "https://example.com/endpoint",
  "authorization_header": "foobar"
  "events": [
    { "name": "content_published" },
    { "name": "content_archived" }
  ]
}
```

## Event List

### Campaigns

**campaign_push_message_sent**

When a custom push message or a content promotion campaign is kicked off.

Example Payload:


```
{
  "id": "b3d1d304-bee1-4541-9ae7-3dede2e2bbd4",
  "timestamp": "2020-01-01T12:00:00Z",
  "campaign_id": 8273,
  "campaign_name": "Announce Campaign: Example Content Promotion",
  "push_message": {
    "name": "content promotion push",
    "text": "Example text sent to users",
    "locale": "en",
    "deep_link": {
      "type": "content",
      "resource_id": 25120469
    }
  },
  "content_promotion": {
    "type": "content",
    "resource_id": 25120469
  },
  "name": "campaign_push_message_sent",
  "version": "1"
}
```

### Channels (Topics)

**channel_archived**

When a channel is archived, regardless of its previous state. Note: A channel is a topic in Studio.

Example Payload:


```
{
  "id": "a4d1d304-bee1-4541-9ae7-3dede2e2bba8",
  "timestamp": "2020-01-01T12:00:00Z",
  "channel_id": 31133,
  "channel_name": "My Channel",
  "name": "channel_archived",
  "version": "1"
}
```

**channel_unarchived**

When a channel is unarchived. Note: A channel is a topic in Studio.

Example Payload:


```
{
  "id": "8bdcd3c7-c600-41a3-b148-2037b94d2ce5",
  "timestamp": "2020-01-01T12:00:00Z",
  "channel_id": 31133,
  "channel_name": "My Channel",
  "name": "channel_unarchived",
  "version": "1"
}
```

**channel_created**

When a new channel is created.  Note: A channel is a topic in Studio.

Example Payload:


```
{
  "id": "fc66f895-fb8c-4e4b-a74a-ac1a7093e9c8",
  "timestamp": "2020-01-01T12:00:00Z",
  "channel_id": 31133,
  "channel_name": "My Channel",
  "name": "channel_created",
  "version": "1"
}
```

**channel_published**

When a channel is published. Note: A channel is a topic in Studio.

Example Payload:


```
{
  "id": "e9777255-7b51-49ac-8845-5dbe8a1456dd",
  "timestamp": "2020-01-01T12:00:00Z",
  "channel_id": 31133,
  "channel_name": "My Channel",
  "name": "channel_published",
  "version": "1"
}
```

**channel_updated**

When a channel's details are updated. Details include information like channel name or audience, but not content within the channel. Note: A channel is a topic in Studio.

Example Payload:


```
{
  "id": "f106f854-dd40-44d8-95e9-60d7db11d4d0",
  "timestamp": "2020-01-01T12:00:00Z",
  "channel_id": 31133,
  "name": "channel_updated",
  "version": "1"
}
```

### Content

**content_archived**

When a content post is archived, regardless of its previous state.

Example Payload:


```
{
  "id": "09ae0e3a-e77c-417f-af99-763719b85072",
  "timestamp": "2020-01-01T12:00:00Z",
  "content_id": 25120469,
  "channel_ids": [16509],
  "name": "content_archived",
  "version": "1"
}
```

**content_deleted**

When a content post is deleted, regardless of its previous state.

Example Payload:


```
{
  "id": "e9c5bc18-92ac-464c-af50-3f28f5d63603",
  "timestamp": "2020-01-01T12:00:00Z",
  "content_id": 25120469,
  "name": "content_deleted",
  "version": "1"
}
```

**content_drafted**

When a content post draft is created, or a new draft is saved.

Example Payload:


```
{
  "id": "6fb61165-95d9-4565-9264-5f5b536822cd",
  "timestamp": "2020-01-01T12:00:00Z",
  "content_id": 25120469,
  "channel_ids": [16509],
  "name": "content_drafted",
  "version": "1"
}
```

**content_published**

When a content post is published to one or more channels.

Example Payload:


```
{
  "id": "1936f73f-8750-461e-a511-269eb44a43a1",
  "timestamp": "2020-01-01T12:00:00Z",
  "content_id": 25120469,
  "channel_ids": [16509],
  "name": "content_published",
  "version": "1"
}
```

**content_review_approved**

When a content post that required a review has been approved by an admin.

Example Payload:


```
{
  "id": "13229708-f99e-4016-abbf-7914dccdc644",
  "timestamp": "2020-01-01T12:00:00Z",
  "content_id": 25120469,
  "recommended_channel_ids": [13434],
  "submitter": {
    "user_id": 25730
  },
  "reviewer": {
    "user_id": 25731
  },
  "auto_approved": false,
  "name": "content_review_approved",
  "version": "1"
}
```

**content_review_pending**

When a content post has been created that requires admin review before it can be published.

Example Payload:


```
{
  "id": "8ec3b49e-e550-4238-8bef-ac90068dd490",
  "timestamp": "2020-01-01T12:00:00Z",
  "content_id": 25120469,
  "recommended_channel_ids": [13434],
  "submitter": {
    "user_id": 25730
  },
  "name": "content_review_pending",
  "version": "1"
}
```

**content_review_rejected**

When a content post that required a review has been rejected by an admin.

Example Payload:


```
{
  "id": "fc3a82b9-e3af-40b5-98f0-912493a77c34",
  "timestamp": "2020-01-01T12:00:00Z",
  "content_id": 25120469,
  "recommended_channel_ids": [13434],
  "submitter": {
    "user_id": 25730
  },
  "reviewer": {
    "user_id": 25731
  },
  "name": "content_review_rejected",
  "version": "1"
}
```

**content_unpublished**

When a content post is unpublished from one or more channels.

Example Payload:


```
{
  "id": "3b4e2677-6cf8-4917-8166-8c2457396c5b",
  "timestamp": "2020-01-01T12:00:00Z",
  "content_id": 25120469,
  "name": "content_unpublished",
  "version": "1"
}
```

**content_updated**

When a content post is updated.

Example Payload:


```
{
  "id": "e9275cd6-c39f-4308-939f-f1e6dd5339ee",
  "timestamp": "2020-01-01T12:00:00Z",
  "content_id": 25120446,
  "name": "content_updated"
  "version": "1"
}
```

### User Notifications

**user_notification_created**

When a user notification is created.

Example Payload:


```
{
  "id": "e9275cd6-c39f-4308-939f-f1e6dd5339ee",
  "timestamp": "2020-01-01T12:00:00Z",
  "notification_id": 25120446,
  "user_id": 523427, // target user
  "name": "user_notification_created",
  "category": "mention",
  "acknowledged": false,
  "label": "",
  "text": "",
  "details": {
    // category specific notification details
  }
  "version": "1",
}
```

**user_notification_updated**

When a user notification is updated or acknowledged.

Example Payload:


```
{
  "id": "e9275cd6-c39f-4308-939f-f1e6dd5339ee",
  "timestamp": "2020-01-01T12:00:00Z",
  "notification_id": 25120446,
  "user_id": 523427, // target user
  "name": "user_notification_updated",
  "category": "mention",
  "acknowledged": true,
  "label": "",
  "text": "",
  "details": {
    // category specific notification details
  }
  "version": "1",
}
```

**user_notification_deleted**

When a user notification is deleted.

Example Payload:


```
{
  "id": "e9275cd6-c39f-4308-939f-f1e6dd5339ee",
  "timestamp": "2020-01-01T12:00:00Z",
  "notification_id": 25120446,
  "user_id": 523427, // target user
  "name": "user_notification_created",
  "version": "1",
}
```

## User Notification Event Categories

**like**

When a user liked a publication.

Example payload:


```
{
  "like_count": 2,
  "content_id": 2487526,
  "acting_user_ids" [892374, 23874]
}
```

**mention**

When a someone mentioned a user.

Example payload:


```
{
  "content_id": 2487526,
  "acting_user_id": 892374, // who mentioned (author)
  "post_text" "Truncated post text...", // truncated comment text
  "post_id": 8273465, // comment id
  "parent_post_id": 248508 // parrent comment id
}
```

**push**

Mobile push notification published.

Example payload:


```
{
  "channel_id": 2038475,
  "content_id": 8999237,
  "tracking_id: 123412,
  "message": "Notification message"
}
```

**channel_auto_follow**

When a user is automatically followed a channel.

Example payload:


```
{
  content_channel_id: 23897,
  content_channel_name: "My Feed",
  content_channel_ids: [23897],
  channels_count: 1
}
```

**channel_contributor_added**

When a user is added to the channel contributors.

Example payload:


```
{
  content_channel_id: 23897,
  content_channel_name: "My Feed",
}
```

**content_featured**

Notification about user's featured content.

Example payload:


```
{
  "content_id": 234235,
  "featured_ids": [97345, 234235] // all featured contents
}
```

**content_performance**

Notification about the user's content views.

Example payload:


```
{
  "content_id": 4239875,
  "views_count": 34
}
```

**comment**

Notification about the comments on user's content.

Example payload:


```
{
  "comment_count": 1,
  "content_id": 923763,
  "acting_user_ids": [134441, 356456, 234234], // Users left comments
  "post_ids": [72344, 182653, 3872], // Comments
  post_text": "Truncated comment text..." // Shortened last comment
}
```

**comment_like**

Notification about the likes of user's content comment.

Example payload:


```
{
  "like_count": 3,
  "content_id": 23423423,
  "post_id": 97774, // Comment ID
  "acting_user_ids": [1234, 4897, 2364] // Users liked the comment
}
```

**comment_reply**

Notification about replies on user's comment.

Example payload:


```
{
  "reply_count": 1,
  "content_id": 2039874,
  "post_id": 234234, // Comment ID
  "acting_user_ids": [421], // Users who replied
  "reply_post_ids": [987], // Replies IDs
  "reply_text": "Truncated reply text" // Shortened last reply
}
```

**comment_reply_like**

When a user liked a comment reply.

Example payload:


```
{
  "content_id": 324555,
  "post_id": 987234
  "like_count": 1,
  "acting_user_ids": [234],
  "parent_post_id": 2389742 // Parrent comment ID (it it's reply)

}
```