How to move a pipeline from SnapGPT Labs to Elastic
Overview With SnapGPT being used by more and more people to generate pipeline drafts or scaffolds, we want to make sure everyone knows that SnapGPT-generated pipelines can be migrated out of SnapLabs into a your own SnapLogic environments. Below are the steps to perform the migration manually and we will add additional methods as quickly as we can. Manual migration Manual migration of a pipeline means using our Export a Pipeline and then Import a Pipeline steps. Below are example steps to move a pipeline from SnapLabs pod (https://snapgpt.labs.snaplogic.com/) to the Elastic pod (https://elastic.snaplogic.com). Requirements To complete these steps you must have the following: Access to SnapLabs and be signed in A pipeline in SnapLabs you wish to export (SnaptGPT-generated pipelines included!) One or more environments in Elastic pod to import the pipeline Steps: In the upper-right corner of the SnapLabs Designer page, click what looks like the rewind button to expand ‘More tools’: After the toolbar expands click the highlighted icon below that looks like an arrow coming up out of a drawer or box: Choose ‘Export’ in the drop-down menu: Your browser should show you that the file downloaded with a name like ‘PIPELINE_NAME_YYYY_MM_DD.SLP’. Here is an example of my pipeline exported in Google Chrome: If you have not yet signed into your Elastic pod account, please do so now. In the upper-left corner, click the toolbar icon shown below (it looks like an arrow going into a box or drawer): Your OS file browser will open for you to select a *.slp file, similar to what you see in the screenshot below. Choose your pipeline, then press ‘Open’: At this point the “Add a New Pipeline” window will appear, similar to the one below. Here you can change the name of the pipeline if desired and select where the pipeline will be imported. Your final steps will be to walk through the ‘Pipeline Configuration Wizard,’ shown on the right-hand side in the screenshot below. These steps are where you can select or add all the relevant accounts, choose filenames if needed, etc.3.1KViews1like2CommentsTutorial: Using the DocuSign eSignature REST API with the REST Snap Pack and JWT Authentication
I previously wrote about integrating with the DocuSign eSignature API with the REST Snap Pack and OAuth 2.0 authentication, but for those that wish to control their access a bit more, DocuSign supports authenticating with JSON Web Tokens (JWTs) too. I followed the instructions from the “How to get an access token with JWT Grant authentication” DocuSign Developer portal. Setup As before, DocuSign makes it very easy to get started with their free Developer Account signup. Again, in the sidebar under “INTEGRATIONS”, select “Apps and Keys”. One that page is up, choose the “Add App & Integration Key” button and provide an application name (I chose “SnapLogic Community JWT Demo” this time). The “Integration Key” that is generated is also known as the Client ID and JWT will also refer to it as the "iss" value. You can keep the User Application selected as Authorization Code Grant but instead of adding a Secret Key, this time we’re going to be choosing a Service Integration: I wanted DocuSign to generate the public/private key pair for me, so I selected the “Generate RSA” button. A new dialog will open this the generated keys - you must copy these values and store them somewhere as this will be your only chance to do so: Finally, I set a throwaway Redirect URI, http://localhost (this isn’t really used - the goal here is to first authorized the app you created but JWT will take over from that point). Click “Save” to create the Integration App. Grant Consent The first thing you want to do is to get consent from a DocuSign user (it could be you) for this App to impersonate them (that’s what a Service account does). It follows this URI syntax: https://account-d.docusign.com/oauth/auth? response_type=code &scope=YOUR_REQUESTED_SCOPES &client_id=YOUR_INTEGRATION_KEY &state=YOUR_CUSTOM_STATE &redirect_uri=YOUR_REDIRECT_URI so I opened the following URL in my browser (substitute your client ID/integration key, state, scopes and redirect URI that you wish to use): https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature%20impersonation&client_id=edec7e1e-e642-451b-8dfd-e7a211b23b40&state=throwaway&redirect_uri=http://localhost You’ll be asked to consent to the application: and then redirected to that throwaway localhost redirect URI (you don’t need to save anything from this response). Generating the JWT Now that consent has been granted, it’s time to move to JWT. This is where the JWT Snap Pack comes into play. It’s outside the scope of this topic to fully describe JWT, but in short it is a token value that encodes header and payload/body data that is signed with keys. The DocuSign Developer docs take you through how its constructed. The JWT Generate Snap will take care of generated the correct header ( "kid" is the Key Alias ID - more on that later, "alg" has to be "RS256" , and "typ":"JWT" is implied by the JWT spec). The main action is to generate the JWT Payload/Body that matches what DocuSign wants: { "iss": "5c2b8d7e-xxxx-xxxx-xxxx-cda8a50dd73f", "sub": "464f7988-xxxx-xxxx-xxxx-781ee556ab7a", "aud": "account-d.docusign.com", "iat": 1598383123, "exp": 1598390123, "scope": "signature impersonation" } and there are few ways to do that. You could build the above JSON object manually than use it directly in the “Custom Metadata” section, but I’ll show how to leverage the various fields in the JWT Generate Snap and the JWT Account. "aud" and "sub" stand for Audience and Subject respectively and can be set directly on the JWT Generate Snap: "sub" is the most difficult value to get - in fact, you have to look it up by using the API to call the /userinfo endpoint and that means using the OAuth 2.0 flow. Luckily, my first post described exactly how to do this - follow the setup instructions and see the “GET User Info” section. Note: "aud" must be list of strings (hence the array). It will be disregarded silently if it is not and your auth will fail. We will investigate a usability enhancement here. The "iat" value will be generated automatically (it defaults to “now” in Unix Epoch timestamp format). "iss" is the issuer, and this will be the Client ID/Integration Key created when you registered your App in the DocuSign Developer portal. You configure the "iss" and "exp" values by creating a JWT Account and leveraging the “JWT Issuer” and “Token TTL” fields respectively (the latter is added to the generated "iat" value). That leaves the "scopes" (which will always include impersonation and most DocuSign APIs want the signature scope too, so I’ve include them both, space-separated), and that can be directly configured on the “Custom Metadata” field in the JWT Generate Snap. All this configuration between the Snap and Account settings will be combined to form the Payload (you may also see a "nbf" payload field automatically added, which is “not before” and defaults to 120 seconds before "iat" and “Token ID” becomes "jti" ; DocuSign will ignore these): Finally, we need to configure the JWT Generate Snap’s Account for signing. This is where the public/private keypair saved earlier will be used. We’ll want to create a protected keystore for use by the account. There are a variety of ways to do this, but I’ll demonstrate with openssl . The first step is to combine the public and private keys together into one PEM file: Then we’ll use openssl to create a X.509 certificate: And then we’ll combine the certificate and the private key in the PEM file to create a PKCS 12 (.p12) file format: Upload the .p12 file to the Account’s “Key Store” field, also providing the password you used to protect it. You can use the suggest bubble on the “Key Alias” field to refer to your entry by name (this will be the "kid" value in the JWT Header). Decoding the Generated JWT The output of the JWT Generate Snap will be the JWT token under the "access_token" field (don’t confuse this with a DocuSign API access token, that comes later): You can copy this value and use jwt.io to see the decoded values: Exchanging the JWT for a DocuSign API Access Token Alright, it’s finally time to actually get an access token from DocuSign and start using their API! We are going to use the REST POST Snap to send a form-encoded request to the DocuSign token endpoint: The changes are minimal - the HTTP Entity is "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion="+$access_token (using the JWT you just created) and you need to set the appropriate Content-Type HTTP Header value of application/x-www-form-urlencoded . The Service URL is https://account-d.docusign.com/oauth/token and note that this needs to match the Audience value you used earlier (it is also the Demo environment value - Production is different; see DocuSign’s docs linked above). If everything has been configured correctly, you’ll get an API access token: And like in the first post, you can use this token with the REST Snap Pack (e.g. GET), albeit this time setting it directly via the Authorization HTTP Header: and it should return data successfully: In the end, this pipeline looked simply like this: Cheers!8KViews2likes1CommentTutorial: Using the DocuSign eSignature REST API with the REST Snap Pack and OAuth 2.0
DocuSign’s latest REST API version is 2.1 and also supports OAuth 2.0 authentication (replacing the legacy X-DocuSign-Authentication header-based auth). DocuSign also provides free (no credit card neccessary) developer accounts to try out their API. First, sign up for a DocuSign developer account here: DocuSign Developer Account Next, in the DocuSign Apps and Keys page inside the DocuSign Settings application, you’ll see your account information, including API Username, API Account ID, and Account’s Base URI. Click on the blue “Add App & Integration Key” button: Provide an appropriate application name and click “Add”: On the next page, your Integration Key (also known as a “Client ID”) will be displayed. Under the “Authentication” section, ensure the “Authorization Code Grant” radio button is enabled for a “User Application”. Then click on “Add Secret Key”: IMPORTANT! Copy this secret key value immediately and paste it somewhere just for now - it will no longer be available to be used once you navigate away from this page. Further down, under “Additional settings”, click the “Add URI” button and paste in the following value: https://elastic.snaplogic.com/api/1/rest/admin/oauth2callback/rest Finally, click the “Save” button and you’ll return to the “Apps and Keys” section of the Developer admin console, where your application will now be visible. Next, log into SnapLogic’s Designer web application, create a new pipeline and drag a REST GET Snap to the empty canvas. Switch to the “Account” tab and click the “Add Account” button: Now it’s time to use the values from the DocuSign developer/integration web console - in another tab, click on the application you created within DocuSign and enter the following information: Since we are using the DocuSign Demo Environment, we’ll be using the demo-specific account-d.docusign.com domain - the -d suffix is reserved for demo use. Click the “Authorize” button towards the bottom to initiate the process to get an OAuth 2.0 access token. Your web browser will send a request to the OAuth2 Endpoint URL (the Auth endpoint) - you may be asked to login and possibly to approve the application. After doing so, the request will redirect back to the SnapLogic platform (the redirect_uri where a new token request to the “OAuth2 Token” URL (the token endpoint) will automatically take place in the background and an access- and refresh tokens will be acquired. If all goes well, the browser will navigate back to the SnapLogic Designer and your account will now have encrypted entries for the “Access-” and “Refresh token” fields, plus a timestamp value for the “Access token expiration” settings field. Click “Apply” to save the account and we can now test that the access token we received is valid by making requests to the DocuSign eSignature REST API: GET User Info The first request will be to the User Info endpoint - https://account-d.docusign.com/oauth/userinfo This endpoint will return environment data such as accountId , userId , and baseUrl - these are required to make any eSignature API call: For Each Account Since the response’s entity.accounts is an array, we can use the JSON splitter to operate on the account data that we will leverage in subsequent API calls: GET Account Info Finally, we can now make a call to the DocuSign eSignature REST API. After the Splitter add another REST GET Snap, configure it with the same account used previously, and leverage the ability to refer to the input data ( $base_uri , $account_id ) to build the request URL to the demo.docusign.net API domain: Validating and/or executing this Snap should result in a 200 OK response with a response body containing the metadata of the desired account, which can be further isolated with a Mapper mapping the $entity field to $ : And that should get your started. Consult the DocuSign REST API reference documentation to learn about other endpoints that can be used.7.1KViews5likes3Comments