Menu

Expand
Rate this page:

Interaction

Interactions are read-only communications logs of a given Session. Each Interaction represents a single communication.

Interactions are composed of an inbound (to Twilio) and an outbound (from Twilio) leg. Interactions can have both inbound and outbound legs or be "one-sided" (like when creating a Message Interaction resource).

If a user sends an SMS to a proxy number, and Twilio Proxy handles the proxying to the other Participant, you'll have an Interaction with both an inbound SMS and an outbound SMS.

Interaction properties

Resource Properties in REST API format
sid
sid<KI> Not PII

The unique string that we created to identify the Interaction resource.

session_sid
sid<KC> Not PII

The SID of the parent Session resource.

service_sid
sid<KS> Not PII

The SID of the parent Service resource.

account_sid
sid<AC> Not PII

The SID of the Account that created the Interaction resource.

data

A JSON string that includes the message body of message interactions (e.g. {"body": "hello"}) or the call duration (when available) of a call (e.g. {"duration": "5"}).

type
enum:type Not PII

The Type of the Interaction. Can be: message, voice or unknown.

inbound_participant_sid
sid<KP> Not PII

The SID of the inbound Participant resource.

inbound_resource_sid
sid Not PII

The SID of the inbound resource; either the Call or [Message](https://www.twilio.com/docs/sms/api/message.

inbound_resource_status
enum:resource_status Not PII

The inbound resource status of the Interaction. Will always be delivered for messages and in-progress for calls.

inbound_resource_type
string Not PII

The inbound resource type. Can be Call or Message.

inbound_resource_url
url Not PII

The URL of the Twilio inbound resource

outbound_participant_sid
sid<KP> Not PII

The SID of the outbound Participant).

outbound_resource_sid
sid Not PII

The SID of the outbound resource; either the Call or Message.

outbound_resource_status
enum:resource_status Not PII

The outbound resource status of the Interaction. Can be: accepted, canceled, deleted, delivered, delivery-unknown, failed, partially-delivered, queued, read, received, receiving, scheduled, sending, sent, undelivered, or unknown for messages. Can be initiated or completed or unknown for calls.

outbound_resource_type
string Not PII

The outbound resource type. Can be: Call or Message.

outbound_resource_url
url Not PII

The URL of the Twilio outbound resource.

date_created
date_time<iso8601> Not PII

The ISO 8601 date and time in GMT when the Interaction was created.

date_updated
date_time<iso8601> Not PII

The ISO 8601 date and time in GMT when the resource was last updated.

url
url Not PII

The absolute URL of the Interaction resource.

Create an Interaction resource

You cannot POST to the Interactions resource. Instead, you can generate Interactions via the appropriate Participant's MessageInteraction resource. For details, see Sending Messages. Otherwise, Interactions are created automatically when Participants text or call each other.

Fetch an Interaction resource

get
https://proxy.twilio.com/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Interactions/{Sid}
Parameters
Parameters in REST API format
service_sid
Path
get sid<KS> Not PII

The SID of the parent Service of the resource to fetch.

session_sid
Path
get sid<KC> Not PII

The SID of the parent Session of the resource to fetch.

sid
Path
get sid<KI> Not PII

The Twilio-provided string that uniquely identifies the Interaction resource to fetch.

Example 1
Loading Code Sample...
        
        

        Fetch Interaction

        Read multiple Interaction resources

        get
        https://proxy.twilio.com/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Interactions

        Retrieve a list of Interactions for a given Session.

        Parameters
        Parameters in REST API format
        service_sid
        Path
        get sid<KS> Not PII

        The SID of the parent Service to read the resources from.

        session_sid
        Path
        get sid<KC> Not PII

        The SID of the parent Session to read the resources from.

        Example 1
        Loading Code Sample...
              
              

              Read Interaction

              Delete an Interaction resource

              delete
              https://proxy.twilio.com/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Interactions/{Sid}

              Deleting an Interaction removes it permanently.

              Any Message or Call records created during this interaction will NOT be deleted automatically. If you want to delete all related Message/Call resources, you must issue direct DELETE requests for the inbound and outbound resources directly. Once you have deleted an interaction, those resource Sids will not be discoverable via Proxy.

              Parameters
              Parameters in REST API format
              service_sid
              Path
              delete sid<KS> Not PII

              The SID of the parent Service of the resource to delete.

              session_sid
              Path
              delete sid<KC> Not PII

              The SID of the parent Session of the resource to delete.

              sid
              Path
              delete sid<KI> Not PII

              The Twilio-provided string that uniquely identifies the Interaction resource to delete.

              Example 1
              Loading Code Sample...
                    
                    

                    Delete Interaction

                    Rate this page:

                    Need some help?

                    We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                    Loading Code Sample...
                          
                          
                          

                          Thank you for your feedback!

                          Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                          Sending your feedback...
                          🎉 Thank you for your feedback!
                          Something went wrong. Please try again.

                          Thanks for your feedback!

                          thanks-feedback-gif