Paresh
Paresh

Reputation: 9

How do I import data from Manychat to Google Sheets?

I am importing some data from Manychat API but it says 401 error (Wrong Format Token)

The link is here

=ImportJSONBasicAuth("https://api.manychat.com/fb/page/getCustomFields?Authorization=Bearer my_token_id", "my_username", "my_password", "/data", "noInherit, noTruncate")

There is a space between Bearer & my_token_id so how could I encode this to import successfully into google sheets?

Manychat give API Key like this

Name: Authorization
Value: Bearer my_token_id

Upvotes: 1

Views: 369

Answers (3)

Ayyub Kolsawala
Ayyub Kolsawala

Reputation: 849

You can add this function inside the Google Script Editor and check if this works. I have tweaked the function a bit.

function ImportJSONBasicAuthForManyChat(url, tokenFromManyChat, query, parseOptions) {
  var header = {headers: {Authorization: "Basic " + tokenFromManyChat}};
  return ImportJSONAdvanced(url, header, query, parseOptions, includeXPath_, defaultTransform_);
}

In the google sheet use it like this

=ImportJSONBasicAuth("https://api.manychat.com/fb/page/getCustomFields", "TOKEN_FROM_MANY_CHAT", "/data", "noInherit, noTruncate")

Upvotes: 1

Ayyub Kolsawala
Ayyub Kolsawala

Reputation: 849

You can paste this in the script editor section of your google sheet and use this function for fetching the data

=ImportJSONBasicAuth("https://api.manychat.com/fb/page/getCustomFields", "username", "password", "/data", "noInherit, noTruncate")

Upvotes: 0

Related Questions