Integration Patterns with a Twist

When planning or proposing any time-bound activity (phone call, email send time, meeting, follow-up task), first call the action
“Agentforce_Get_Time_Zone” with the Account’s Id. Always run Agentforce_Get_Time_Zone before suggesting or scheduling times. Honor business hours of 08:00 AM–6:00 PM in the account’s local time. Format all proposed times in the customer’s local time and include the time zone label, e.g., “10:30 AM America/Chicago”

These will be used to add our external services!

OpenAPI Spec for time zone exercise:

For Named Credential: https://api.ipgeolocation.io

{
  "openapi": "3.0.3",
  "info": {
    "title": "IPGeolocation Time Zone API (Location \u2192 Time Zone)",
    "version": "2.0.0",
    "description": "Matches official response structure: top-level 'location' and 'time_zone' objects."
  },
  "servers": [{
    "url": "https://api.ipgeolocation.io"
  }],
  "paths": {
    "/v2/timezone": {
      "get": {
        "summary": "Get time zone info from address/city",
        "operationId": "getTimezoneByLocation",
        "parameters": [{
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Your ipgeolocation.io API key"
          },
          {
            "name": "location",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "City/address, e.g., 'Phoenix, AZ' or 'London, UK'"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "type": "object",
                      "properties": {
                        "location_string": {
                          "type": "string"
                        },
                        "country_name": {
                          "type": "string"
                        },
                        "state_prov": {
                          "type": "string"
                        },
                        "city": {
                          "type": "string"
                        },
                        "locality": {
                          "type": "string"
                        },
                        "latitude": {
                          "type": "string"
                        },
                        "longitude": {
                          "type": "string"
                        }
                      }
                    },
                    "time_zone": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "offset_with_dst": {
                          "type": "number"
                        },
                        "date": {
                          "type": "string"
                        },
                        "date_time": {
                          "type": "string"
                        },
                        "date_time_txt": {
                          "type": "string"
                        },
                        "date_time_wti": {
                          "type": "string"
                        },
                        "date_time_ymd": {
                          "type": "string"
                        },
                        "date_time_unix": {
                          "type": "number"
                        },
                        "time_24": {
                          "type": "string"
                        },
                        "time_12": {
                          "type": "string"
                        },
                        "week": {
                          "type": "integer"
                        },
                        "month": {
                          "type": "integer"
                        },
                        "year": {
                          "type": "integer"
                        },
                        "year_abbr": {
                          "type": "string"
                        },
                        "is_dst": {
                          "type": "boolean"
                        },
                        "dst_savings": {
                          "type": "number"
                        },
                        "dst_exists": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

OpenAPI Spec for the weather exercise:

For Named Credential: https://api.weatherapi.com

{
  "openapi": "3.0.3",
  "info": {
    "title": "Weather API (Current + Forecast)",
    "version": "1.1.0",
    "description": "OpenAPI spec for WeatherAPI.com's current and forecast endpoints for Salesforce External Services."
  },
  "servers": [{
    "url": "https://api.weatherapi.com"
  }],
  "paths": {
    "/v1/current.json": {
      "get": {
        "summary": "Get current weather",
        "operationId": "getCurrentWeather",
        "parameters": [{
            "name": "key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "City or 'lat,lon'"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "region": {
                          "type": "string"
                        },
                        "country": {
                          "type": "string"
                        }
                      }
                    },
                    "current": {
                      "type": "object",
                      "properties": {
                        "temp_f": {
                          "type": "number"
                        },
                        "condition": {
                          "type": "object",
                          "properties": {
                            "text": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/forecast.json": {
      "get": {
        "summary": "Get forecast by date or days",
        "operationId": "getForecastWeather",
        "parameters": [{
            "name": "key",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "City or 'lat,lon'"
          },
          {
            "name": "dt",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Date YYYY-MM-DD"
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10
            },
            "description": "Number of days forecast"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "location": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        }
                      }
                    },
                    "forecast": {
                      "type": "object",
                      "properties": {
                        "forecastday": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "date": {
                                "type": "string"
                              },
                              "day": {
                                "type": "object",
                                "properties": {
                                  "maxtemp_f": {
                                    "type": "number"
                                  },
                                  "mintemp_f": {
                                    "type": "number"
                                  },
                                  "condition": {
                                    "type": "object",
                                    "properties": {
                                      "text": {
                                        "type": "string"
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}