Skip to content

update automation workflows to work on v2 with new api #243

Description

@aleksa-krolls

Background, context, and business value

Search the ConSoSci v1 jobs for "auto" to view the workflow. See docs for background on how the solution works. Step A4 is a job that creates another job automatically via the openfn api.

The specific request, in as few words as possible

  1. Reconfigure/migrate the existing v1 automation workflow to run on app.openfn.org v2 - in this v2 test project
  2. Update job "A4" (see L422) for the part of the job that needs to be updated to use the new v2 openfn api

Input

Use this as an input to job A2, which will trigger job A4: 02b-syncToOpenFn.js (which needs to be edited)

{
  "formId": "aJTDVjyPKssq7ukpvJdRKG",
  "formUpdate": true,
  "lastModified": "2024-11-27T14:02:10.908997Z",
  "prefix1": "TT",
  "prefix2": "",
  "tableId": "SurvivalMonitoring",
  "tag": "Survival Monitoring Bismarck (Full inventory)",
  "url": "https://kf.kobotoolbox.org/api/v2/assets/aJTDVjyPKssq7ukpvJdRKG/?format=json"
}

Credentials

  1. Job A2 - use the below raw json cred and see LP Trillion Trees Kobo
{"openfnInboxUrl":"{v1-inbox-url}","password":"{kobo-pwd}","type":"basic","username":"{kobo-UN}"}
  1. Job A4 - you will need to authorize with the openfn api... not sure what v2 requires (probably an api token), so discuss with TD if not clear.

Don't worry about running Job A3 for now - you can disable this step and focus on Jobs A2 and A4.

adaptor

openfn v2
see slack where i'm trying to find the latest docs

jobs

Job to be updated (labeled step A4 - see consosci project): 02b-syncToOpenFn.js

Testing notes

You should have a workflow in V2 that has at least 2 steps - A2 and A4. (Don't worry about running Job A3 for now - you can disable this step and focus on Jobs A2 and A4. )

  1. Run the above Input payload for job A2...this should trigger job A4.
  2. A4 should use the output of A2 to generate a job expression, and then create a new workflow in the same project.
  3. If you re-try the workflow using the same input, then it should upsert the existing workflow created after the first test.

image.png

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Priority Level 2 - Medium

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions