---
# System prepended metadata

title: Referral events
tags: [Features]

---

---
tags: Features
---

# Referral events

asked, confirmed, denied, ignored


## #1 referral.asked (fabien)

Un inscrit non validé (B) demande à un membre validé (A) de le parrainer.

```json
{
    "eventType": "referral.asked",
    "payload": {
        "referrer_analytics_id": "",
        "referee_analytics_id": ""
        "asked_at": ""
    }
}
```
### Scénario : 
A (membre validé)
B (inscrit non validé) 

B demande à être parrainer par A : 

```json=
{
    "eventType": "referral.asked",
    "payload": {
        "referrer_analytics_id": "analytics_id_de_A",
        "referee_analytics_id": "analytics_id_de_B"
        "asked_at": "<datetime>"
    }
}
```


on écrase asked_at lors d'une relance 

### Enquete

->AskToReferManually->sendEmail()


## #2 referral.confirmed

Un membre validé (A) parraine un membre validé ou non (B).

```json
{
    "eventType": "referral.confirmed",
    "payload": {
        "referrer_analytics_id": "",
        "referee_analytics_id": "",
        "relationship_normalized": "",
        "confirmed_at": ""
    }
}
```

### Scénario:
A (membre validé)
B (membre validé/non validé)

A parraine B:

```json=
{
    "eventType": "referral.confirmed",
    "payload": {
        "referrer_analytics_id": "analytics_id_de_A",
        "referee_analytics_id": "analytics_id_de_B",
        "relationship_normalized": "",
        "confirmed_at": "<datetime>"
    }
}
```


### Enquete:

-> ConfirmReferral->confirm (après le set)


## #3 referral.denied

Un membre validé (A) refuse de parrainer un membre validé ou non (B)

```json
{
    "eventType": "referral.denied",
    "payload": {
        "referrer_analytics_id": "",
        "referee_analytics_id": ""
        "denied_at": ""
    }
}
```

### Scénario:
A (membre validé/non validé)
B (membre validé/non validé)

B refuse le parrainage de A:

```json=
{
    "eventType": "referral.denied",
    "payload": {
        "referrer_analytics_id": "analytics_id_de_A",
        "referee_analytics_id": "analytics_id_de_B",
        "asked_at": "<datetime>"
    }
}
```

### Enquete

-> ReferralManager->deny()

### Note

on ne gère pas les notions de veto et blocages dans cet event, on les associera plutôt au membres via des events distinct


## referral.ignored
```json
{
    "eventType": "referral.ignored",
    "payload": {
        "referrer_analytics_id": "",
        "referee_analytics_id": ""
        "denied_at": ""
    }
}
```

### Enquete

-> ReferralManager->hide()


## referral.shared
```json
{
    "eventType": "referral.shared",
    "payload": {
        "referrer_analytics_id": "",
        "referee_analytics_id": "",
        "shared_at": "",
        "mediator_analytics_id": ""
    }
}
```

### Enquete




### Note 

Est-ce que les "auto" referrals sont toujours d'actualité ?



## API Endpoints

The lambda proposes 2 API endpoints:
- one for suggesting referrers: /suggestions/referrers/{referee_id}
- one for suggesting referees: /suggestions/referees/{referrer_id}


### /suggestions/referrers/{referee_id}

