APIs & Integrations

VigneshIyappan
Participant

Custom Headers in CRM Cards

SOLVE

Is it possible to add custom headers with a static value in the CRM cards? I need to pass 'APP_NAME = HUBSPOT' as a header in the data fetch URL. Can you anyone suggest any workaround for this.

0 Upvotes
1 Accepted solution
Danielle_J
Solution
Participant | Diamond Partner
Participant | Diamond Partner

Custom Headers in CRM Cards

SOLVE

A workaround would need to be implemented. I would suggest reviewing HubSpot's serverless functions functionality - https://developers.hubspot.com/docs/cms/data/serverless-functions.
If you do not have the required Hub that supports this, alternatives include using a middleware/setting up a proxy server.
You could write something like :

exports.main = async (context, sendResponse) => {
    const fetch = require('node-fetch');

    const url = 'https://actual-server.com/data';  // The actual server URL

    const response = await fetch(url, {
        headers: {
            'APP_NAME': 'HUBSPOT'
        }
    });

    const data = await response.json();

    sendResponse({
        statusCode: 200,
        body: JSON.stringify(data)
    });
};


I hope this helps.

View solution in original post

2 Replies 2
Danielle_J
Solution
Participant | Diamond Partner
Participant | Diamond Partner

Custom Headers in CRM Cards

SOLVE

A workaround would need to be implemented. I would suggest reviewing HubSpot's serverless functions functionality - https://developers.hubspot.com/docs/cms/data/serverless-functions.
If you do not have the required Hub that supports this, alternatives include using a middleware/setting up a proxy server.
You could write something like :

exports.main = async (context, sendResponse) => {
    const fetch = require('node-fetch');

    const url = 'https://actual-server.com/data';  // The actual server URL

    const response = await fetch(url, {
        headers: {
            'APP_NAME': 'HUBSPOT'
        }
    });

    const data = await response.json();

    sendResponse({
        statusCode: 200,
        body: JSON.stringify(data)
    });
};


I hope this helps.

VigneshIyappan
Participant

Custom Headers in CRM Cards

SOLVE

Thanks @Danielle_J, for the workaround.

0 Upvotes