# Message model

## Model

:::tip[]
This schema describes Messages in the responses. Payload for creations and updates is significantly different and can be referenced in docs of the respective API endpoints.
:::
<DataSchema id="602613" />

## Multiple channels

It is possible to provide multiple channels per Message. During sending execution, one of them will be chosen, based on:

* channels which are available for recipient
* order (priority) of channels in payload specified during Message creation
* optional [preference](doc-354473#channels-preference) set on Sending

## Channel attributes

There are channel attributes specific for given type.

Key | Channel type | Type
--------- | ----- | --------- 
message.sender.type | `sms` | enum: `['alphanumeric', 'international']`
message.sender.value | `sms` | string 
message.sender.from_email | `email` | string
message.sender.from_name | `email` | string

When not provided explicitly, values of those the following attributes are taken from Loyalty Club [configuration](api-3511372).

For Email channels, the `from_email` and `from_name` are used in the sent mails as following: `{{from_name}} <{{from_email}}>`. For example, to send email as `Developer <dev@placewise.com>`, `from_name` should be `Dev` and `from_email` - `dev@placewise.com`.

For SMSes channels, depending on selected `sender.type`, a `sender.value` can be provided according to the following table:

Type | Value
---- | ---------------
`alphanumeric` | String consisting of 2-11 characters
`international` | Any [MSISDN](doc-341641#msisdn)

## Marketing purpose

Because of GDPR regulations, when Message that has marketing purpose is meant to be sent to MPC members by [Audience](doc-354473#audience-recipients), then members without marketing consent (see: [Member](doc-34213)) required for specific channel will be filtered out from the Audience.

By default, the marketing purpose of Message is implied from [Service](doc-354677#services) - details for a specific service can be referenced [here](api-3927095).

It is also possible to explicitly mark a Message either by marketing or a non-marketing with `marketing:bool` flag, but it requires an additional API permit - `Messages:Api:Sendings:WithoutConsentsChecks`.

