working with Discord API

import { fetch } from ‘wix-fetch’ ;
import { getSecret } from ‘wix-secrets-backend’ ;

export async function sendMessageToDiscord ( message ) {
const url = ‘https://discord.com/api/channels/1091669457530802286/messages’ ;
const botToken = await getSecret ( “DISCORD_API” );
const options = {
method : ‘POST’ ,
headers : {
‘Authorization’ : Bot ${ botToken } ,
‘Content-Type’ : ‘application/json’
},
body : JSON . stringify ({ content : message })
};
console . log ( options );
const response = await fetch ( url , options );
const data = await response . json ();
console . log ( data );

**return**  data ; 

}

whats wrong with this code when i run it in backend it gives error [backend/discordServer.jsw, sendMessageToDiscord] returned with

{…}
json Table Copy JSON

message:
“Missing Access”

code:
50001


Although i give it permissions in AOuth2. but still it gives me messages “Missing Access”. please any one help me.
thinks in advance

1 Like

That is an error from Discord, not Wix. There is likely something wrong with your bot configuration. It’s a forbidden access response.