Create GitHub issue API Headers

Hi !

I am creating an application for the User Stories management.

At the end of the process, I need to create an Issue in GitHub.

The authentification is working perfectly with Postman but I canot get it working with appsheet.

I have a retuerned error : Webhook HTTP request failed with exception The remote server returned an error: (403) Forbidden.

Wich means that the authorisation token is not passing well from appsheet to github:

Here is the appsheet monitoring Task Properties.

{

"Exception": "Webhook HTTP request failed with exception The remote server returned an error: (403) Forbidden. ",

"Task Type": "Webhook",

"Task Name": "Task for Send githHub",

"Url": "https://api.github.com/repos/ADMINISTRATION/REPO/issues",

"Verb": "Post",

"MimeType": "application/json",

"Headers": "Authorization: Bearer <HERE IS THE TOKEN>, Content-Type: application/json",

"Payload": "{\"title\": \"titre\",\"body\":\"En tant que Product owner;\\nJe veux avoir quelque chose Ă  faire;\\nAfin de faire quelque chose de ma vie.\",\"assignees\": [\"USER\"],\"labels\": [\"1\"]}"

}

And here is the request that passed through Postman :

POST /repos/ADMINISTRATION/REPO/issues HTTP/1.1
Host: api.github.com
Authorization: Bearer <HERE IS THE TOKEN>

Content-Type: application/json
Cookie: _octo=COOKIE; logged_in=no
Content-Length: 166

{
"title": "Test avec postman",
"body":"Ceci est un test postman",
"assignees": [
"USER"
],
"labels": [
"#4"
]
}

Do you have an idea of what is not working ?
I tried with this in the Headers in appsheet :
Authorization:" Bearer "
Authorization: Bearer
“Authorization: Bearer ”

2 Likes

Can we get the Task screenshot instead of the “appsheet monitoring Task Properties”?

1 Like

Hi @SkrOYC

Here it the screenshot of the task :

Hi,

I found a workaround using google script. Here it is :

function postIssue(url, token, user, title, body, label) {

const requestBody = {
"title": title,
"body":body,
"assignees": [
user
 ],
"labels": [
label
 ]
} 

const requestPayload = JSON.stringify(requestBody);

const requestHeaders = {
"Content-Type": "application/json",
"Authorization": "Bearer " + token,
 };

const request = {
"method": "POST",
"contentType": "application/json",
"headers": requestHeaders,
"payload": requestPayload
};

const response = UrlFetchApp.fetch(url, request);

const output = JSON.parse(response).id;

return output;

}