Create a new Interaction.

POST /v1/Interactions

Create a new Interaction.

application/x-www-form-urlencoded

Body

  • Channel Required

    The Interaction's channel.

  • Routing

    The Interaction's routing logic.

  • InteractionContextSid string

    The Interaction context sid is used for adding a context lookup sid

    Minimum length is 34, maximum length is 34. Format should match the following pattern: ^HQ[0-9a-fA-F]{32}$.

  • WebhookTtid string

    The unique identifier for Interaction level webhook

Responses

  • 201 application/json

    Created

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attributes Show response attributes object
    • sid string | null

      The unique string created by Twilio to identify an Interaction resource, prefixed with KD.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^KD[0-9a-fA-F]{32}$.

    • channel

      A JSON object that defines the Interaction’s communication channel and includes details about the channel. See the Outbound SMS and inbound (API-initiated) Channel object examples.

    • routing

      A JSON Object representing the routing rules for the Interaction Channel. See Outbound SMS Example for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see Known Task Attributes.

    • url string(uri) | null
    • interaction_context_sid string | null

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^HQ[0-9a-fA-F]{32}$.

    • webhook_ttid string | null
POST /v1/Interactions
curl \
 --request POST 'https://flex-api.twilio.com/v1/Interactions' \
 --user "username:password" \
 --header "Content-Type: application/x-www-form-urlencoded" \
 --data 'Channel=%7B%22type%22%3A%22sms%22%2C%22initiated_by%22%3A%22customer%22%7D&Routing=%7B%7D&WebhookTtid=flex_interactionwebhook_00000000000000000000000000&InteractionContextSid=interaction_context_sid'
Request example
{"Channel"=>"{\"type\":\"sms\",\"initiated_by\":\"customer\"}", "Routing"=>"{}", "WebhookTtid"=>"flex_interactionwebhook_00000000000000000000000000", "InteractionContextSid"=>"interaction_context_sid"}
Response examples (201)
{
  "sid": "KDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "url": "https://flex-api.twilio.com/v1/Interactions/KDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "links": {
    "channels": "https://flex-api.twilio.com/v1/Interactions/KDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels"
  },
  "channel": {
    "sid": "UOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "type": "sms"
  },
  "routing": {
    "properties": {
      "age": 0,
      "sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "addons": "{}",
      "reason": "",
      "timeout": 86400,
      "priority": 0,
      "queue_sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "attributes": "{\"customerAddress\":\"customer phone address\",\"flexChannelInviteSid\":\"KGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"conversationSid\":\"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"channelType\":\"sms\",\"customers\":{\"phone\":\"customer phone address\",\"name\":\"customer name\"},\"conversations\":{\"initiated_by\":\"customer\",\"conversation_id\":\"KDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"media\":[{\"type\":\"ChatTranscript\",\"sid\":\"CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}]},\"customerName\":\"customer name\",\"flexInteractionChannelSid\":\"UOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"initiatedBy\":\"customer\",\"flexInteractionSid\":\"KDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"direction\":\"inbound\"}",
      "queue_name": "Sample Queue",
      "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "age_in_queue": 0,
      "date_created": 1634845217,
      "date_updated": 1634845217,
      "workflow_sid": "WWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "workflow_name": "Default Fifo Workflow",
      "workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "routing_target": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "assignmentCounter": 0,
      "assignment_status": "pending",
      "task_queue_entered_date": 1634845217,
      "task_channel_unique_name": "default"
    },
    "reservation": null
  },
  "webhook_ttid": "flex_interactionwebhook_00000000000000000000000000",
  "interaction_context_sid": null
}