This builds on (and replaces) !17 (comment 51978)
It creates the activity as Cancelled, but then updates it to Completed after a successful send, so you know whether it was successfully sent.
It adds a
create_activity param to the API, defaults to
1 to keep backwards compatibility but can be set to
0 to suppress creating an activity.
And FTW, we now have some TESTS!!