Export your Spell from Meta API
Export
You can export your Spell from Meta API using the Export button inside the detail page of your Spell.
When you export your Spell, you'll generate a zip file with the content of your Spell in production or the Spell currently in development.
The zip file will contain:
code.js
: the code written inside the Spell's editor or the code generated from Lumo editorpackages.json
: NPM packages used inside your Spell. You'll find inside theaxios
andobject-sizeof
lib by defaultconnectors.js
: Axios' code snippets of API calls used inside your Spell. Connectors are identified using their IDs
How to use exported files
The generated code is usable inside a NodeJS server for example.
You'll have to replace each connectorService.config(xxx)
implementations with the right code inside your connectors.js
file. You'll have to re-map all the variables inside the URL and update body and parameters according to your code.
All parts have been exported in order to work directly with your configured variables.
APIs using OAuth authentication (like Google services, Hubspot, Spotify...) will no longer work. All the OAuth dance and refresh mechanisms were handled by Meta API servers and will no longer work.
See below for more information
Meta API Spell was designed to work on a serverless environment. All code were encapsulated inside custom function to work on AWS Lambda.
Parts to re-implement
OAuth
You should replace all connectorService
parts with official SDK (Example with Google Spreadsheet lib) where OAuth is handle natively or use third-party lib like simple-oauth2.
⚠️ OAuth can be complex to implement if you are not using an official SDK.
You can also use the Nango project to create a full OAuth management system and API. This way, you can run your Spell in a serverless environment and use this platform as a secret and credential center.
Meta Storage
Meta Storage, the integrated database, will also no longer work.
You can replace it with a simple key-value library like keyv (with, for example, a persistent storage using SQLite
) or a cloud-based database like AWS Aurora.
Typescript types
If you plan to use your exported Spells as JS file, you can safely remove all types (like :Datapostgetmonitors
) from the code.