Skip to content

Commit

Permalink
Merge pull request #5350 from nyaruka/update_bcast_queue_payload
Browse files Browse the repository at this point in the history
Update payload for queueing a broadcast
  • Loading branch information
rowanseymour authored Jul 3, 2024
2 parents 7e390fe + be27617 commit abbc17d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion temba/mailroom/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ def queue_broadcast(broadcast):

task = {
"translations": broadcast.translations,
"template_state": "unevaluated",
"base_language": broadcast.base_language,
"expressions": True,
"optin_id": broadcast.optin_id,
"template_id": broadcast.template_id,
"template_variables": broadcast.template_variables or [],
"urns": broadcast.urns or [],
"contact_ids": list(broadcast.contacts.values_list("id", flat=True)),
"group_ids": list(broadcast.groups.values_list("id", flat=True)),
"broadcast_id": broadcast.id,
"org_id": broadcast.org_id,
"created_by_id": broadcast.created_by_id,
"template_state": "unevaluated", # deprecated
}

_queue_batch_task(broadcast.org_id, BatchTask.SEND_BROADCAST, task, HIGH_PRIORITY)
Expand Down
5 changes: 4 additions & 1 deletion temba/mailroom/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ def test_queue_broadcast(self):
"eng": {"text": "Welcome to mailroom!"},
"spa": {"text": "\u00a1Bienvenidx a mailroom!"},
},
"template_state": "unevaluated",
"base_language": "eng",
"expressions": True,
"optin_id": None,
"template_id": None,
"template_variables": [],
"urns": ["tel:+12065556666"],
"contact_ids": [jim.id],
"group_ids": [bobs.id],
"broadcast_id": bcast.id,
"org_id": self.org.id,
"created_by_id": self.admin.id,
"template_state": "unevaluated", # deprecated,
},
"queued_on": matchers.ISODate(),
},
Expand Down

0 comments on commit abbc17d

Please sign in to comment.