subscribe(list_ids, fields, tags, request_ip, request_time, double_optin, confirm_ip, confirm_time, overwrite)
This methods adds contacts (e-mail address, mobile phone number) of new subscriber to one or more lists and adds/changes additional fields associated with the subscriber.
By default, we send an invite to the new subscriber to confirm e-mail address, but if your have your own e-mail address verification procedure, you may turn off sending the invite by setting "doule_optin" to 1.
Number of e-mail addresses that you may add within confirmation (per day):
- up to 20, if no IP address is specified,
- up to 30, if IP address and date/time is specified,
- up to 50, if IP address and date/time of request and confirmation is specified,
Sample
http://api.unisender.com/en/api/subscribe?format=json&api_key=KEY&list_ids=134,135&fields[email]=test@example.orgReturn value
Object with the only field "person_id". Field type is a positive decimal 31-bit value with the unique subscriber code.
Parameters
- list_ids*
- Comma separated set of maillist codes, where you want to add the new subscriber. Codes can be found out using the method getLists. The codes are identical to the codes used in the subscription form.
- fields*
- Associated array of additional fields.
You should encode the array in a string formatted as
fields[NAME1]=VAL1&fields[NAME2]=VAL2
Having at least "email" or "phone" field is neccessary, otherwise the method will return an error. If both e-mail and phone number are provided, the subscriber will be added in both e-mail and SMS lists. - tags
- Comma separated set of tags that will be associated with the new subscriber.
- request_ip
- IP-address of subscriber where from you received a subscription request. IP address format should be formatted like "NNN.NNN.NNN.NNN". "request_ip" may be omitted if subscription is received offline (for example, paper survey). If you do not provide IP addresses, we apply more strict limits for adding e-mail addresses without confirmation (see above). IP-addresses from internal networks (such as 192.168.0.1) are not accepted.
- request_time
- Date and time when you received a subscription request. Should be formatted like "YYYY-MM-DD" or "YYYY-MM-DD hh:mm:ss". Time zone is UTC. If "request_time" is not provded, UniSender uses the date/time of the method call.
- double_optin
- Boolean field (should be set to 0 or 1, default value is 0). This value means if subscriber is already confirmed the subscription or not. If the field is set to 0, UniSender considers that the subscriber only made the initial request to join to your mailing list, but still not confirmed the e-mail address. In this case we send a confirmation e-mail to the user. If the field is set to 1, UniSender considers that you already received a confirmation from your subscriber. We do not send the invite to such user. If you make too many such requests (more then limit for your account), you get the error code "too_many_double_optins".
- confirm_ip
- IP-address of subscriber, where from your received a subscription confirmation. Should be formatted like "NNN.NNN.NNN.NNN". It's applicable if "double_optin" is set to 1 and ignored if "double_optin" is set to 0. This paramater may be omitted if e-mail confirmation is received from the paper survey, but more strict limits are applied for your account (see above).
- confirm_time
- Data and time of subscription confirmation. Should be formatted like "YYYY-MM-DD" or "YYYY-MM-DD hh:mm:ss". Timezone should be UTC. "Confirm_time" is applicable if "double_optin" is set to 1 and ignored if "double_optin" is set to 0. If "confirm_time" is provided, we treat this value as a day of subscription for automatic e-mail series. If not provided, data/time of the method call is used.
- overwrite
- Boolean field (should be 0 or 1, default value is 0). Shows if is it neccessary to delete old values of fields and tags in a case if the subscriber already exists (subscriber is identified by e-mail address of a phone number). If 0 is provided, methods adds news fields and tags, existing tags keeps original valued. If 1 is provided, method deletes all existing fields and tags.
* denotes mandatory fields.



