> This page is part of EVVA for Developers (https://developers.evvahub.com), the documentation of the EVVA Partner API. The API is in developer preview and the SDK packages are not yet published: do not suggest installing them. Index: https://developers.evvahub.com/llms.txt

# Message authorship

An integration application is not necessarily a bot. Some applications write replies with a model; others are CRMs
where a person on the agency's team types the reply. EVVA therefore keeps two facts about every message your
application sends:

| Fact                   | Who decides                                      | Values                                                      |
| ---------------------- | ------------------------------------------------ | ----------------------------------------------------------- |
| **Who sent it**        | EVVA, from your access token. You cannot set it. | Your application                                            |
| **How it was written** | You, in the `authorship` field of every send     | `AI_AUTOMATED`, `HUMAN_AUTHORED` or `AI_DRAFTED_HUMAN_SENT` |

Both facts are kept for the agency's records. Neither is shown to the fan.

## 1. Declare the authorship on every send

These operations require an `authorship` field:

* [sending a message](https://developers.evvahub.com/api-reference/messaging/send-message), and each item
  of a [bulk send](https://developers.evvahub.com/api-reference/bulk/send-messages);
* [sending an AI-assisted fan reply](https://developers.evvahub.com/api-reference/ai/send-ai-fan-reply);
* mass messages, when you create, update or queue them;
* paid messages and messages in an order's chat;
* [the welcome message](https://developers.evvahub.com/api-reference/automations/upsert-ice-breaker) and
  [message automations](https://developers.evvahub.com/api-reference/automations/upsert-message-automation), when you set them: the
  declaration covers what they will send.

| You declare             | When                                                                  | Scope the creator must have granted | Also required                                                    |
| ----------------------- | --------------------------------------------------------------------- | ----------------------------------- | ---------------------------------------------------------------- |
| `AI_AUTOMATED`          | Your software wrote and sent the message with no person reviewing it. | `write:messages:automated`          | The creator's account must currently permit automated messaging. |
| `HUMAN_AUTHORED`        | A person in your CRM typed the message.                               | `write:messages:operator`           | `operatorRef`                                                    |
| `AI_DRAFTED_HUMAN_SENT` | A model drafted it, a person in your CRM read it and pressed send.    | `write:messages:operator`           | `operatorRef`                                                    |

`operatorRef` is your own opaque identifier for the person who wrote or sent the message: 1 to 64 printable ASCII
characters, with no leading or trailing spaces. EVVA stores it for the agency's audit trail and never shows it to the
fan. Do not put names or e-mail addresses in it.

> **Warning**
>
> `write:messages:operator` is never part of a creator's default consent. It is the scope that lets an application say
> "a person wrote this", so the creator has to grant it explicitly.

**`cURL`**

```bash title="cURL"
# An automated reply
curl -X POST "https://api.evvahub.com/partner/v1/accounts/$CREATOR_ID/conversations/$CONVERSATION_ID/messages" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: reply-to-msg_123" \
  -d '{"body": "Thanks for the message!", "authorship": "AI_AUTOMATED"}'

# A reply typed by a person in your CRM
curl -X POST "https://api.evvahub.com/partner/v1/accounts/$CREATOR_ID/conversations/$CONVERSATION_ID/messages" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: reply-to-msg_124" \
  -d '{"body": "On it!", "authorship": "HUMAN_AUTHORED", "operatorRef": "crm-operator-17"}'
```

**`TypeScript`**

```typescript title="TypeScript"
// AI_AUTOMATED is the SDK's default
await evva.messages.sendText(creatorId, conversationId, 'Thanks for the message!');

// A person in your CRM wrote it
await evva.messages.sendText(creatorId, conversationId, 'On it!', {
  authorship: 'HUMAN_AUTHORED',
  operatorRef: 'crm-operator-17',
});
```

**`Python`**

```python title="Python"
# AI_AUTOMATED is the SDK's default
client.messages.send_text(creator_id, conversation_id, "Thanks for the message!")

# A person in your CRM wrote it
client.messages.send_text(
    creator_id, conversation_id, "On it!",
    authorship="HUMAN_AUTHORED", operator_ref="crm-operator-17",
)
```

**`Go`**

```go title="Go"
// AI_AUTOMATED is the SDK's default
_, err := client.Messages.Send(ctx, creatorID, conversationID, evvapartner.SendMessageInput{Body: "Thanks for the message!"})

// A person in your CRM wrote it (HUMAN_AUTHORED)
_, err = client.Messages.SendAsOperator(ctx, creatorID, conversationID, "crm-operator-17", "On it!")
```

**`PHP`**

```php title="PHP"
// AI_AUTOMATED is the SDK's default
$evva->messages->sendText($creatorId, $conversationId, 'Thanks for the message!');

// A person in your CRM wrote it
$evva->messages->sendText(
    $creatorId,
    $conversationId,
    'On it!',
    authorship: AuthorshipDeclaration::operator('crm-operator-17', Authorship::HumanAuthored),
);
```

> **Note**
>
> The SDKs send `AI_AUTOMATED` when you do not choose an authorship, and refuse a malformed declaration (an operator
> authorship without `operatorRef`, or an `operatorRef` on an automated message) before any request is made.

## 2. Handle a refused declaration

EVVA never substitutes a default for a missing or unpermitted declaration. Nothing is sent when it refuses one.

| HTTP | `code`                     | Meaning                                                                                                                     | What to do                                                       |
| ---- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| 400  | `AUTHORSHIP_REQUIRED`      | The request did not declare `authorship`. `details.authorship` lists the values you may declare.                            | Add the field.                                                   |
| 400  | `AUTHORSHIP_INVALID`       | The value is not one an application may declare.                                                                            | Use `AI_AUTOMATED`, `HUMAN_AUTHORED` or `AI_DRAFTED_HUMAN_SENT`. |
| 400  | `OPERATOR_REF_REQUIRED`    | An operator authorship without `operatorRef`.                                                                               | Send the operator's reference.                                   |
| 400  | `OPERATOR_REF_INVALID`     | `operatorRef` is malformed, or it was sent with `AI_AUTOMATED`.                                                             | Fix or remove it.                                                |
| 403  | `AUTHORSHIP_NOT_PERMITTED` | The creator's consent to your application does not cover this declaration. `details.requiredScope` names the missing scope. | Ask the agency to obtain the creator's consent; do not retry.    |
| 403  | `CREATOR_SUSPENDED`        | An automated message for a creator whose account currently restricts automated messaging.                                   | Do not retry automatically.                                      |
| 503  | `TEMPORARILY_UNAVAILABLE`  | EVVA could not evaluate the creator's consent right now.                                                                    | Retry after a short wait.                                        |

## 3. What the fan sees

To the fan, a message from your application is an **ordinary message from the creator**. EVVA adds no AI,
automation or agency marker to it, whatever authorship you declared, and never shows `operatorRef`, your
application or the agency. A mass message your application sends reads exactly like the creator's own broadcast.

The declaration still matters: it is what the agency's audit trail and analytics record, and it decides which consent
and account checks apply to the send.

> **Info**
>
> A message declared as written by a person (`HUMAN_AUTHORED` or `AI_DRAFTED_HUMAN_SENT`) counts as a person's reply in
> that conversation: like a reply from the creator or the agency's team, it pauses automated sends there for the
> agency's pause window. Such a message is itself paused only by a reply from a person on the agency's team, never by
> the creator's or your operator's own replies. See
> [Messages from an operator](/conversation-leases#messages-from-an-operator).

## 4. Read authorship back

Messages you read through the API carry an `authorship` field with the stored value, so your application sees how
each message in a thread was written, including the creator's own.

| Value                   | Meaning                                                                                                                       |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `HUMAN_AUTHORED`        | A person typed and sent it.                                                                                                   |
| `AI_DRAFTED_HUMAN_SENT` | A model drafted it; a person read it and sent it.                                                                             |
| `AI_GENERATED_APPROVED` | A model wrote it; a person approved sending it without necessarily composing the words.                                       |
| `AI_AUTOMATED`          | A model or program wrote and sent it with no person in the loop for this message.                                             |
| `PLATFORM_AUTOMATED`    | A platform rule sent a template the creator wrote, such as a broadcast or a welcome message.                                  |
| `UNRECORDED`            | EVVA does not know. Messages written before authorship was recorded carry this value. It does not mean "written by a person". |

Treat any value you do not recognise as unknown: new values may be added within v1.

## Next steps

#### [Conversation leases and handoff](/conversation-leases)

Keep automation and people from talking over each other in one conversation.

#### [Scopes and grants](/authentication/scopes)

The scopes behind each authorship, and how a creator grants them.

#### [Buyer pseudonyms](/buyer-pseudonyms)

How fans are identified to your application.

#### [Idempotency](/conventions/idempotency)

Send each message exactly once, even when you retry.