#Set emotes through API?

1 messages · Page 1 of 1 (latest)

sharp rock
#

I don't know if there is something im missing out here but how can i set an emote to an emote-set through the API??? thankss <33 :3

lean moth
sharp rock
#

ye ive checked that

#

but am i blind or there is no set emote thing

lean moth
#

@unique moon maybe you can answer better than me

sharp rock
#

ok thanks a lot ^^ <33 ill wait

lean moth
unique moon
#

forsenHmm hmm, good question, I'm not sure myself there. @hearty valve can you maybe help here?

sharp rock
#

lmao

#

ok ok thanks :33 <33

#

i know an app that can do what im asking, to add an emote through code, so i thought of doing it myself using the API thats why im here

lean moth
#

yeah ryan has a bot that does it so he would know but he's at work rn

#

ryanpotat

sharp rock
#

suree ill wait :3

#

its late here so maybe ill answer in a few hours after sleep

hard magnet
#

You can do that via GQL api, just open the 7tv website with network tab open, try adding an emote and see how the request works

#

But I think it'll stop working once the new website drops

lean moth
#

@near cedar here

near cedar
#

you can use postman to try GQL queries pretty easily

lean moth
#

@near cedar does potatbotat have any documentation

#

maybe that would help

near cedar
near cedar
sharp rock
#

yee im a bit lost here

#

i guess the url for the post is "https://7tv.io/v3/gql" with no header i supose but in the json i dont get what i have to put there

#

im using a weird app for streamers and those kind of things and im only allowed to use this

#

so with a header and a body json can i achive all that?

hard magnet
#

The json I think would be ```js
{
query: ``,
variables: {}
}

sharp rock
#

okay

#

and inside variables is where i add the emote set id and the emote id i want to add to it?

#

or

#

im sorry im a bit noob within this kind of things

hard magnet
#

The variables afaik are: ```js
{
action: "ADD",
id: "emotesetid"
emote_id: "emoteid"
}

#

You have to check how it looks jn the network tab

#

Kinda hard for me on the phone

sharp rock
#

so smth like this ´´´{
query: ``,
variables: {
"action": "ADD",
"id": "6113d5e830aa244e81ea8abf",
"emote_id": "66ec4648daf243ce8c786de0"
}
}´´´

#

oh

hard magnet
#

I think so

#

And fill the query

sharp rock
#

and in query

#
  emoteSet(id: $id) {
    id
    emotes(id: $emote_id, action: $action, name: $name) {
      id
      name
      __typename
    }
    __typename
  }
}``` this is what network did
#

so i put all that inside the ``

hard magnet
#

Yes

sharp rock
#

let me try

#

thanks a lot for the help btw

#

thats what im getting

#
  query: `mutationChangeEmoteInSet($id: ObjectID!,
  $action: ListItemAction!,
  $emote_id: ObjectID!,
  $name: String){
    emoteSet(id: $id){
      idemotes(id: $emote_id,
      action: $action,
      name: $name){
        idname__typename
      }__typename
    }
  }`,
  variables: {
    "action": "ADD",
    "id": "6113d5e830aa244e81ea8abf",
    "emote_id": "66ec4648daf243ce8c786de0"
  }
}````and this is the json i put
hard magnet
sharp rock
#

lmao

#

welp i guess i might have to give up with the idea of adding emotes its a bit too dificult for me maybe, thanks a lot tho ^^<3

hard magnet
#

Maybe someone else will help you scrajj I think you can't do this in the tool you're using Hmmge

sharp rock
#

ye maybe

#

im able to get the emotes inside emote-set to track what emotes are beeing used and so

#

but thats an endpoint to the api so not the same

#

hopefully in the future a new set-emote endpoint is added

hard magnet
sharp rock
#

ok ok :333 then ill wait to the v4

lean moth
near cedar
#
    const body = {
      operationName: 'ChangeEmoteInSet',
      query: `mutation ChangeEmoteInSet($id: ObjectID!, $action: ListItemAction!, $emote_id: ObjectID!, $name: String) {
      emoteSet(id: $id) {
        id
        emotes(id: $emote_id, action: $action, name: $name) {
          id
          name
        }
      }
    }`,
      variables: {
        action: 'ADD',
        id: setID,
        emote_id: emoteID,
        name
      }
    };

    const result = await fetch('https://7tv.io/v3/gql', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer ${'your token'}`
      },
      body: JSON.stringify(body)
    }).then((res) => res.json());

heres a full example

hard magnet
sharp rock
#

ive tried that

#

with the space

#

same "transport not supported data null"

near cedar
#

did you set the content type to application/json

#

header

sharp rock
#

no header

#

do i need it?

near cedar
#

yes, you need that and authorization header

sharp rock
#

how do i know what to put in there

#

also, is this good as a json for the kittyJam emote as an example?

#

do i need to replace "name" in variables¿

near cedar
#

if you want to set an alias, yes

#

otherwise, no

#

if you open network tab on 7tv.app and find any gql request while signed in, just copy the Authorization and Content-Type headers from there

sharp rock
#

oh so name is the alias i get it

near cedar
#

scroll down to Request Headers

sharp rock
#

aha

#

im there

near cedar
#

and it will be Authorization: ey........

sharp rock
#

bearer and a lot of characters

near cedar
#

yes

sharp rock
#

all that including bearer in header

near cedar
#

yep

sharp rock
#

the program crashes lmao

#

oh

#

it specifies object

#

wait

near cedar
sharp rock
#

im using a weird app for streamers to do this xjklñd

#

yeah i dont know if its possible

near cedar
#

should work

