Integrate Renfe API with Your Spanish Rail Assistant

Learn how to integrate Renfe API with your AI agent for Spanish train information.


Transport for Spain Integration Guide

This guide will walk you through integrating the Transport for Spain API with your OpenAssistantGPT chatbot.

Overview

Renfe's API provides comprehensive information about Spain's national railway system. The service offers train schedules, real-time updates, and service alerts. It features journey planning, station information, and booking capabilities across Spain's rail network.

Integration Steps

1. Review API Documentation

First, visit the Transport for Spain API documentation to understand the available endpoints and how they work.

2. Create Custom Action

In your OpenAssistantGPT dashboard:

  1. Go to the Actions Dashboard
  2. Click "Create New Action"
  3. Chose Get or Post
  4. Fill the action form with the following details:

Name: get_transport_for_spain_data

Description: Get data using Transport for Spain

URL: https://data.renfe.com/api/1/util/snippet/api_info.html?resource_id=a2368cff-1562-4dde-8466-9635ea3a572a&ref=public_apis&utm_medium=website

Parameters: This will depend on the API you are integrating. Parameters are query parameters passed in the URL.

3. Assign Action to Your Chatbot

  1. Go to your Chatbot Dashboard
  2. Select your chatbot
  3. Go to "Settings" > "Actions"
  4. Add the get_transport_for_spain_data action to your chatbot

Using the Integration

Your chatbot can now handle transportation-related queries. Here are some example questions you can ask:

  • Find AVE trains to Barcelona
  • Check train times from Madrid
  • Get platform at Atocha station

The chatbot will automatically use the Transport for Spain API to fetch and return the requested information.

Additional Resources