from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

assistant_sid = 'UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

# Provide actions for your assistant: say something and listen for a repsonse.
update_action = {
    'actions': [
        {'say': 'Hi there, I\'m your virtual assistant! How can I help you?'},
        {'listen': True}
    ]
}

# Update the default intent to use your new actions.
client.preview.understand \
    .assistants(assistant_sid) \
    .intents('hello-world') \
    .intent_actions().update(update_action)

print("Intent actions updated")

from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

# Provide actions for your assistant: say something and listen for a repsonse.
update_action = {
    'actions': [
        {'say': 'Hi there, I\'m your virtual assistant! How can I help you?'},
        {'listen': True}
    ]
}

# Update the default intent to use your new actions.
# Replace 'UAXXX...' with your Assistant's unique SID https://www.twilio.com/console/assistant/list
client.preview.understand \
    .assistants('UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
    .intents('hello-world') \
    .intent_actions().update(update_action)

print("Intent actions updated")

Update intent actions to use assistant SID inline
Update intent actions to use assistant SID inline

Maintaining consistency with the auto-generated code samples for Understand, which 
don't allow for our variable-named placeholder values
  from twilio.rest import Client
  
  # Your Account Sid and Auth Token from twilio.com/console
  account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
  auth_token = 'your_auth_token'
  client = Client(account_sid, auth_token)
- 
- assistant_sid = 'UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
  
  # Provide actions for your assistant: say something and listen for a repsonse.
  update_action = {
      'actions': [
          {'say': 'Hi there, I\'m your virtual assistant! How can I help you?'},
          {'listen': True}
      ]
  }
  
  # Update the default intent to use your new actions.
+ # Replace 'UAXXX...' with your Assistant's unique SID https://www.twilio.com/console/assistant/list
  client.preview.understand \
-     .assistants(assistant_sid) \
+     .assistants('UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
      .intents('hello-world') \
      .intent_actions().update(update_action)
  
  print("Intent actions updated")
  
Update intent actions to use assistant SID inline
## Code Before:
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

assistant_sid = 'UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

# Provide actions for your assistant: say something and listen for a repsonse.
update_action = {
    'actions': [
        {'say': 'Hi there, I\'m your virtual assistant! How can I help you?'},
        {'listen': True}
    ]
}

# Update the default intent to use your new actions.
client.preview.understand \
    .assistants(assistant_sid) \
    .intents('hello-world') \
    .intent_actions().update(update_action)

print("Intent actions updated")

## Instruction:
Update intent actions to use assistant SID inline
## Code After:
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

# Provide actions for your assistant: say something and listen for a repsonse.
update_action = {
    'actions': [
        {'say': 'Hi there, I\'m your virtual assistant! How can I help you?'},
        {'listen': True}
    ]
}

# Update the default intent to use your new actions.
# Replace 'UAXXX...' with your Assistant's unique SID https://www.twilio.com/console/assistant/list
client.preview.understand \
    .assistants('UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
    .intents('hello-world') \
    .intent_actions().update(update_action)

print("Intent actions updated")
