Pack Building Roadmap - Maker Stories Webinar
Pack Details & Code

icon picker
TravelBriefData Code

//Starter code for all packs
import * as coda from "@codahq/packs-sdk";
export const pack = coda.newPack();

//Identify API domain name

//Create Schema and define property names for results
const TBSchema = coda.makeObjectSchema({
properties: {
name: {type: coda.ValueType.String},
continent: {type: coda.ValueType.String},
timezone: {type: coda.ValueType.String},
electricityVolts: {type: coda.ValueType.String},
electricityPlugs: {type: coda.ValueType.String},
languages: {type: coda.ValueType.String},
currency: {type: coda.ValueType.String},
telephoneCode: {type: coda.ValueType.String},
emergency: {type: coda.ValueType.String},
displayProperty: "name",

//Add a Formula
name: "TravelBriefData",
description: "Returns the travel brief details for a given country.",
parameters: [coda.makeParameter({
type: coda.ParameterType.String,
name: "Country",
description: "The country to fetch",

//Display object results as defined in the schema in the variable "data".
resultType: coda.ValueType.Object,
schema: TBSchema,

execute: async function ([Country], context) {
let url = "" + Country + "?format=json";
let response = await context.fetcher.fetch({ method: 'GET', url });
let data = {
continent: response.body.names.continent,
electricityVolts: response.body.electricity.voltage,
electricityPlugs: response.body.electricity.plugs,
languages: response.body.language,
currency: response.body.currency,
telephoneCode: response.body.telephone.calling_code,
emergency: response.body.telephone.police,
return data;
/* Postman Response to API GET Call
"names": {
"name": "Netherlands",
"full": "Kingdom of the Netherlands",
"iso2": "NL",
"iso3": "NLD",
"continent": "EU"
"maps": {
"lat": "52.2129919",
"long": "5.2793703",
"zoom": "7"
"timezone": {
"name": "Europe/Amsterdam"
"language": [
"language": "Dutch",
"official": "Yes"
"electricity": {
"voltage": "230",
"frequency": "50",
"plugs": [
"telephone": {
"calling_code": "31",
"police": "112",
"ambulance": "112",
"fire": "112"
"water": {
"short": "safe",
"full": ""
"vaccinations": [],
"currency": {
"name": "Euro",
"code": "EUR",
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
) instead.