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
|
The unique string that we created to identify the Interaction resource. |
session_sid
|
The SID of the parent Session resource. |
service_sid
|
The SID of the parent Service resource. |
account_sid
|
The SID of the Account that created the Interaction resource. |
data
|
A JSON string that includes the message body of message interactions (e.g. |
type
|
The Type of the Interaction. Can be: |
inbound_participant_sid
|
The SID of the inbound Participant resource. |
inbound_resource_sid
|
The SID of the inbound resource; either the Call or [Message](https://www.twilio.com/docs/sms/api/message. |
inbound_resource_status
|
The inbound resource status of the Interaction. Will always be |
inbound_resource_type
|
|
inbound_resource_url
|
The URL of the Twilio inbound resource |
outbound_participant_sid
|
The SID of the outbound Participant). |
outbound_resource_sid
|
The SID of the outbound resource; either the Call or Message. |
outbound_resource_status
|
The outbound resource status of the Interaction. Can be: |
outbound_resource_type
|
|
outbound_resource_url
|
The URL of the Twilio outbound resource. |
date_created
|
The ISO 8601 date and time in GMT when the Interaction was created. |
date_updated
|
The ISO 8601 date and time in GMT when the resource was last updated. |
url
|
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
https://proxy.twilio.com/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Interactions/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the parent Service of the resource to fetch. |
session_sid
Path
|
The SID of the parent Session of the resource to fetch. |
sid
Path
|
The Twilio-provided string that uniquely identifies the Interaction resource to fetch. |
Example 1
Read multiple Interaction resources
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
|
The SID of the parent Service to read the resources from. |
session_sid
Path
|
The SID of the parent Session to read the resources from. |
Example 1
Delete an Interaction resource
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
|
The SID of the parent Service of the resource to delete. |
session_sid
Path
|
The SID of the parent Session of the resource to delete. |
sid
Path
|
The Twilio-provided string that uniquely identifies the Interaction resource to delete. |
Example 1
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.