sharp rock
#

yee but

#

what do i put as a name for the object i need to create

#

and whats inside that object

#

its a bit hard i guess

#

let me send what u sended to me to the devs of the app

#

could you

#

if its not to much

#

give me the full header + json

#

wait let me try

hard magnet
#

can't you set header Authorization with value Bearer ...? FeelsDankMan

sharp rock
#

name of the object autorization

#

wailt

#

the program needs an object

near cedar
#
        'Content-Type': 'application/json',
        Authorization: 'Bearer ...'
}```
sharp rock
#

yee but again

#

it needs an object

near cedar
#

that is an object

sharp rock
#

ouh

#

sorry im a bit noob

#

let me try doing that inside this

#

content type is a value of the object?

#

inside of it i mean

near cedar
#

yes

sharp rock
#

as weel as authorization

#

thats the name of another value

#

ok let me try

#

thats what i can make

#

an object with two variables

#

but same thing transport not supported

hard magnet
#

transport not supported is because content-type is not set

#

thought you set that FeelsDankMan

sharp rock
#

aaaaahmm

near cedar
#

im not familiar with whatever this program is but if its asking for an object it probably wants this format

        "Content-Type": "application/json",
        "Authorization": "Bearer ..."
}```
sharp rock
#

idk ive put it as a variable but mabe it isnt what it asked for

near cedar
#

for the headers

sharp rock
#

ye thats what i send

#

those photos

#

are the name of the object in purple

#

and both variables that the object has

#

both strings

#

letme try one more thing

near cedar
#

well it didn't send the headers, so it is not correct

sharp rock
#

i dont know

#

that sets the same object

#

but wrote it in json format

#

but same thing

near cedar
#

what program/website is this

sharp rock
#

AAA

#

WAIT

#

eeeh sorry

#

Sammi

#

new result

#

was application not aplication lmao

#

rusty english

near cedar
#

the body needs to be a string

sharp rock
#

wdym

#

without the {}¿

#

it is supposed to be a string

#

all orange-like variables are strings

#

ok but the header is working thats good news

near cedar
#

it would look like this

'{"operationName":"ChangeEmoteInSet","query":"mutation ChangeEmoteInSet($id: ObjectID!, $action: ListItemAction!, $emote_id: ObjectID!, $name: String) { emoteSet(id: $id) { id emotes(id: $emote_id, action: $action, name: $name) { id name } } }","variables":{"action":"ADD","id":"","emote_id":"","name":""}}'
sharp rock
#

let me try

#

thats what i get using what u send

#

sammi asks for "Body JSON string to send"

#

so i guess what i had is better in this case? i dont really know

hard magnet
#

It probably pasted with \ to escape ", remove these slashes

near cedar
#

yea

sharp rock
#

thats how sammi reads it

#

there is no \ in there

#

but

#

the result

#

has them

hard magnet
#

Arent there ' at the start and end? Cant see on the phone

sharp rock
#

yep

#

those arent meant to be in there right

hard magnet
#

Remove them FeelsDankMan

#

Yes

sharp rock
#

ookaay

#

new result

hard magnet
#

Progress PagStick

sharp rock
#

ñlsfkfdd im so sorry but thanks for your time

near cedar
#

you copy pasted my example

#

you need to provide the values of the set ID and emote ID

sharp rock
#

im using them

#

at least in the variables thing

#

ah

#

wait

near cedar
#

you have it backwards

sharp rock
#

xd

#

ive noticed it ye

#

mb

near cedar
#

xd

sharp rock
#

was it

#

first

#

id

#

and then

#

emote-id

#

right?

near cedar
#

id and emote_id

#

order doesn't matter

sharp rock
#

aaaaaaaaa

#

aaaaaaaaaaaaaaa

near cedar
sharp rock
#

AAAAAAAAAAAAA

#

wow

hard magnet
sharp rock
#

im so fucking happy rn

#

u both are

#

like

#

angels

#

to me rn

#

big virtual hug for u both aaaa

near cedar
sharp rock
#

sorry for the rusty english hope it wasnt that bad

hard magnet
#

It was fine PeepoHappy

#

Good luck implementing it to your needs now o7

sharp rock
#

that the easy part

#

thanks a lot guys <3333

lean moth
#

ryan and xslash can just send their paypals

sharp rock
#

this broke recently, was it the api changes u mentioned¿ is the new one gonna be up soon¿

hard magnet
#

uuh the gql should still work, what's the issue?

ornate tartan
#

does anyone know where to get the variable to the color of a 7tv user? Like the text color. For example mine is pruple cause im verified. And green for Moderators etc. Does anyone know where to get that throigh the API?

hard magnet
#

and you can get normal rgb from that with ```javascript
const DecimalToStringRGB = (num) => {
const r = (num >>> 24) & 0xff;
const g = (num >>> 16) & 0xff;
const b = (num >>> 8) & 0xff;

return `rgb(${r}, ${g}, ${b})`;

};```

ornate tartan
#

Thank u! Where exactly did u Find that?

hard magnet
#

it's in most gql requests reffering to the user

ornate tartan
#

Wanna look into it more, but is that the only thing i will need?

hard magnet
#

wdym FeelsDankMan

#

if you want to get the role color then yes

ornate tartan
#

I’m kinda new to all this coding so i dont reallly know what to do with the things you sent here. But i guess i can take these and check on claude or chatgpt

#

If that is all i Will need

hard magnet
#

mb, thought only gql returns it

ornate tartan
#

Uhhh now i am a lil confused Clueless

hard magnet
hard magnet
hard magnet
ornate tartan
#

it worked!