How can a double opt-in email be triggered via the SuperOffice API to confirm the newsletter registration?
The background is that customers can register for the newsletter via an external form and subscribe to the newsletter there.
When a customer registers for the newsletter, a new person is created via the SuperOffice API.
How can I now also send a confirmation email to this person via the API to confirm their newsletter subscription?
What options are there for this?
Alle Svar (6)
Hello Tony
I guess this will work. The person will exist already.
Since we also make a query of the person vs. a database and want to archive the result already in superoffice (see request), the person is created immediately in SO when registering online (after checking the e-mail to see if it already exists).
At this stage set the person Consent Info will be already set being mandatory to sign on for the webinar
Best regards
Ralf
Hi Ralf,
Unfortunately there is no API to send a form submittion via the API. There was a wish for it, but that was not prioritized and closed.
You can use the PersonAgent.SendConsentConfirmationEmail to method. The person must already exists, and the person must already have the Consent Info already set. If not, you can use the PersonAgent.CreateDefaultConsentPerson API to create one, and then save it using the PersonAgent.SaveConsentPerson API.
Hope this helps!
Hello Tony
according to IT the descibe method results in the same error code as Document creation via the API
Is the PersonAgent.SendConsentConfirmationEmail to method the same as the attached picture?
too bad, so this function is not a solution either, as an error message also appears here
can you please take a look at the attached code to see if there is an error?
### Request 1 ###
### Set default values into a new ConsentPerson. ###
POST /SuperOffice/api/v1/Agents/Person/CreateDefaultConsentPerson HTTP/1.1
Content-Type: application/json
Accept: application/json
### Response 1 ###
{
"ConsentPersonId": 0,
"ConsentSource": {
"ConsentSourceId": 0,
"Name": "",
"Tooltip": "",
"Rank": 0,
"Key": "",
"MailTemplateId": 0,
"Deleted": false,
"TableRight": null,
"FieldProperties": {}
},
"LegalBase": {
"LegalBaseId": 0,
"Name": "",
"Tooltip": "",
"Rank": 0,
"Key": "",
"Deleted": false,
"TableRight": null,
"FieldProperties": {}
},
"PersonId": 0,
"ConsentPurpose": {
"ConsentPurposeId": 0,
"Name": "",
"ConsentText": "",
"FormText": "",
"Key": "",
"Tooltip": "",
"Active": 0,
"UpdatedDate": "0001-01-01T00:00:00",
"UpdatedBy": null,
"Deleted": false,
"Rank": 0,
"PrivacyStatementDesc": "",
"PrivacyStatementUrl": "",
"TableRight": null,
"FieldProperties": {}
},
"Comment": "",
"TableRight": null,
"FieldProperties": {}
}
### Request 2 ###
### Updates the existing ConsentPerson or creates a new ConsentPerson if the id parameter is empty ###
POST /SuperOffice/api/v1/Agents/Person/SaveConsentPerson HTTP/1.1
Content-Type: application/json
Accept: application/json
{
"ConsentPersonId": 0,
"ConsentSource": {
"ConsentSourceId": 5
},
"LegalBase": {
"LegalBaseId": 1
},
"PersonId": 30336,
"ConsentPurpose": {
"ConsentPurposeId": 2
},
"Comment": "",
"TableRight": null,
"FieldProperties": {}
}
### Response 2 ###
{
"ConsentPersonId": 33455,
"ConsentSource": {
"ConsentSourceId": 5,
"Name": null,
"Tooltip": null,
"Rank": 0,
"Key": null,
"MailTemplateId": 0,
"Deleted": false,
"TableRight": null,
"FieldProperties": {}
},
"LegalBase": {
"LegalBaseId": 1,
"Name": null,
"Tooltip": null,
"Rank": 0,
"Key": null,
"Deleted": false,
"TableRight": null,
"FieldProperties": {}
},
"PersonId": 30336,
"ConsentPurpose": {
"ConsentPurposeId": 2,
"Name": null,
"ConsentText": null,
"FormText": null,
"Key": null,
"Tooltip": null,
"Active": 0,
"UpdatedDate": "0001-01-01T00:00:00",
"UpdatedBy": null,
"Deleted": false,
"Rank": 0,
"PrivacyStatementDesc": null,
"PrivacyStatementUrl": null,
"TableRight": null,
"FieldProperties": {}
},
"Comment": "",
"TableRight": null,
"FieldProperties": {}
}
### Request 3 ###
### Send confirmation email to the provided person, email address (id), using the document template. ###
POST /SuperOffice/api/v1/Agents/Person/SendConsentConfirmationEmail HTTP/1.1
Content-Type: application/json
Accept: application/json
{
"PersonId": 30336,
"EmailTemplateId": 5,
"EmailAddress": maxmustermann@test.net
}
### Response 3 ###
{
"Error": true,
"ErrorType": "InvalidOperationException",
"Message": "Cannot create directory \\\\***\\SO_ARC\\WebConnect\\2025.1 because a file already exists with that name.",
"FriendlyMessage": "",
"ErrorSource": "SoDataBase",
"InnerError": {
"ErrorType": "SoException",
"Message": "Service call Person.SendConsentConfirmationEmail failed",
"ErrorSource": "SuperOffice.Services.Implementation",
"InnerError": {
"ErrorType": "Exception",
"Message": "Error occurred at creating the physical document E-mail.somail",
"ErrorSource": "SoDataBase",
"InnerError": {
"ErrorType": "InvalidOperationException",
"Message": "Cannot create directory \\\\***\\SO_ARC\\WebConnect\\2025.1 because a file already exists with that name.",
"ErrorSource": "SoDataBase",
"InnerError": null
}
}
}
}