<commit_before># Broadcast Settings

```
GET /api/v1/broadcast-settings/<broadcastId>
```
Returns the settings necessary to setup a Customer.io Triggered Campaign **after** the broadcast is created in Contentful.

## Authentication

The endpoint expects you to use [Basic Auth](../authentication.md). Example url using the browser: `http://protectedName:protectedPass@localhost:5100/api/v1/broadcast-settings/100`


## Inputs

Param | Description
--- | ---
`useTwilioTestCredentials=true` | Returns broadcast settings that use Twilio's [test credentials](https://www.twilio.com/docs/api/rest/test-credentials).
`userPhoneField=<any valid US number>` | Overrides the `To=` field with the passed `userPhoneField` in the `webhook.body` settings property.  

## Examples


<details>
<summary><strong>Example Request</strong></summary>

GET settings for the broadcastId: `tacosfest`.

```
curl -X "GET" "http://localhost:5100/api/v1/broadcast-settings/tacosfest" \
     -H "Authorization: Basic cHVwcGV0OnRvdGFsbHlzZWNyZXQ="
```
</details>

<details>
<summary><strong>Example Response</strong></summary>

```
{
  "broadcast": {
    "broadcastId": "tacosfest",
    "message": "hola, you are invited to the best tacos festival in the whole world.",
    "declinedMessage": "nope"
  },
  "campaign": {
    "campaignId": "48"
  },
  "webhook": {
    "url": "https://SKXX:wtXX@api.twilio.com/2010-04-01/Accounts/ACXX/Messages.json",
    "headers": {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    "body": "To={{customer.phone}}&Body=hola, you are invited to the best tacos festival in the whole world.&MessagingServiceSid=MGXX&StatusCallback=https%3A%2F%2Fpuppet%3Atotallysecret%4057528dc6.ngrok.io%2Fapi%2Fv1%2Fimport-message%3FbroadcastId%3Dtacosfest"
  }
}
```
</details>

## Troubleshooting

Error | Meaning
--- | ---
Cannot GET `/api/v1/broadcast-settings` | Missing broadcastId in the URL
Broadcast **X** not found. | broadcastId was not found in Contentful. Is it published?
Broadcast misconfigured. Message is required! | Broadcast `message` field is empty in Contentful. Is this an old broadcast? Customer.io broadcasts expect the copy to exist in Contentful.
<commit_msg>updated route docs<commit_after># Broadcast Settings

```
GET /api/v1/broadcast-settings/<broadcastId>
```
Returns the settings necessary to setup a Customer.io Triggered Campaign **after** the broadcast is created in Contentful.

## Authentication

The endpoint expects you to use [Basic Auth](../authentication.md). Example url using the browser: `http://protectedName:protectedPass@localhost:5100/api/v1/broadcast-settings/100`


## Inputs

Param | Description
--- | ---
`userPhoneField=<any valid US number>` | Overrides the `To` property with the passed `userPhoneField` in the `webhook.To` settings property.  

## Examples


<details>
<summary><strong>Example Request</strong></summary>

GET settings for the broadcastId: `tacosfest`.

```
curl -X "GET" "http://localhost:5100/api/v1/broadcast-settings/tacosfest" \
     -H "Authorization: Basic cHVwcGV0OnRvdGFsbHlzZWNyZXQ="
```
</details>

<details>
<summary><strong>Example Response</strong></summary>

```
{
  "broadcast": {
    "broadcastId": "tacosfest",
    "message": "hola, you are invited to the best tacos festival in the whole world.",
    "declinedMessage": "nope"
  },
  "campaign": {
    "campaignId": "48"
  },
  "webhook": {
    "url": "http://<secret>:<secret>@blink-staging.dosomething.org/api/v1/webhooks/customerio-sms-broadcast",
    "headers": {
      "Content-Type": "application/json"
    },
    "body": {
      "To": "{{customer.phone}}",
      "Body": "hola, you are invited to the best tacos festival in the whole world.",
      "StatusCallback": "http://<secret>:<secret>@blink-staging.dosomething.org/api/v1/webhooks/customerio-sms-broadcast?broadcastId=tacosfest"
    }
  },
  "statusCallbackUrl": "http://<secret>:<secret>@blink-staging.dosomething.org/api/v1/webhooks/customerio-sms-broadcast?broadcastId=tacosfest"
}
```
</details>

## Troubleshooting

Error | Meaning
--- | ---
Cannot GET `/api/v1/broadcast-settings` | Missing broadcastId in the URL
Broadcast **X** not found. | broadcastId was not found in Contentful. Is it published?
Broadcast misconfigured. Message is required! | Broadcast `message` field is empty in Contentful. Is this an old broadcast? Customer.io broadcasts expect the copy to exist in Contentful.

{'fraction_non_alphanumeric': 0.14402358811521887, 'fraction_numerical': 0.014742572011794058, 'mean_word_length': 4.582278481012659, 'pattern_counts': {'":': 26, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5554319', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1430, 'n_words': 364}