Storing Nest Camera media source as an input_text

There is no media source for trigger “Doorbell pressed”.
I have set up a video recording for the trigger “person detected”. It is likely the video recording is still running while trigger “Doorbell pressed” goes off. Hence I would like to use the media source of trigger “person detected” as a substitute.

I have create a helper, input_text.hello_doorbell_current_event_id, for this purpose. However, assigning the value of trigger.event.data.nest_event_id to the helper failed and stalls the automation. The automation is defined as the following:

What is the proper way to assign the value?

alias: Hello Doorbell Person Detected
description: >-
  Record a video when a person is detected by Hello Video Doorbell.

  As automation Hellobell Pressed does not come with a way to get the thumbnail.
  Hence it might share the thumbnail captured by this auomation if this
  automation is still running.
trigger:
  - platform: device
    device_id: 35fb51270433531b21def80a4b34a2c4
    domain: nest
    type: camera_person
condition: []
action:
  - variables:
      time_stamp: "{{ now().strftime('%Y-%m-%d %H-%M-%S') }}"
      date_stamp: "{{ time_stamp[:10] }}"
  - alias: >-
      **** It fails at this step ****
      assign trigger.event.data.nest_event_id to input_text.hello_doorbell_current_event_id
    service: input_text.set_value
      data:
        value: "{{ trigger.event.data.nest_event_id }}"
      target:
        entity_id: input_text.hello_doorbell_current_event_id
  - service: camera.snapshot
    data:
      filename: >-
        /CCTV/Hello_Doorbell/{{ date_stamp }}/Person_Detected/{{ time_stamp
        }}.jpg
    target:
      entity_id: camera.hello_video_doorbell
  - parallel:
      - alias: Take a video
        service: script.turn_on
        target:
          entity_id: script.camera_recording
        data:
          variables:
            camera: camera.hello_video_doorbell
            video_duration: 35
            video_lookback: 25
            video_destination: >-
              /CCTV/Hello_Doorbell/{{ date_stamp }}/Person_Detected/{{
              time_stamp }}.mp4
      - alias: send mobile messages to adults
        service: notify.ADULT_MOBILES
        data:
          message: Hello Doordell - A Person Detected.
          title: Hello Doordell - A Person Detected.
          data:
            image: >-
              /api/nest/event_media/{{ trigger.event.data.device_id }}/{{
              trigger.event.data.nest_event_id }}/thumbnail
            video: >-
              /api/nest/event_media/{{ trigger.event.data.device_id }}/{{
              trigger.event.data.nest_event_id }}
            url: /lovelace/hello-doorbell-camera
            clickAction: /lovelace/hello-doorbell-camera
  - alias: >-
      reset input_text.hello_doorbell_current_event_id to 'unknown'.
    service: input_text.set_value
      data:
        value: unknown
      target:
        entity_id: input_text.hello_doorbell_current_event_id

The max length of input_text.hello_doorbell_current_event_id is 2000.

The trace result on the action service: input_text.set_value:

Executed: September 4, 2023 at 3:08:20 PM
Result:
params:
  domain: input_text
  service: set_value
  service_data:
    value: >-
      WyJBVlBId0Vzd3BBaHZxNXd2eUFNM3ZXS2JSRXloYlRDbkl1MDlBbHVFOWpDQVp1SXVaeFhvYkNxeWthOFFjR1Jwei1lNUxpYkV5c21rb2NRYVJKRElNaDc2RHY1WHFnIiwgIkNpVUEydnV4cl95YktkWkJWLW5EZ0dqWWNTbzNTTHdGbWQzV25qY0QyQTktYzEyeU1UM29FcjRCQUNVRTBzS0tlV19XSm1KbHpadHM2TFJoZmhwQUlDaHJIc1VFLVFUMUlHWV80QVd6dFBBT3o4Vmp5TExVSXhCR0tVN0xudVhNam5McWNfUE9iT3F6RlpqNWVwcXZpdW04d3pqRUZlaFpqaVNpV01EOXQydDBTT05FdE9FQWRJNjI2VkFWMk5HSmpXTkVkN3BIMkxySmRPa2FFR1V6NjFPZzVTeVhGR1hBdUNDcy1od1AzXzB0eEZ0OEdpaVR6VGNIcEYwRmdWRjNmVmx1WGdIa1pSWWExNmxrTXpCaGZjVlU1djFjZHl3Uk9kSThtZEVSVkV1cXNXN3JLZ0VBSnciXQ==
    entity_id:
      - input_text.hello_doorbell_current_event_id
  target:
    entity_id:
      - input_text.hello_doorbell_current_event_id
running_script: false