To better understand why we need External Initiators and what role they play, it's worth getting a better understanding of the Job Spec. The Job Spec conceptually consists of two parts:
Initiator - When the Job is to be executed
Task - How and in which order the Job is to be executed
Under the hood, Chainlink Node has a built-in set of Initiators and Tasks.
If the built-in tools are not suitable for your task, the External Initiators and External Adapters come to the rescue.
External Initiator
The External Initiator has a bi-directional action. This means that we can both send data to the client and receive data from the data sources.
For connected External Initiators, the Chainlink Node will notify them about the events of creating a new Job or deleting an existing Job whose whitelist contains a specific External Initiator.
Example of External Initiator 1.1. Querying an external database and starting a Job according to specific criteria
Example of External Initiator 1.2.0. Blockchain polling. Sending SMS messages to a client based on Blockchain events. Sending SMS messages to a client to create transactions on Blockchain
Example of External Initiator 1.2.1 operation
Creating External Initiator
The External Initiator is a service (e.g. written in go, nodejs, etc.) that must have a connection to the Postgres database (different from the database used by the Chainlink Node).
In order to communicate with the Job deployed on the Chainlink Node, the External Initiator must have cryptographic pairs:
These pairs are automatically generated on the Chainlink Node side when you add the External Initiator. You will also need to add certain env variables to the External Initiator service after that.