Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Visual FoxPro) Yousign - Setup email notificationsDemonstrates how to setup email notifications based on events. An event is triggered when a user (or our API) make an action or when a status has changed. For more information, see https://dev.yousign.com/?version=latest#96b9f5ec-8e41-4d0f-82e5-6fa91adfa4fd
LOCAL loHttp LOCAL lnSuccess LOCAL loJson LOCAL loResp LOCAL loSbResponseBody LOCAL loJResp LOCAL lnRespStatusCode LOCAL lcSubject LOCAL lcMessage LOCAL j LOCAL lnCount_j LOCAL lcStrVal LOCAL lcUser LOCAL lcV_type LOCAL lcFirstname LOCAL lcLastname LOCAL lcEmail LOCAL lcPhone LOCAL lnPosition LOCAL lcComment LOCAL lcOperationLevel LOCAL lcOperationModeSmsConfig LOCAL lcFileId LOCAL lcFileName LOCAL lcFileType LOCAL lcFileContentType LOCAL lcFileDescription LOCAL lcFileCreatedAt LOCAL lcFileUpdatedAt LOCAL lcFileSha256 LOCAL lcFileWorkspace LOCAL lcFileCreator LOCAL lnFileProtected LOCAL lnFilePosition LOCAL lcFileParent LOCAL lnPage LOCAL lcPosition_str LOCAL lcFieldName LOCAL lcMention LOCAL lcMention2 LOCAL lcReason LOCAL k LOCAL lnCount_k LOCAL lcContentType LOCAL lcSha256 LOCAL lnV_protected LOCAL lcId LOCAL lcName LOCAL lcDescription LOCAL lcCreatedAt LOCAL lcUpdatedAt LOCAL lcFinishedAt LOCAL lcExpiresAt LOCAL lcStatus LOCAL lcCreator LOCAL lcCreatorFirstName LOCAL lcCreatorLastName LOCAL lcWorkspace LOCAL lnTemplate LOCAL lnOrdered LOCAL lcParent LOCAL lnRelatedFilesEnable LOCAL lnArchive LOCAL i LOCAL lnCount_i * This example assumes the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http') loHttp = CreateObject('Chilkat.Http') * Implements the following CURL command: * curl --location --request POST 'https://staging-api.yousign.com/procedures' \ * --header 'Authorization: Bearer YOUR_API_KEY' \ * --header 'Content-Type: application/json' \ * --data-raw '{ * "name": "My first procedure with emails", * "description": "Powerful! Here is the description of my first procedure with emails", * "members": [ * { * "firstname": "John", * "lastname": "Doe", * "email": "john.doe@yousign.fr", * "phone": "+33612345678", * "fileObjects": [ * { * "file": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", * "page": 2, * "position": "230,499,464,589", * "mention": "Read and approved", * "mention2": "Signed by John Doe" * } * ] * } * ], * "config": { * "email": { * "member.started": [ * { * "subject": "Hey! You are invited to sign!", * "message": "Hello <tag data-tag-type=\"string\" data-tag-name=\"recipient.firstname\"></tag> <tag data-tag-type=\"string\" data-tag-name=\"recipient.lastname\"></tag>, <br><br> You have ben invited to sign a document, please click on the following button to read it: <tag data-tag-type=\"button\" data-tag-name=\"url\" data-tag-title=\"Access to documents\">Access to documents</tag>", * "to": ["@member"] * } * ], * "procedure.started": [ * { * "subject": "John, created a procedure your API have.", * "message": "The content of this email is totally awesome.", * "to": ["@creator", "@members", "billing@yousign.fr"] * } * ] * } * } * }' * Use the following online tool to generate HTTP code from a CURL command * Convert a cURL Command to HTTP Source Code * Use this online tool to generate code from sample JSON: * Generate Code to Create JSON * The following JSON is sent in the request body. * { * "name": "My first procedure with emails", * "description": "Powerful! Here is the description of my first procedure with emails", * "members": [ * { * "firstname": "John", * "lastname": "Doe", * "email": "john.doe@yousign.fr", * "phone": "+33612345678", * "fileObjects": [ * { * "file": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", * "page": 2, * "position": "230,499,464,589", * "mention": "Read and approved", * "mention2": "Signed by John Doe" * } * ] * } * ], * "config": { * "email": { * "member.started": [ * { * "subject": "Hey! You are invited to sign!", * "message": "Hello <tag data-tag-type=", * " data-tag-name=": <tag, * "button": [ * "@member" * ] * } * ], * "procedure.started": [ * { * "subject": "John, created a procedure your API have.", * "message": "The content of this email is totally awesome.", * "to": [ * "@creator", * "@members", * "billing@yousign.fr" * ] * } * ] * } * } * } * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJson = CreateObject('Chilkat.JsonObject') loJson.UpdateString("name","My first procedure with emails") loJson.UpdateString("description","Powerful! Here is the description of my first procedure with emails") loJson.UpdateString("members[0].firstname","John") loJson.UpdateString("members[0].lastname","Doe") loJson.UpdateString("members[0].email","john.doe@yousign.fr") loJson.UpdateString("members[0].phone","+33612345678") * Use the actual file ID here... loJson.UpdateString("members[0].fileObjects[0].file","/files/23686fbe-3ae1-4de9-9e01-58bbf29b2b18") loJson.UpdateInt("members[0].fileObjects[0].page",2) loJson.UpdateString("members[0].fileObjects[0].position","230,499,464,589") loJson.UpdateString("members[0].fileObjects[0].mention","Read and approved") loJson.UpdateString("members[0].fileObjects[0].mention2","Signed by John Doe") loJson.UpdateString('config.email."member.started"[0].subject',"Hey! You are invited to sign!") loJson.UpdateString('config.email."member.started"[0].message','Hello <tag data-tag-type="string" data-tag-name="recipient.firstname"></tag> <tag data-tag-type="string" data-tag-name="recipient.lastname"></tag>, <br><br> You have ben invited to sign a document, please click on the following button to read it: <tag data-tag-type="button" data-tag-name="url" data-tag-title="Access to documents">Access to documents</tag>') loJson.UpdateString('config.email."member.started"[0].to[0]',"@member") loJson.UpdateString('config.email."procedure.started"[0].subject',"John, created a procedure your API have.") loJson.UpdateString('config.email."procedure.started"[0].message',"The content of this email is totally awesome.") loJson.UpdateString('config.email."procedure.started"[0].to[0]',"@creator") loJson.UpdateString('config.email."procedure.started"[0].to[1]',"@members") loJson.UpdateString('config.email."procedure.started"[0].to[2]',"billing@yousign.fr") * Adds the "Authorization: Bearer YOUR_API_KEY" header. loHttp.AuthToken = "YOUR_API_KEY" loHttp.SetRequestHeader("Content-Type","application/json") loResp = loHttp.PostJson3("https://staging-api.yousign.com/procedures","application/json",loJson) IF (loHttp.LastMethodSuccess = 0) THEN ? loHttp.LastErrorText RELEASE loHttp RELEASE loJson CANCEL ENDIF * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder') loSbResponseBody = CreateObject('Chilkat.StringBuilder') loResp.GetBodySb(loSbResponseBody) * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject') loJResp = CreateObject('Chilkat.JsonObject') loJResp.LoadSb(loSbResponseBody) loJResp.EmitCompact = 0 ? "Response Body:" ? loJResp.Emit() lnRespStatusCode = loResp.StatusCode ? "Response Status Code = " + STR(lnRespStatusCode) IF (lnRespStatusCode >= 400) THEN ? "Response Header:" ? loResp.Header ? "Failed." RELEASE loResp RELEASE loHttp RELEASE loJson RELEASE loSbResponseBody RELEASE loJResp CANCEL ENDIF RELEASE loResp * Sample JSON response: * (Sample code for parsing the JSON response is shown below) * { * "id": "/procedures/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", * "name": "My first procedure with emails", * "description": "Powerful! Here is the description of my first procedure with emails", * "createdAt": "2018-12-05T06:53:34+01:00", * "updatedAt": "2018-12-05T06:53:34+01:00", * "finishedAt": null, * "expiresAt": null, * "status": "active", * "creator": null, * "creatorFirstName": null, * "creatorLastName": null, * "workspace": "/workspaces/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", * "template": false, * "ordered": false, * "parent": null, * "metadata": [ * ], * "config": { * "email": { * "procedure.started": [ * { * "subject": "John, created a procedure your API have.", * "message": "The content of this email is totally awesome.", * "to": [ * "@creator", * "@members", * "billing@yousign.fr" * ] * } * ], * "member.started": [ * { * "subject": "Hey! You are invited to sign!", * "message": "Hello <tag data-tag-type=\"string\" data-tag-name=\"recipient.firstname\"></tag> <tag data-tag-type=\"string\" data-tag-name=\"recipient.lastname\"></tag>, <br><br> You have ben invited to sign a document, please click on the following button to read it: <tag data-tag-type=\"button\" data-tag-name=\"url\" data-tag-title=\"Access to documents\">Access to documents</tag>", * "to": [ * "@member" * ] * } * ] * } * }, * "members": [ * { * "id": "/members/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", * "user": null, * "type": "signer", * "firstname": "John", * "lastname": "Doe", * "email": "john.doe@yousign.fr", * "phone": "+33612345678", * "position": 1, * "createdAt": "2018-12-05T06:53:34+01:00", * "updatedAt": "2018-12-05T06:53:34+01:00", * "finishedAt": null, * "status": "pending", * "fileObjects": [ * { * "id": "/file_objects/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", * "file": { * "id": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", * "name": "The best name for my file.pdf", * "type": "signable", * "contentType": "application/pdf", * "description": null, * "createdAt": "2018-12-05T06:52:54+01:00", * "updatedAt": "2018-12-05T06:53:34+01:00", * "sha256": "bb57ae2b2ca6ad0133a699350d1a6f6c8cdfde3cf872cf526585d306e4675cc2", * "metadata": [ * ], * "workspace": "/workspaces/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", * "creator": null, * "protected": false, * "position": 0, * "parent": null * }, * "page": 2, * "position": "230,499,464,589", * "fieldName": null, * "mention": "Read and approved", * "mention2": "Signed by John Doe", * "createdAt": "2018-12-05T06:53:34+01:00", * "updatedAt": "2018-12-05T06:53:34+01:00", * "parent": null, * "reason": "Signed by Yousign" * } * ], * "comment": null, * "notificationsEmail": [ * ], * "operationLevel": "custom", * "operationCustomModes": [ * "sms" * ], * "operationModeSmsConfig": null, * "parent": null * } * ], * "subscribers": [ * ], * "files": [ * { * "id": "/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", * "name": "The best name for my file.pdf", * "type": "signable", * "contentType": "application/pdf", * "description": null, * "createdAt": "2018-12-05T06:52:54+01:00", * "updatedAt": "2018-12-05T06:53:34+01:00", * "sha256": "bb57ae2b2ca6ad0133a699350d1a6f6c8cdfde3cf872cf526585d306e4675cc2", * "metadata": [ * ], * "workspace": "/workspaces/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", * "creator": null, * "protected": false, * "position": 0, * "parent": null * } * ], * "relatedFilesEnable": false, * "archive": false, * "archiveMetadata": [ * ], * "fields": [ * ], * "permissions": [ * ] * } * Sample code for parsing the JSON response... * Use the following online tool to generate parsing code from sample JSON: * Generate Parsing Code from JSON lcId = loJResp.StringOf("id") lcName = loJResp.StringOf("name") lcDescription = loJResp.StringOf("description") lcCreatedAt = loJResp.StringOf("createdAt") lcUpdatedAt = loJResp.StringOf("updatedAt") lcFinishedAt = loJResp.StringOf("finishedAt") lcExpiresAt = loJResp.StringOf("expiresAt") lcStatus = loJResp.StringOf("status") lcCreator = loJResp.StringOf("creator") lcCreatorFirstName = loJResp.StringOf("creatorFirstName") lcCreatorLastName = loJResp.StringOf("creatorLastName") lcWorkspace = loJResp.StringOf("workspace") lnTemplate = loJResp.BoolOf("template") lnOrdered = loJResp.BoolOf("ordered") lcParent = loJResp.StringOf("parent") lnRelatedFilesEnable = loJResp.BoolOf("relatedFilesEnable") lnArchive = loJResp.BoolOf("archive") i = 0 lnCount_i = loJResp.SizeOfArray("metadata") DO WHILE i < lnCount_i loJResp.I = i i = i + 1 ENDDO i = 0 lnCount_i = loJResp.SizeOfArray('config.email."procedure.started"') DO WHILE i < lnCount_i loJResp.I = i lcSubject = loJResp.StringOf('config.email."procedure.started"[i].subject') lcMessage = loJResp.StringOf('config.email."procedure.started"[i].message') j = 0 lnCount_j = loJResp.SizeOfArray('config.email."procedure.started"[i].to') DO WHILE j < lnCount_j loJResp.J = j lcStrVal = loJResp.StringOf('config.email."procedure.started"[i].to[j]') j = j + 1 ENDDO i = i + 1 ENDDO i = 0 lnCount_i = loJResp.SizeOfArray('config.email."member.started"') DO WHILE i < lnCount_i loJResp.I = i lcSubject = loJResp.StringOf('config.email."member.started"[i].subject') lcMessage = loJResp.StringOf('config.email."member.started"[i].message') j = 0 lnCount_j = loJResp.SizeOfArray('config.email."member.started"[i].to') DO WHILE j < lnCount_j loJResp.J = j lcStrVal = loJResp.StringOf('config.email."member.started"[i].to[j]') j = j + 1 ENDDO i = i + 1 ENDDO i = 0 lnCount_i = loJResp.SizeOfArray("members") DO WHILE i < lnCount_i loJResp.I = i lcId = loJResp.StringOf("members[i].id") lcUser = loJResp.StringOf("members[i].user") lcV_type = loJResp.StringOf("members[i].type") lcFirstname = loJResp.StringOf("members[i].firstname") lcLastname = loJResp.StringOf("members[i].lastname") lcEmail = loJResp.StringOf("members[i].email") lcPhone = loJResp.StringOf("members[i].phone") lnPosition = loJResp.IntOf("members[i].position") lcCreatedAt = loJResp.StringOf("members[i].createdAt") lcUpdatedAt = loJResp.StringOf("members[i].updatedAt") lcFinishedAt = loJResp.StringOf("members[i].finishedAt") lcStatus = loJResp.StringOf("members[i].status") lcComment = loJResp.StringOf("members[i].comment") lcOperationLevel = loJResp.StringOf("members[i].operationLevel") lcOperationModeSmsConfig = loJResp.StringOf("members[i].operationModeSmsConfig") lcParent = loJResp.StringOf("members[i].parent") j = 0 lnCount_j = loJResp.SizeOfArray("members[i].fileObjects") DO WHILE j < lnCount_j loJResp.J = j lcId = loJResp.StringOf("members[i].fileObjects[j].id") lcFileId = loJResp.StringOf("members[i].fileObjects[j].file.id") lcFileName = loJResp.StringOf("members[i].fileObjects[j].file.name") lcFileType = loJResp.StringOf("members[i].fileObjects[j].file.type") lcFileContentType = loJResp.StringOf("members[i].fileObjects[j].file.contentType") lcFileDescription = loJResp.StringOf("members[i].fileObjects[j].file.description") lcFileCreatedAt = loJResp.StringOf("members[i].fileObjects[j].file.createdAt") lcFileUpdatedAt = loJResp.StringOf("members[i].fileObjects[j].file.updatedAt") lcFileSha256 = loJResp.StringOf("members[i].fileObjects[j].file.sha256") lcFileWorkspace = loJResp.StringOf("members[i].fileObjects[j].file.workspace") lcFileCreator = loJResp.StringOf("members[i].fileObjects[j].file.creator") lnFileProtected = loJResp.BoolOf("members[i].fileObjects[j].file.protected") lnFilePosition = loJResp.IntOf("members[i].fileObjects[j].file.position") lcFileParent = loJResp.StringOf("members[i].fileObjects[j].file.parent") lnPage = loJResp.IntOf("members[i].fileObjects[j].page") lcPosition_str = loJResp.StringOf("members[i].fileObjects[j].position") lcFieldName = loJResp.StringOf("members[i].fileObjects[j].fieldName") lcMention = loJResp.StringOf("members[i].fileObjects[j].mention") lcMention2 = loJResp.StringOf("members[i].fileObjects[j].mention2") lcCreatedAt = loJResp.StringOf("members[i].fileObjects[j].createdAt") lcUpdatedAt = loJResp.StringOf("members[i].fileObjects[j].updatedAt") lcParent = loJResp.StringOf("members[i].fileObjects[j].parent") lcReason = loJResp.StringOf("members[i].fileObjects[j].reason") k = 0 lnCount_k = loJResp.SizeOfArray("members[i].fileObjects[j].file.metadata") DO WHILE k < lnCount_k loJResp.K = k k = k + 1 ENDDO j = j + 1 ENDDO j = 0 lnCount_j = loJResp.SizeOfArray("members[i].notificationsEmail") DO WHILE j < lnCount_j loJResp.J = j j = j + 1 ENDDO j = 0 lnCount_j = loJResp.SizeOfArray("members[i].operationCustomModes") DO WHILE j < lnCount_j loJResp.J = j lcStrVal = loJResp.StringOf("members[i].operationCustomModes[j]") j = j + 1 ENDDO i = i + 1 ENDDO i = 0 lnCount_i = loJResp.SizeOfArray("subscribers") DO WHILE i < lnCount_i loJResp.I = i i = i + 1 ENDDO i = 0 lnCount_i = loJResp.SizeOfArray("files") DO WHILE i < lnCount_i loJResp.I = i lcId = loJResp.StringOf("files[i].id") lcName = loJResp.StringOf("files[i].name") lcV_type = loJResp.StringOf("files[i].type") lcContentType = loJResp.StringOf("files[i].contentType") lcDescription = loJResp.StringOf("files[i].description") lcCreatedAt = loJResp.StringOf("files[i].createdAt") lcUpdatedAt = loJResp.StringOf("files[i].updatedAt") lcSha256 = loJResp.StringOf("files[i].sha256") lcWorkspace = loJResp.StringOf("files[i].workspace") lcCreator = loJResp.StringOf("files[i].creator") lnV_protected = loJResp.BoolOf("files[i].protected") lnPosition = loJResp.IntOf("files[i].position") lcParent = loJResp.StringOf("files[i].parent") j = 0 lnCount_j = loJResp.SizeOfArray("files[i].metadata") DO WHILE j < lnCount_j loJResp.J = j j = j + 1 ENDDO i = i + 1 ENDDO i = 0 lnCount_i = loJResp.SizeOfArray("archiveMetadata") DO WHILE i < lnCount_i loJResp.I = i i = i + 1 ENDDO i = 0 lnCount_i = loJResp.SizeOfArray("fields") DO WHILE i < lnCount_i loJResp.I = i i = i + 1 ENDDO i = 0 lnCount_i = loJResp.SizeOfArray("permissions") DO WHILE i < lnCount_i loJResp.I = i i = i + 1 ENDDO RELEASE loHttp RELEASE loJson RELEASE loSbResponseBody RELEASE loJResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.