SendCommand

Sends a command to a connector.

SendCommand(
  commandIdn: str,
  integrationIdn: str,
  connectorIdn: str,
  **arguments: str
)

Where:

  • commandIdn: The connector command identifier.
  • integrationIdn: The integration identifier (program_timer, twilio, vapi, sandbox, etc.).
  • connectorIdn: The connector identifier.
  • **arguments: Arbitrary arguments sent along with the message.
    • personaId: The ID of the persona for whom the timer is to be set.
    • timerName: The name of the timer (must be unique for the persona).
    • fireAt: The date/time of timer activation in the format: YYYY-MM-DD[T]HH:MM[:SS[.ffffff]][Z or HH[:]MM.
    • repeatable: Set as “true” or “false.” If “true,” the timer activation repeats after the interval. The default is “false.” If repeatable="true," then the interval is mandatory. If repeatable="false", fireAt and interval are set, then the interval is ignored. If repeatable="true," fireAt and interval are set, then the timer will first activate at fireAt and then will repeat after the interval.
    • interval: The interval after which the timer will activate in seconds.
    • enabled: Set as “true” or “false.” Sets whether the timer is active or not.

Example 1 (Make Phone Calls)

In the example below, the connector will call the number +16507000000. If the user picks up the phone, a persona and actor will be created for them if necessary (if this is a new user), and responses will be generated in a new flow instance that has a subscription to the user_message event from the twilio/testtwilio12 connector.

SendCommand(
  commandIdn="make_call", 
  integrationIdn="twilio", 
  connectorIdn="testtwilio12", 
  phone_number="+16507000000"
)

See "Make Telephone Calls (Twilio)."

Example 2 (Timers)

In the examples below, timers are being set up using a variety of different arguments. Programmable timers support a single command "set_timer."

The below SendCommand action activates a timer once at 2024-02-20[T]22:17.

{{SendCommand(commandIdn="set_timer", integrationIdn="program_timer", connectorIdn="fire_timer", fire_at="2024-02-20T22:17", 
persona_id=GetUser(field="id"), timer_name="MyTimer", repeatable="false")}}}

The below SendCommand action activates a timer once after 120 seconds.

SendCommand(commandIdn="set_timer", integrationIdn="program_timer", connectorIdn="my_timer", persona_id=GetUser(field=”id”), timer_name=”followup_timer_2”, interval=”120”)

The below SendCommand action activates a timer repeatedly after 240 seconds.

SendCommand(commandIdn="set_timer", integrationIdn="program_timer", connectorIdn="my_timer", persona_id=GetUser(field=”id”), timer_name=”followup_timer_3”, interval=”240”, repeatable=”true”)

The below SendCommand action creates a timer but disables it.

SendCommand(commandIdn="set_timer", integrationIdn="program_timer", connectorIdn="my_timer", persona_id=GetUser(field=”id”), timer_name=”followup_timer_3”, enabled=”false”)

The below SendCommand action creates a timer and enables it.

SendCommand(commandIdn="set_timer", integrationIdn="program_timer", connectorIdn="my_timer", persona_id=GetUser(field=”id”), timer_name=”followup_timer_3”, enabled=”true”)