---
title: "Facebook Messenger incoming events"
description: "This page describes the incoming events you can receive from Facebook Messenger through the CM.com Messaging API."
canonical: "https://docs.cm.com/messaging/other-channels/facebook-messenger-events"
---

# Facebook Messenger incoming events

> This page describes the incoming events you can receive from Facebook Messenger through the CM.com Messaging API.

Source: https://docs.cm.com/messaging/other-channels/facebook-messenger-events

This page describes the incoming events you can receive from Facebook Messenger through the CM.com Messaging API.

For the generic behaviour of incoming events across all channels, see [Incoming events](https://docs.cm.com/messaging/business-messaging/incoming-events).

## Marketing Messages events

There are various types of events that can occur when using Marketing Messages.

### Supported Events

| Type | Description |
| - | - |
| OptInSubscribed | When an user has subscribed on your opt-in messages. |
| OptInExtended | When an user has extended their subscription on your opt-in messages by pressing the **Continue messages** button just before the token expires. |
| OptInStopped | When a subscription on opt-in messages has been expired or an user has not extended their subscription on your opt-in messages. |
| OptInSuspended | When an user suspends their opt-in messages subscription by pressing the **Stop these messages** button. Resulting in a temporarily block. |
| OptInResumed | When an user resumes their opt-in messages subscription after a suspension by pressing the **Resume these messages** button. |

### Opt-In event

There are two scenarios for which you will receive this event:

1. When the user opts-in to receive your Marketing Messages based on a set frequency. (**OptInSubscribed**)
2. When the user clicks on the **Continue messages** button just before the token expires. This will refresh the NotificationToken of the user and extend the TokenExpiryTimestamp. (**OptInExtended**)

#### Example Opt-In Event (OptInSubscribed)

```json
{
  "from": {
    "number": "Recipients PSID"
  },
  "to": {
    "number": "Your Facebook account ID"
  },
  "event": {
        "type": "OptInSubscribed",
        "reference": "A reference to the object or message that triggered the event",
        "custom": {
          "notificationToken": "123456789987654321",
          "tokenExpiry" : "2023-04-10T12:00:00Z"
        }
    },
    "timeUtc": "2022-10-10T12:00:00",
    "channel": "Facebook Messenger"
}
```

### Re Opt-In event

Just before the token associated with the Marketing Message opt-in is about to expire, users will automatically receive a re opt-in request. Users will then have the choice of whether to continue receiving the Marketing Messages. The re opt-in request will only be sent to the user when the reoptin field of the original opt-in notification is set to **True**, otherwise the opt-in will stop automatically.

| Recurring Notification Frequency | Re Opt-In Request Sent |
| - | - |
| Daily | After six months |

#### Example Re Opt-In Event (OptInExtended)

```json
{
  "from": {
    "number": "Recipients PSID"
  },
  "to": {
    "number": "Your Facebook account ID"
  },
  "event": {
        "type": "OptInExtended",
        "reference": "A reference to the object or message that triggered the event",
        "custom": {
          "notificationToken": "123456789987654321",
          "tokenExpiry" : "2023-04-10T12:00:00Z"
        }
    },
    "timeUtc": "2022-10-10T12:00:00",
    "channel": "Facebook Messenger"
}
```

### Manage Opt-In Event

Once users opt-in, they can easily manage their Marketing Messages, including stopping and resuming them, by clicking the “Manage” button. This will result in the following scenario’s:

1. When a user presses the **Stop these messages** button. Resulting in a temporary block of your messages. (**OptInSuspended**)

2. When a user presses the **Resume these messages** button after they have suspended your messages. (**OptInResumed**)

#### Example Manage Opt-In Event (OptInSuspended)

```json
{
  "from": {
    "number": "Recipients PSID"
  },
  "to": {
    "number": "Your Facebook account ID"
  },
  "event": {
        "type": "OptInSuspended",
        "reference": "A reference to the object or message that triggered the event",
        "custom": {
          "notificationToken": "123456789987654321",
          "tokenExpiry" : "2023-04-10T12:00:00Z"
        }
    },
    "timeUtc": "2022-10-10T12:00:00",
    "channel": "Facebook Messenger"
}
```

#### Example Manage Opt-In Event (OptInResumed)

```json
{
  "from": {
    "number": "Recipients PSID"
  },
  "to": {
    "number": "Your Facebook account ID"
  },
  "event": {
        "type": "OptInResumed",
        "reference": "A reference to the object or message that triggered the event",
        "custom": {
          "notificationToken": "123456789987654321",
          "tokenExpiry" : "2023-04-10T12:00:00Z"
        }
    },
    "timeUtc": "2022-10-10T12:00:00",
    "channel": "Facebook Messenger"
}
```
