Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
Send JavaScript Array to webhook

I am trying to get data from an API, push the fetched data to an array and then send (post) that array with the data in a webhook. I tried description: data,, but it doesn't work. Can someone help me or is it even possible with js?

const api = "http://ip-api.com/json/"

    var ipinfo = [

    ]

    async function getIP() {
        const response = await fetch (api)
        const data = await response.json();
        const { city, zip, country, countryCode, lat, lon, org, query, region, regionname, timezone } = data;

        ipinfo.push(data);
        console.log(ipinfo)
    }

    getIP();

    
    function sendMessage() {
        fetch(
            'WEBHOOK URL', {
                method: 'post',
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify ({
                    allowed_mentions: {
                        parse: ['users', 'roles'],
                },
                // embeds to be sent
                embeds: [{
                    title: 'New IP logged',
                    description: "ipinfo" + ipinfo,
                    },
                ],
                }),
            }
        );
    }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!