API: Open Chat Studio v2 Description: Build, deploy and monitor chatbots. TAG: Chatbot Triggers Description: Add, change and archive the triggers that run an action on a conversation event, after inactivity, or at a set time. ENDPOINTS: POST /api/v2/chatbots/{id}/scheduled-triggers/ Summary: Add a Scheduled trigger Description: A scheduled trigger runs its action once, at a set date and time, for every open session of the published version (or only those active within `active_session_window_days`). The date and time must be in the future. Each trigger runs one action. `action.params` depends on `action.action_type`; the table in the `params` field's description lists the keys each type takes. The change applies to the working (draft) version; publish the chatbot for it to reach participants of the published version. Parameters: - id (path, string (required)): Chatbot ID Request Body: Content: application/json Schema: ScheduledTriggerWrite Responses: 201: Content: application/json Schema: ScheduledTriggerWrite 400: The body is not one this endpoint accepts. Errors are keyed by the field at fault, with the action's errors under `action` and its params' errors under `action.params`; an error about the combination of trigger and action is under `action.non_field_errors`. Nothing is saved. 403: The caller is authenticated but not authorised to modify this chatbot: either its role lacks permission to change chatbots, or it is a read-only key, or a machine (client-credentials) token whose application is not authorised for this chatbot. 404: No such working chatbot in this team. Security: OAuth2 - Required scopes: chatbots:write apiKeyAuth tokenAuth PATCH /api/v2/chatbots/{id}/scheduled-triggers/{trigger_id}/ Summary: Update a Scheduled trigger Description: Only the fields you send change. If you send `action`, its `params` replace the stored params, so send every param the action needs; leave `action_type` out to keep the current one. A read-only field may be sent only with its current value, so a response can be sent back as it is. The change applies to the working (draft) version; publish the chatbot for it to reach participants of the published version. Parameters: - id (path, string (required)): Chatbot ID - trigger_id (path, integer (required)): The trigger's id, as returned by a create or by the `chatbot_inspect` endpoint. Request Body: Content: application/json Schema: PatchedScheduledTriggerWrite Responses: 200: Content: application/json Schema: ScheduledTriggerWrite 400: The body is not one this endpoint accepts. Errors are keyed by the field at fault, with the action's errors under `action` and its params' errors under `action.params`; an error about the combination of trigger and action is under `action.non_field_errors`. Nothing is saved. 403: The caller is authenticated but not authorised to modify this chatbot: either its role lacks permission to change chatbots, or it is a read-only key, or a machine (client-credentials) token whose application is not authorised for this chatbot. 404: No such chatbot, or no trigger of this kind with this id on its working version. A published version's triggers and archived triggers are not reachable. Security: OAuth2 - Required scopes: chatbots:write apiKeyAuth tokenAuth DELETE /api/v2/chatbots/{id}/scheduled-triggers/{trigger_id}/ Summary: Archive a Scheduled trigger Description: Archive the scheduled trigger. This is a soft delete: a person can restore it in the web app. A repeat of this call answers `404`, which makes it safe to retry. The change applies to the working (draft) version; publish the chatbot for it to reach participants of the published version. Parameters: - id (path, string (required)): Chatbot ID - trigger_id (path, integer (required)): The trigger's id, as returned by a create or by the `chatbot_inspect` endpoint. Responses: 200: Content: application/json Schema: ResourceArchived 403: The caller is authenticated but not authorised to modify this chatbot: either its role lacks permission to change chatbots, or it is a read-only key, or a machine (client-credentials) token whose application is not authorised for this chatbot. 404: No such chatbot, or no trigger of this kind with this id on its working version. A published version's triggers and archived triggers are not reachable. Security: OAuth2 - Required scopes: chatbots:write apiKeyAuth tokenAuth POST /api/v2/chatbots/{id}/static-triggers/ Summary: Add a Static trigger Description: A static trigger runs its action when a conversation event happens, such as a conversation starting or a participant sending a message. Two combinations are refused: a `new_bot_message` trigger cannot run `send_message_to_bot` or `schedule_trigger`, and a trigger on a conversation ending cannot run `end_conversation`. Each trigger runs one action. `action.params` depends on `action.action_type`; the table in the `params` field's description lists the keys each type takes. The change applies to the working (draft) version; publish the chatbot for it to reach participants of the published version. Parameters: - id (path, string (required)): Chatbot ID Request Body: Content: application/json Schema: StaticTriggerWrite Responses: 201: Content: application/json Schema: StaticTriggerWrite 400: The body is not one this endpoint accepts. Errors are keyed by the field at fault, with the action's errors under `action` and its params' errors under `action.params`; an error about the combination of trigger and action is under `action.non_field_errors`. Nothing is saved. 403: The caller is authenticated but not authorised to modify this chatbot: either its role lacks permission to change chatbots, or it is a read-only key, or a machine (client-credentials) token whose application is not authorised for this chatbot. 404: No such working chatbot in this team. Security: OAuth2 - Required scopes: chatbots:write apiKeyAuth tokenAuth PATCH /api/v2/chatbots/{id}/static-triggers/{trigger_id}/ Summary: Update a Static trigger Description: Only the fields you send change. If you send `action`, its `params` replace the stored params, so send every param the action needs; leave `action_type` out to keep the current one. A read-only field may be sent only with its current value, so a response can be sent back as it is. The change applies to the working (draft) version; publish the chatbot for it to reach participants of the published version. Parameters: - id (path, string (required)): Chatbot ID - trigger_id (path, integer (required)): The trigger's id, as returned by a create or by the `chatbot_inspect` endpoint. Request Body: Content: application/json Schema: PatchedStaticTriggerWrite Responses: 200: Content: application/json Schema: StaticTriggerWrite 400: The body is not one this endpoint accepts. Errors are keyed by the field at fault, with the action's errors under `action` and its params' errors under `action.params`; an error about the combination of trigger and action is under `action.non_field_errors`. Nothing is saved. 403: The caller is authenticated but not authorised to modify this chatbot: either its role lacks permission to change chatbots, or it is a read-only key, or a machine (client-credentials) token whose application is not authorised for this chatbot. 404: No such chatbot, or no trigger of this kind with this id on its working version. A published version's triggers and archived triggers are not reachable. Security: OAuth2 - Required scopes: chatbots:write apiKeyAuth tokenAuth DELETE /api/v2/chatbots/{id}/static-triggers/{trigger_id}/ Summary: Archive a Static trigger Description: Archive the static trigger. This is a soft delete: a person can restore it in the web app. A repeat of this call answers `404`, which makes it safe to retry. The change applies to the working (draft) version; publish the chatbot for it to reach participants of the published version. Parameters: - id (path, string (required)): Chatbot ID - trigger_id (path, integer (required)): The trigger's id, as returned by a create or by the `chatbot_inspect` endpoint. Responses: 200: Content: application/json Schema: ResourceArchived 403: The caller is authenticated but not authorised to modify this chatbot: either its role lacks permission to change chatbots, or it is a read-only key, or a machine (client-credentials) token whose application is not authorised for this chatbot. 404: No such chatbot, or no trigger of this kind with this id on its working version. A published version's triggers and archived triggers are not reachable. Security: OAuth2 - Required scopes: chatbots:write apiKeyAuth tokenAuth POST /api/v2/chatbots/{id}/timeout-triggers/ Summary: Add a Timeout trigger Description: A timeout trigger runs its action after the participant has been inactive for `delay` seconds, up to `total_num_triggers` times in one session. Each trigger runs one action. `action.params` depends on `action.action_type`; the table in the `params` field's description lists the keys each type takes. The change applies to the working (draft) version; publish the chatbot for it to reach participants of the published version. Parameters: - id (path, string (required)): Chatbot ID Request Body: Content: application/json Schema: TimeoutTriggerWrite Responses: 201: Content: application/json Schema: TimeoutTriggerWrite 400: The body is not one this endpoint accepts. Errors are keyed by the field at fault, with the action's errors under `action` and its params' errors under `action.params`; an error about the combination of trigger and action is under `action.non_field_errors`. Nothing is saved. 403: The caller is authenticated but not authorised to modify this chatbot: either its role lacks permission to change chatbots, or it is a read-only key, or a machine (client-credentials) token whose application is not authorised for this chatbot. 404: No such working chatbot in this team. Security: OAuth2 - Required scopes: chatbots:write apiKeyAuth tokenAuth PATCH /api/v2/chatbots/{id}/timeout-triggers/{trigger_id}/ Summary: Update a Timeout trigger Description: Only the fields you send change. If you send `action`, its `params` replace the stored params, so send every param the action needs; leave `action_type` out to keep the current one. A read-only field may be sent only with its current value, so a response can be sent back as it is. The change applies to the working (draft) version; publish the chatbot for it to reach participants of the published version. Parameters: - id (path, string (required)): Chatbot ID - trigger_id (path, integer (required)): The trigger's id, as returned by a create or by the `chatbot_inspect` endpoint. Request Body: Content: application/json Schema: PatchedTimeoutTriggerWrite Responses: 200: Content: application/json Schema: TimeoutTriggerWrite 400: The body is not one this endpoint accepts. Errors are keyed by the field at fault, with the action's errors under `action` and its params' errors under `action.params`; an error about the combination of trigger and action is under `action.non_field_errors`. Nothing is saved. 403: The caller is authenticated but not authorised to modify this chatbot: either its role lacks permission to change chatbots, or it is a read-only key, or a machine (client-credentials) token whose application is not authorised for this chatbot. 404: No such chatbot, or no trigger of this kind with this id on its working version. A published version's triggers and archived triggers are not reachable. Security: OAuth2 - Required scopes: chatbots:write apiKeyAuth tokenAuth DELETE /api/v2/chatbots/{id}/timeout-triggers/{trigger_id}/ Summary: Archive a Timeout trigger Description: Archive the timeout trigger. This is a soft delete: a person can restore it in the web app. A repeat of this call answers `404`, which makes it safe to retry. The change applies to the working (draft) version; publish the chatbot for it to reach participants of the published version. Parameters: - id (path, string (required)): Chatbot ID - trigger_id (path, integer (required)): The trigger's id, as returned by a create or by the `chatbot_inspect` endpoint. Responses: 200: Content: application/json Schema: ResourceArchived 403: The caller is authenticated but not authorised to modify this chatbot: either its role lacks permission to change chatbots, or it is a read-only key, or a machine (client-credentials) token whose application is not authorised for this chatbot. 404: No such chatbot, or no trigger of this kind with this id on its working version. A published version's triggers and archived triggers are not reachable. Security: OAuth2 - Required scopes: chatbots:write apiKeyAuth tokenAuth SCHEMAS: PatchedScheduledTriggerWrite: - id: integer - trigger_date: string - trigger_time: string - timezone: string - active_session_window_days: integer - scheduled_at: string - fired_at: string - is_active: boolean - action: TriggerAction PatchedStaticTriggerWrite: - id: integer - type: Unknown - is_active: boolean - action: TriggerAction PatchedTimeoutTriggerWrite: - id: integer - delay: integer - total_num_triggers: integer - trigger_from_first_message: boolean - is_active: boolean - action: TriggerAction ResourceArchived: - archived: boolean (required) ScheduledTriggerWrite: - id: integer (required) - trigger_date: string (required) - trigger_time: string (required) - timezone: string (required) - active_session_window_days: integer - scheduled_at: string (required) - fired_at: string (required) - is_active: boolean (required) - action: TriggerAction (required) StaticTriggerWrite: - id: integer (required) - type: Unknown (required) - is_active: boolean (required) - action: TriggerAction (required) TimeoutTriggerWrite: - id: integer (required) - delay: integer (required) - total_num_triggers: integer - trigger_from_first_message: boolean - is_active: boolean (required) - action: TriggerAction (required) TriggerAction: - action_type: Unknown - params: object SECURITY: - OAuth2 - Authorization Code Flow (authorization url: /o/authorize/, token url: /o/token/) - API Key authentication (header: X-api-key) - HTTP bearer authentication