When a webhook or HTTP request returns data, it rarely returns a single value. It returns a bundle: a temperature and a humidity, a task name and a due date, a status and a message, all packed into one structured reply. Trying to use that bundle as plain text means fragile string searches that break the moment the service changes its wording or order. Dictionary variables solve this properly. A dictionary stores named keys with their values, so your macro can ask for “temperature” by name and get the right number every time, regardless of where it sits in the reply. This guide explains how dictionaries work in MacroDroid, how to fill one from a webhook or HTTP response, and how to read values from it safely — including nested values and missing fields, the two places where most beginners get stuck.
Think of a dictionary as a labelled filing cabinet. Each drawer has a label (the key) and contents (the value). You never need to remember which drawer is third from the left; you ask for the drawer by its label. That simple idea makes macros far more robust. If a service adds a new field to its reply, your macro still finds the fields it needs by name. If it reorders fields, nothing breaks. And if a field is missing, your macro can detect that absence cleanly instead of grabbing the wrong piece of text. Once you are comfortable with dictionaries, webhook macros stop feeling fragile and start feeling dependable.
Prerequisites
You need MacroDroid with dictionary variable support and, for the webhook side, Pro features for HTTP requests and responses. For learning, use a test endpoint that returns structured data — a small, predictable reply with three or four named fields — rather than a complex real service. You should already be comfortable creating a basic macro, setting a variable, and sending a simple HTTP request; this guide builds on those skills rather than reteaching them. Write down the field names your test endpoint returns, exactly as spelled, because dictionary keys are case-sensitive and a single capital letter difference means “not found”. Keep test data harmless, and never practise parsing with a real account’s private data.
It also helps to understand the shape of structured replies at a high level. Most webhook replies are organised as key-and-value pairs, sometimes grouped inside other groups — a “weather” group containing “temperature” and “humidity”, for example. You do not need to master the full format to use dictionaries, but recognising that grouping exists will make nested values far less mysterious when you meet them.
Step-by-Step Setup
Step 1: Send a request and store the raw reply
Create a test macro with a manual trigger and an HTTP Request action aimed at your test endpoint. Store the full reply body in a string variable called “raw_reply” and the status code in an integer variable. Run the macro and read the raw reply carefully: note each key name, its spelling, and whether any values sit inside a nested group. This inspection step is not optional. Macros built without reading an actual reply are built on guesses, and guesses about key names are wrong more often than right. Keep the raw reply visible while you build the next steps, so you can compare every key you type against the real thing.
Step 2: Create a dictionary from the reply
Add an action that converts the reply into a dictionary variable — in MacroDroid this is typically done by parsing the response into a dictionary, or by creating a dictionary variable and populating it from the reply’s fields. Name the dictionary clearly, such as “webhook_data”, and confirm the conversion succeeded by displaying one known value, for example the value stored under the key “status” or “title”. If the display shows nothing, check three things in order: the status code (a failed request has no useful body), the key spelling, and whether the reply is wrapped in an outer group you have not accounted for. Do not proceed until a single known value reads correctly; everything later depends on this step.
Step 3: Read simple values by key name
With the dictionary populated, practise reading values by key. Create a notification or a spoken message that includes one dictionary value, using the dictionary’s key syntax, and trigger the macro. Confirm the displayed value matches the raw reply exactly. Repeat for each top-level key you need, one at a time, rather than building a complex message with five values at once — when a multi-value message goes wrong, you cannot tell which key failed. Give each extracted value a plain variable of its own if you will reuse it later, such as “current_temperature”, so later actions read a simple variable instead of repeating dictionary lookups. Clear naming here saves confusion later.
Step 4: Read nested values step by step
Nested values live inside a group within the dictionary: to reach “temperature” inside “weather”, you first read the “weather” group, then read “temperature” from within it. The mistake beginners make is trying to jump straight to the inner value in one step. Instead, store the inner group in its own dictionary variable first, verify it contains what you expect, and only then read the inner key. Test this with your test endpoint’s nested group, and display both the group and the inner value while learning, so you can see each level. If a nested read returns nothing, the usual cause is a misspelled group name or an extra level of grouping you missed in the raw reply — re-read the raw reply and count the levels.
Step 5: Handle missing fields gracefully
Real services change, and fields disappear. Before your macro acts on a dictionary value, check whether that key exists or whether the value is empty. Build a branch: if the key exists, continue normally; if it does not, show a notification explaining which field was missing and stop safely, or fall back to a previous value you stored earlier. Test this branch deliberately by pointing the macro at a test reply that omits the field — you can craft such a reply with a test endpoint or a locally stored example. A macro that handles a missing field calmly is a macro you can trust with automatic triggers; a macro that crashes or acts on an empty value is not.
Step 6: Use dictionary values in real actions
Now put the values to work. A temperature value might set a scene label, trigger a fan-control macro above a threshold, or be spoken aloud in a morning briefing. A task title might become a reminder notification. A status value might branch the macro: “complete” silences a reminder, while anything else leaves it active. Keep each use simple and test it with at least three different replies, including an edge case such as a zero value, which some macros mistakenly treat as “missing”. When the pattern works, replace the manual trigger with your intended automatic trigger, keep the missing-field branch in place, and rename the macro to reflect its real purpose.
Testing and Verification
Verify the macro against a table of test replies: a normal reply, a reply with fields reordered, a reply with an extra field added, a reply missing one field, and a reply with a nested group changed. The macro should produce the correct result for the first three, a safe fallback for the fourth, and either a correct result or a clear error for the fifth. Test after a restart and with both Wi-Fi and mobile data, and confirm no raw reply containing private data is ever displayed in a notification or scene. Record which keys your macro depends on, so a future service change can be diagnosed in minutes rather than hours.
Troubleshooting
If every dictionary read returns empty, suspect the conversion step: confirm the request succeeded, the raw reply is present, and the dictionary was actually populated before it was read. If one key works and another does not, compare spellings character by character, including capital letters and underscores. If nested values fail while top-level values work, you have missed a grouping level — store the inner group separately and inspect it. If values appear correct in testing but wrong in live use, the live service’s reply format probably differs from your test endpoint’s; capture a live raw reply (with private data removed) and compare its keys. If a macro acts on stale data, check whether an old dictionary value survives a failed request; clear the dictionary at the start of each run so a failure cannot masquerade as yesterday’s success.
Tips
Clear your dictionary at the start of every run, so failed requests leave emptiness rather than stale values. Name dictionary variables after their source — “weather_data”, “task_data” — not generically, so a macro with two dictionaries stays readable. Keep a small note of each service’s key names and nesting, because that note is the first thing you will need when a service updates. Prefer reading by key over searching raw text whenever possible; it is the entire reason dictionaries exist. Finally, log dictionary reads during development and remove verbose logging once the macro is stable, keeping only a brief success-or-failure record.
Frequently Asked Questions
What is a dictionary variable in MacroDroid?
A dictionary variable stores named keys with their values, like a labelled filing cabinet. You retrieve a value by asking for its key name, rather than by its position in a block of text.
Why use a dictionary instead of searching the reply text?
Searching text breaks when a service reorders fields or changes wording. Reading by key keeps working through reordering and extra fields, making macros far more robust.
Are dictionary keys case-sensitive?
Yes. “Temperature” and “temperature” are different keys. Always copy key names exactly from an actual reply, and check spelling first when a read returns empty.
How do I read a value inside a nested group?
Read the outer group into its own dictionary variable first, verify it, then read the inner key from that group. Trying to jump to the inner value in one step is the most common nested-value mistake.
What should happen when a field is missing?
Branch safely: notify yourself which field was missing and stop, or fall back to a previously stored value. Never let a missing field silently become zero or an empty message that triggers further actions.


