Back to Templates

Lead Collection with SendPulse and GPT-Generated Welcome Emails/SMS

Created by

Created by: SendPulse || sendpulse

SendPulse

Last update

Last update 5 hours ago

Share


How it works

This n8n template automates lead processing from your website. It receives customer data via a Webhook, stores the customer's contact (email or phone number) in the respective SendPulse address books, and uses the SendPulse MCP Server to send personalized welcome messages (email or SMS) generated using AI.

The template also includes built-in SendPulse token management logic with caching in the Data Table, which reduces the number of unnecessary API requests.

SendPulse’s MCP server is a tool that helps you manage your account through a chat with an AI assistant. It uses SendPulse API methods to get information and perform actions, such as request statistics, run message campaigns, or update user data.

MCP server acts as middleware between your AI assistant and your SendPulse account. It processes requests through the SendPulse API and sends results back to chat, so you can manage everything without leaving the conversation.

Once connected, the MCP server operates as follows:

  1. You ask your AI assistant something in chat.
  2. It forwards your request to the MCP server.
  3. The MCP server calls the API to get data or perform an action.
  4. The AI assistant sends the result back to your chat.

Set up

Requirements:

  • An active SendPulse account.
  • Client ID and Client Secret from your SendPulse account.
  • An API key from your OpenAI account to power the AI agent.

Set up steps:

  1. Get your OpenAI API Key - https://platform.openai.com/api-keys
  2. Add your OpenAI API Key to OpenAI Chat Model node in n8n workflow.
  3. Get your Client ID and Client Secret from your SendPulse account - https://login.sendpulse.com/settings/#api
  4. Add your Client ID and Client Secret to Workflow Configuration node.
  5. Add your Client ID and Client Secret to SendPulse MCP Client node as headers X-SP-ID і X-SP-SECRET in Multiple Headers Auth.
  6. In the Workflow Configuration node, change the names of the mailing lists, senderName, senderEmail, smsSender, routeCountryCode and routeType fileds as needed.
  7. Create a tokens table with the columns: hash (string), accessToken (string), tokenExpiry (string) in the Data tables section of your n8n platform account.