phpjsonlimesurvey

Mail a specific participant with mail_registered_participants


I try to use the LimeSurvey API to send mail invitations. I would like to be abe to send an invitation to specific token id throught the API.

According to the API documentation, it is possible using the overrideAllConditions parameter :

> /**
>      * Send register mails to participants in a survey
>      *
>      * Returns array of results of sending
>      *
>      * Default behaviour is to send register emails to not invited, not reminded, not completed and in valid frame date participant.
>      * 
>      * $overrideAllConditions replaces this default conditions for selecting the participants. A typical use case is to select only one
> participant
>      * ````
>      * $overrideAllConditions = Array();
>      * $overrideAllConditions[] = 'tid = 2';
>      * $response = $myJSONRPCClient->mail_registered_participants( $sessionKey, $survey_id, $overrideAllConditions );
>      * ````
>      * 
>      * @access public
>      * @param string $sSessionKey Auth credentials
>      * @param int $iSurveyID ID of the Survey that participants belong
>      * @param array $overrideAllConditions replace the default conditions
>      * @return array Result of the action
>      */

Here is the JSON body of my api call to send a mail to the participant associated with the tid 2 :

{"method":"mail_registered_participants","id":" ","params":{"1":"sessionkey","iSurveyID":123456,"overrideAllConditions":{"tid":2}}}

But this call sends the mail invitation to the first 100 participants (and so on with several calls).

Is it possible to send one individual mail throught this API function (like within the user interface) ?


Solution

  • overrideAllConditions use Yii addCondition

    Did you try

    {
        "method": "mail_registered_participants",
        "id": " ",
        "params": {
            "1": "sessionkey",
            "iSurveyID": 123456,
            "overrideAllConditions": {
                "0": "tid = 2"
            }
        }
    }