bird preferences create
Usage
代码示例
bird preferences create [flags]Description
Record a preference
Record a consent grant or an opt-out for a handle on one channel. An upsert by key: the same channel, handle, and sender scope update one record, and an out-of-order statement is refused with applied: false rather than applied.
Build the request from flags, a JSON PreferenceCreate body via --body-file ("-" reads
stdin), or both — a flag overrides the matching body field. Run --example to
print a ready-to-edit body, or --dry-run to print the resolved request without
sending it.
Examples
代码示例
# print the body shape (no credentials needed)
bird preferences create --example
# the body it prints:代码示例
{
"channel": "sms",
"coverage": "non_transactional",
"handle": "+15550001234",
"status": "revoked"
}Options
Request
| Name | Description |
|---|---|
| --body-file | Read the JSON request body from this file; "-" reads stdin |
| --example | Print a complete example request body, then exit |
| --dry-run | Print the resolved request without sending it, then exit |
| --idempotency-key | Deduplication key; a retry with the same key won't act twice |
Options
| Name | Description |
|---|---|
| --handle | Who the statement is about: an email address on the email channel, a phone number in E.164 format on SMS and WhatsApp. (required; or in --body-file) |
| --channel | The channel a preference statement applies to. A preference addresses one channel: the handle that identifies the person differs per channel, so opting out of one channel says nothing about the others. New channels can be added over time, so a value outside this list can be returned. Known values: email, sms, whatsapp (others may exist). (required; or in --body-file) |
| --status | What the statement says: granted records consent to receive messages, revoked records an opt-out. There is no third state: a person who never stated anything simply has no preference on record. Possible values: granted, revoked. (required; or in --body-file) |
| --coverage | How much traffic the statement covers. Defaults to non_transactional, which keeps transactional messages such as receipts and verification codes flowing. Possible values: all, non_transactional. |
| --sender-scope | Limit the statement to one sender instead of the whole channel. On SMS this is the originator; on WhatsApp it identifies the business account. Not supported on email, where preferences are always channel-wide. |
| --source | Free-form note on where the statement came from: a form name, an import batch, a campaign. Stored verbatim and returned on the preference. |
| --consented-at | When the person consented, on a granted statement. Required evidence when granting over a stored opt-out: the grant applies only if this is later than the opt-out it reverses. May not be in the future. |
| --response-schema | Print the fields this command returns, then exit |
Related
| Name | Description |
|---|---|
| bird preferences delete | Delete a preference |
| bird preferences get | Get a preference |
| bird preferences list | List preferences |