1. Home
  2. Docs
  3. Chainlink Node Setup
  4. External Initiators
  5. Building External Initiators

Building External Initiators

Building External Initiators

Originally published @ https://docs.chain.link/docs/building-external-initiators

We will be using the Chainlink external initiator repo for reference. You can see some examples of existing initiators in the blockchain folder, and a walkthrough of setting one up (not writing the code) here.

External initiators are simple web initiators that can be activated by any job instead of just one. To set one up, you need to have a service similar to an external adapter that sends an
HTTPPost
message runs API call to your chainlink node service. Here is a sample URL for a web job could look like:

curl -b cookiefile -X POST -H "Content-Type: application/json" --data '{"myKey":"myVal"}' http://localhost:6688/v2/specs/%s/runs

Where %s is the jobId.

External initiators make the same API call, with 2 added headers:

“X-Chainlink-EA-AccessKey”
“X-Chainlink-EA-Secret”

These are keys generated when you register your external initiator with your node.

Triggering a run through an external initiator is as simple as making this API call to your node. All jobs with this EI configured will then be kicked off in this way. A simple external initiator in psedo code could look like this:

while(True): send_api_call_with_external_initiator_access_key_headers() sleep(4)

Have this job run on the same machine as your node.

Was this article helpful to you? Yes No

How can we help?