Strona zostanie usunięta „CreateSMSCampaign”. Bądź ostrożny.
/*
EVERY CAMPAIGN TIMES MUST BE CLEARY DEFINED BY THE USERS
We can help them, by seeting default values in the GUI.
But no defaults will be assumed.
Our previous defaults, 0800-1800 are still recommended, but many campaigns
should be sent only at afternoons, while others only in the morning.
*/
create or replace function api."CreateSMSCampaign"
(
_formset formset
, _address_list uuid
, _time_start time
, _time_end time
, _send_at timestamptz
, _sender text
, _is_public bool default false
, _skip_duplicates bool default true
, _name text default null -- defaults to concat(_formset, current_date, '-', current_time);
)
This function create a new SMS campaign in a database by doing the following:
It checks if the provided formset and address_list exist in the database and raises an error if they do not.
If the name parameter is not provided, it generates a default name for the campaign by concatenating the formset name, the current date, and the current time.
It creates a new campaign in the forms.campaigns table with the provided send_at, time_start, time_end, and name values.
It adds an entry to the forms.campaign_address_lists table to associate the new campaign with the provided address_list.
It loops through each mobile number in the provided address_list and creates a new form for each one using the api."CreateFormFromFormset" function, passing in the formset, send_at, time_start, time_end, campaign, and sender values.
The function returns true upon success.
Strona zostanie usunięta „CreateSMSCampaign”. Bądź ostrożny.