Update published message to json

Update message published to a json

Change-Id: Ieef4145f7252404f1728a5f9f9da3a69aad840d0
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/45982
Reviewed-by: Jesse Seales <jseales@google.com>
Reviewed-by: Ricardo Amador <ricardoamador@google.com>
Commit-Queue: Drew Roen <drewroen@google.com>
(cherry picked from commit c6af020f0f22e392e30b769a5ed97fadace308fa)
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/46080
Reviewed-by: Godofredo Contreras <godofredoc@google.com>
diff --git a/recipes/engine_v2/engine_v2.expected/basic_mac_dart_internal.json b/recipes/engine_v2/engine_v2.expected/basic_mac_dart_internal.json
index 4115c93..17841ca 100644
--- a/recipes/engine_v2/engine_v2.expected/basic_mac_dart_internal.json
+++ b/recipes/engine_v2/engine_v2.expected/basic_mac_dart_internal.json
@@ -1507,7 +1507,7 @@
       "topics",
       "publish",
       "projects/flutter-dashboard/topics/dart-internal-build-results",
-      "--message='8945511751514863184'"
+      "--message='{\"buildbucket_id\": 8945511751514863184}'"
     ],
     "infra_step": true,
     "luci_context": {
diff --git a/recipes/engine_v2/engine_v2.py b/recipes/engine_v2/engine_v2.py
index 1a4a327..d00aa02 100644
--- a/recipes/engine_v2/engine_v2.py
+++ b/recipes/engine_v2/engine_v2.py
@@ -24,6 +24,8 @@
 
 from RECIPE_MODULES.flutter.flutter_bcid.api import BcidStage
 
+import json
+
 DEPS = [
     'depot_tools/depot_tools',
     'flutter/archives',
@@ -182,7 +184,7 @@
   if not_experimental and dart_internal_build:
     api.pubsub.publish_message(
         BUILD_RESULT_PUBSUB_ENDPOINT,
-        api.buildbucket.build.id,
+        json.dumps({"buildbucket_id": api.buildbucket.build.id}),
         step_name='Publish build results'
     )