# Create a phone Switch

You can use the API to deflect phone calls to the Intercom Messenger.
Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified.

If custom attributes are specified, they will be added to the user or lead's custom data attributes.

Endpoint: POST /phone_call_redirects
Version: 2.18
Security: bearerAuth

## Security:

  - `bearerAuth` (unknown)
    http bearer

## Header parameters:

  - `Intercom-Version` (string)

## Request fields (application/json):

  - `phone` (string, required)
    Phone number in E.164 format, that will receive the SMS to continue the conversation in the Messenger.
    Example: +1 1234567890

  - `custom_attributes` (object)
    Custom attributes to add to the user or lead's custom data attributes. Values are strings. Numbers and booleans are converted to strings. An empty string, or any array or object value, returns a `422` error with the key `context`. A `null` value is ignored.
    Example: {"issue_type":"Billing","priority":"High"}

  - `body` (string)
    The text of the contact's first message. When you send it, a conversation is created straight away with this text as its first message.
    Example: I need help with my invoice

  - `send_notification` (boolean)
    Whether to send the SMS with the link to the Messenger. When `false`, no SMS is sent.
    Example: true

  - `user_input_phone` (string)
    The phone number as the contact typed it, in national format. When sent with `country`, used in place of `phone` to read the number. `phone` is still required.
    Example: 087 234 5678

  - `country` (string)
    The two-letter country code used to read `user_input_phone`. When `country` is `US`, Intercom also looks up the carrier to detect landlines.
    Example: IE

## Request examples:

  - `successful` (unknown)

  - `bad request - exception sending sms` (unknown)

  - `bad request - invalid number` (unknown)

  - `unprocessable entity` (unknown)

  - `Missing phone number` (unknown)

  - `Invalid custom attributes` (unknown)

## Response 200:

  - `200` (unknown)
    successful

## Response 200 fields (application/json):

  - `type` (string)
    Enum: "phone_call_redirect"

  - `url` (string)
    The Messenger link for the phone call redirect, which is also the link sent by SMS to the phone number.
    Example: http://via.intercom.io/msgr/1add3dd1-a75e-4a96-96fd-984d16aba059

## Response 400:

  - `400` (unknown)
    The phone number lookup or the SMS send failed

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `type` (string, required)
    The type is error.list
    Example: error.list

  - `request_id` (string)
    Example: f93ecfa8-d08a-4325-8694-89aeb89c8f85

  - `errors` (array, required)
    An array of one or more error objects

  - `errors.code` (string, required)
    A string indicating the kind of error, used to further qualify the HTTP response code.
    Example: unauthorized

  - `errors.message` (string)
    Optional. Human readable description of the error.
    Example: Access Token Invalid

  - `errors.data` (object)
    Optional. Extra detail about the error, for example `required_permissions` on a 403 `action_forbidden` error.
    Example: {"required_permissions":["read_conversations"]}

## Response 422:

  - `422` (unknown)
    The request was invalid. The response is an object with a single `error_key`: `caller_phone` when `phone` is missing, `invalid_phone_number`, `landline_phone`, `twilio_settings` when the workspace has no Twilio account to send the SMS, or `context` when `custom_attributes` is invalid. Any other invalid input returns its own key, such as `send_notification` or `country`.

## Response 200 examples:

  - `successful` (unknown)

## Response 400 examples:

  - `bad request - exception sending sms` (unknown)

  - `bad request - invalid number` (unknown)

## Response 401 examples:

  - `Unauthorized` (unknown)

  - `Feature not available` (unknown)

## Response 422 examples:

  - `Invalid phone number` (unknown)

  - `unprocessable entity` (unknown)

  - `Twilio account not found` (unknown)

  - `Missing phone number` (unknown)

  - `Invalid custom attributes` (unknown)

