Publishing long strings to webhooks

Hello,
I am currently having trouble writing really long strings to a webhook on the particle console. As part of the server side, I need to send a access key that is around 400 characters long. When I hard code the access key into the webhook, everything works fine. But since the access key expires every hour, that is not a viable solution, I need to use {{PARTICLE_EVENT_VALUE}} to send a different access key each time. But when I send the key with particle.publish(), the request fails. Looking at the logs on the particle console, I see the cloud only transfered 256 characters of my access key. Is it possible to send a longer string? Below is my code:

void setup()
{
  delay(1000);

  Serial.begin(9600);
  Serial.println("connecting");
}

void loop() 
{
  String access_token = "Bearer Atza|IwEBIH9aG4mvW2GYjTu35K_oECPeb7qXumriv5SIFebMRAcFJzoztGQoPjhiOvHXFcqKYtSbxiFWe-20FHJfZ01a_ZYX543PVy-41hrE9u9W-2YvzBlU40iMHjwYPb41LdP6fw66SwePAqTwA1HxB4TQntHlIBX_RpyPHOFKmKtn2LdRWMPcMAeLT0zGmQf_srNgkLtP-YtteADc43kbRbMtgUQPhzRzdeT8N_6zVFSibY2SIM4mye0_KcXRXgUa18s8EMS7PwPZ7xcyD_INxRQvYiifjt8FUJu-y3s4nmExP49dP8nLm1FjEOReZRi89YBBN6-WI1D766CKkLkidl_M70O66qmStiZB77GzrVdtjgGkRHi27krX1KbgQJIkFMPKORv0a_xiX6tuzZOW0JmtjkY8edGJzrlUb7iHC0sDyi9i7dDoYHbVtsDxwFLyTaJ7a3Q";
  
  Serial.println("running");
  Particle.publish("drs_replenish_batteries", access_token, PRIVATE);
  // Wait 60 seconds
  Serial.println("Done.");
  delay(6000000);
}

Why does the access token expire once an hour? How are you planning to get around the issue by hardcoding the token into the Photon?

There is another token, a “refresh_token” that does not expire and can be used to request a new access token. So I will use the refresh token to request a new access token, then use the access token to make service calls. Basically the refresh token is static (but it can be reset) and you need a new access token whenever you want to make calls. Right now i hard coded it for testing. by now the code above is expired.

Ah, that’s unfortunately. Ideally Particle’s webhooks would handle OAuth (which is what I imagine you are referring to).

In the mean time, what about setting up a quick microservice (I like Webtask but you could also use AWS Lambda, Heroku, etc) that you use as a “middleman” between your webhook from particle and your end service? It could automatically handle the token refreshing