GuidesCode
Go Integration
How to use the personalize.marketing API with Go
Go Integration
Increase Timeout to 5 Minutes
The API analyzes influencer profiles in real-time, which can take up to 300 seconds per request. Set your HTTP client timeout to at least 300 seconds (5 minutes) to avoid premature timeouts.
Prerequisites
You need an API key. See Get Started for instructions.
Security Tip
Store your API key in environment variables to avoid accidentally committing it to git. Never hardcode API keys in your source code.
Example
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
"time"
)
// ============ CONFIGURE THESE ============
var (
apiKey = os.Getenv("PERSONALIZE_API_KEY")
profileURL = "https://linkedin.com/in/arnold-schwarzenegger/"
template = `Hey {{first name}},
Love what you are building with {{their company or product}}. We make fitness supplements that would pair perfectly with your brand.
Worth a quick chat?`
brandContext = "We are a fitness supplement brand targeting health-conscious entrepreneurs"
aiInstructions = "Keep the tone professional but friendly"
)
// =========================================
type Request struct {
ProfileURL string `json:"profile_url"`
Template string `json:"template"`
BrandContext string `json:"brand_context"`
AIInstructions string `json:"ai_instructions"`
EnableBrandFitScore bool `json:"enable_brand_fit_score"`
IncludeProfileReport bool `json:"include_profile_report"`
IncludeRawData bool `json:"include_raw_data"`
}
func main() {
client := &http.Client{Timeout: 5 * time.Minute}
reqBody := Request{
ProfileURL: profileURL,
Template: template,
BrandContext: brandContext,
AIInstructions: aiInstructions,
EnableBrandFitScore: false,
IncludeProfileReport: false,
IncludeRawData: false,
}
jsonBody, _ := json.Marshal(reqBody)
req, _ := http.NewRequest("POST", "https://personalize.marketing/api/v1/personalize-api", bytes.NewBuffer(jsonBody))
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
fmt.Printf("Request failed: %v\n", err)
return
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
output, _ := json.MarshalIndent(result, "", " ")
fmt.Println(string(output))
}Response:
{
"success": true,
"personalized_text": "Hey Arnold,\n\nLove what you are building with The Pump app. We make fitness supplements that would pair perfectly with your brand.\n\nWorth a quick chat?",
"profile_url": "https://linkedin.com/in/arnold-schwarzenegger/",
"brand_fit_score": 9,
"profile_report": "Arnold Schwarzenegger is an entrepreneur, actor, and fitness icon with 500K+ LinkedIn followers. He actively promotes his businesses including The Pump app and his daily newsletter. His content focuses on fitness, motivation, and health advice. High engagement rates with a professional, health-conscious audience.",
"raw_data": {
"profile": {
"firstName": "Arnold",
"lastName": "Schwarzenegger",
"headline": "Businessman | Founder of The Pump",
"followerCount": 500000
},
"posts": ["..."]
}
}Request Fields
| Field | Required | Description |
|---|---|---|
profile_url | Yes | LinkedIn, Instagram, or TikTok profile URL |
template | Yes | Your message with {{instruction}} placeholders (e.g., {{first name}}) |
ai_instructions | No | Custom tone/style instructions for the AI |
brand_context | No | Your brand description for better post matching |
enable_variations | No | Rephrase output to avoid spam detection |
enable_brand_fit_score | No | Get 1-10 brand fit score |
include_profile_report | No | Get detailed influencer analysis |
include_raw_data | No | Get raw profile data (unstable, for debugging only) |
See API Reference for complete documentation.